답변완료
도움 부탁드립니다
안녕하세요
늘 도움주셔서 감사드립니다.
아래의 지표 내용중에서 캔들에 "●","▼","▲" 표시를 하는 부분이 있습니다.
총 8개 인데 이 부분을 검색식으로나, 아니면 강조식이든 켄들이 종가 마감이 아닌
캔들이 시작될때 표시되었으면 합니다.
표현이 제대로 되었는지 ...
고맙습니다.
input : length(20);
input : len2(10);
input : showsignals(true);
input : highlighting(true);
var : upper(0),lower(0);
lower = lowest(L,length);
upper = highest(H,length);
plot1(upper, "Upper");
plot2(lower, "Lower");
var : up(0),down(0),sup(0),sdown(0);
var : k1(0),k2(0),k3(0),k4(0),i1(-1),i2(-1);
up=highest(high,length);
down=lowest(low,length);
sup=highest(high,len2);
sdown=lowest(low,len2);
if high >= up[1] Then
i1 = 0;
Else
{
if i1 >= 0 Then
i1 = i1+1;
}
if Low <= down[1] Then
i2 = 0;
Else
{
if i2 >= 0 Then
i2 = i2+1;
}
K1=iff(i1 <=i2, down , up);
K2=iff(i1 <= i2,sdown,sup);
K3=iff(close>K1,down,nan);
K4=iff(close<K1,up,nan);
plot3(K1,"Trend Line",red);
plot4(K2,"Exit Line",blue);
var : buySignal(False),sellSignal(False),buyExit(False),sellExit(False);
var : O1(-1),O2(-1),O3(-1),O4(-1);
var : E1(-1),E2(-1),E3(-1),E4(-1);
var : tx1(0),tx2(0),tx3(0),tx4(0);
var : tx5(0),tx6(0),tx7(0),tx8(0);
buySignal=high==upper[1] or CrossUp(high,upper[1]);
sellSignal = low==lower[1] or CrossUp(lower[1],low);
buyExit=low==sdown[1] or CrossUp(sdown[1],low);
sellExit = high==sup[1] or CrossUp(high,sup[1]);
if BuySignal == true Then
var1 = Index;
if sellSignal == true Then
var2 = Index;
if buyExit == true Then
var3 = Index;
if sellExit == true Then
var4 = Index;
O1= IFf(var1 > 0,Index-var1,-1);
O2= IFf(var2 > 0,Index-var2,-1);
O3= IFf(var3 > 0,Index-var3,-1);
O4= IFf(var4 > 0,Index-var4,-1);
if BuySignal[1] == true Then
var5 = Index;
if sellSignal[1] == true Then
var6 = Index;
if buyExit[1] == true Then
var7 = Index;
if sellExit[1] == true Then
var8 = Index;
E1= IFf(var5 > 0,Index-var5,-1);
E2= IFf(var6 > 0,Index-var6,-1);
E3= IFf(var7 > 0,Index-var7,-1);
E4= IFf(var8 > 0,Index-var8,-1);
if buySignal and O3<O1[1] Then
{
tx1 = Text_New(sDate,sTime,down,"●");
Text_SetColor(tx1,Green);
}
if buySignal and showsignals and O3<O1[1] Then
{
tx2 = Text_New(sDate,sTime,down,"▲");
Text_SetColor(tx2,Green);
}
if sellSignal and O4<O2[1] Then
{
tx3 = Text_New(sDate,sTime,up,"●");
Text_SetColor(tx3,Red);
}
if sellSignal and showsignals and O4<O2[1] Then
{
tx4 = Text_New(sDate,sTime,down,"▼");
Text_SetColor(tx4,Red);
}
if buyExit and O1<O3[1] Then
{
tx5 = Text_New(sDate,sTime,up,"●");
Text_SetColor(tx5,blue);
}
if buyExit and showsignals and O1<O3[1] Then
{
tx6 = Text_New(sDate,sTime,down,"▼");
Text_SetColor(tx6,blue);
}
if sellExit and O2<O4[1] Then
{
tx7 = Text_New(sDate,sTime,down,"●");
Text_SetColor(tx7,Yellow);
}
if sellExit and showsignals and O2<O4[1] Then
{
tx8 = Text_New(sDate,sTime,down,"▲");
Text_SetColor(tx8,blue);
}
2025-01-13
511
글번호 187149
지표
답변완료
질문드리겠습니다
안녕하세요 몇가지 여쭤보겠습니다
질문1)
아래와 같은 수식에서
1 to (var2-var1)-1 구간의 평균을 value1 에 구해놨는데요,,
1 to (var2-var1)-1 구간에서 value1 값보다 큰 H 값이 나올때마다 저장을하고 (최고가 값을 구하는게 아님)
그 모든 H 값들을 더해서 평균을 구하는 수식을 만들고 싶습니다
감사합니다
var : cnt(0), sum1(0), sumi(0),tt(0),hh(0),ll(0);
var : t(0),StartBarIndex(0);
Array : ii[50](0),aa[50](0);
if h>l*1.08 Then
{
TL_NEW(sDatE,sTimE,h*1.01,sDatE,sTimE,99999);
var1 = Index;
Var2 = var1[1];
sum1=0;
sumi=0;
For cnt = 1 to (var1-Var2)-1
{
sum1=sum1+h[cnt];
sumi=sumi+1;
}
value1=sum1/sumi;
if value1>0 then Plot11(value1,"sma",Blue,Def,1);
}
질문2)
countif 관련 질문인데요
countif 는 현재봉 기준으로 과거 일정 기간동안 조건이 횟수만큼 발생하면 신호가 나오는게 맞지 않나요?
아래 수식과 같이 h>l*1.08 라는 조건문 안에 countif 가 있으면,
if CountIf(aa[0] > aa[1]*1.05,5)>=4 이 부분을 어떻게 처리하는건지 궁금합니다
현재봉이 직전봉 (배열) 보다 5%이상 크다 라는 조건이 4회이상 나온다 라는 의도로 작성했습니다. 처음에는 100봉 같이 기간을 길게 잡고 했었는데 5봉 같이 짧은기간에도 나오길레
조건만족봉에서 뒤로 5개봉이내가 아니라 조건만족에 해당한 봉들 5개 이내이며, countif 에 들어간 조건은 h>l*1.08 조건만족 해당할때만 (즉 조건 두가지 모두 만족), 이라는 의미인거 같은데.. 조건에 맞지 않는데도 신호가 나올때가 있어서 헷갈리네요
if h>l*1.08 Then
{
TL_NEW(sDatE,sTimE,h*1.01,sDatE,sTimE,99999);
var1 = Index;
Var2 = var1[1];
For cnt = 49 DownTo 1
{
aa[cnt] = aa[cnt-1];
}
aa[0] = h;
if aa[0] > aa[1]*1.05 Then Plot12(h,"aa comp",Green,Def,1);
if CountIf(aa[0] > aa[1]*1.05,5)>=4 Then Plot13(h,"CountIf",Red,Def,1);
}
2025-01-13
573
글번호 187143
지표
답변완료
문의 드립니다
input:length(2),a틱(30),b틱(30),c틱(2);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),process(0),T(0);
Array:HH[10,2](0),LL[10,2](0);
input : StartTime(100000),EndTime(53000);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
process = 0;
If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then
{
If LL[1,1] > L Then process = -1;
If HH[1,1] < H Then process = 1;
}
Else If Highest(H,length) == H and lastHiVal <> H Then process = 1;
Else If Lowest(L,length) == L and lastLoVal <> L Then process = -1;
If process == 1 Then
{
T = 1;
lastHiVal = H;
If HH[1,2] < LL[1,2] Then
{
For j = 10 DownTo 2
{
HH[j,1] = HH[j-1,1];
HH[j,2] = HH[j-1,2];
}
}
If HH[1,2] < LL[1,2] or HH[1,1] < H Then
{
HH[1,1] = H;
HH[1,2] = Index;
sBar = Index - LL[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
if LL[1,1] > 0 Then
{
TL1 = TL_New(sDate[sBar],sTime[sBar],LL[1,1],sDate[eBar],sTime[eBar],HH[1,1]);
Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 1);
}
Else
{
Text_Delete(text1);
Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,2));
Text_SetStyle(Text1, 2, 1);
}
Text_SetStyle(Text1, 2, 1);
}
if MarketPosition <= 0 and
HH[2,1] >= LL[2,1]+PriceScale*a틱 and
LL[1,1] <= HH[2,1]-PriceScale*b틱 and
Tcond == true Then
Buy("b",AtStop,HH[2,1]+PriceScale*c틱);
}
If process == -1 Then
{
T = -1;
lastLoVal = L;
If LL[1,2] < HH[1,2] Then
{
For j = 10 DownTo 2
{
LL[j,1] = LL[j-1,1];
LL[j,2] = LL[j-1,2];
}
}
If LL[1,2] < HH[1,2] or LL[1,1] > L Then
{
LL[1,1] = L;
LL[1,2] = Index;
sBar = Index - HH[1,2];
eBar = 0;
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
if HH[1,1] > 0 Then
{
TL1 = TL_New(sDate[sBar],sTime[sBar],HH[1,1],sDate[eBar],sTime[eBar],LL[1,1]);
Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 0);
}
Else
{
Text_Delete(text1);
Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0));
Text_SetStyle(Text1, 2, 0);
}
}
if MarketPosition >= 0 and
LL[2,1] <= HH[2,1]-PriceScale*a틱 and
HH[1,1] >= LL[2,1]+PriceScale*b틱 and
Tcond == true Then
Sell("s",AtStop,LL[2,1]-PriceScale*c틱);
}
if MarketPosition == 1 and IsEntryName("b") == true Then
Sell("bs",AtStop,EntryPrice-PriceScale*50);
if MarketPosition == -1 and IsEntryName("s") == true Then
Buy("sb",AtStop,EntryPrice+PriceScale*50);
위 수식어에 당일 매매중 70틱 수익에 매매정지를 포함해 주시면 감사하겠습니다.
2025-01-13
636
글번호 187117
시스템