커뮤니티
수식 수정 부탁드립니다
2015-10-29 17:10:18
294
글번호 91876
input : SellPrice1(),SellPrice2(),BuyPrice1(),BuyPrice2();
if CrossDown(c,SellPrice1) Then
sell("s1");
if CrossDown(c,SellPrice2) Then
sell("s2");
if CrossUp(c,BuyPrice1) Then
buy("b1");
if CrossUp(c,BuyPrice2) Then
buy("b2");
<개선 희망 사항>
(1)
SellPrice1()에서 매도 신호 발생후 BuyPrice1()에서 매수 신호 발생하고 상승시
SellPrice1() 에서 다시 매도 신호가 발생합니다
이 경우 SellPrice1()에서는 매도 신호가 발생하지 않고 그보다 높은 SellPrice2()에서만 매도 신호가 발생하게 수식 수정 부탁드립니다
즉 한번 발생한 매도 신호는 다음에 그 가격 터치할 경우 매도 신호를 발생시키지 않는 방식입니다
(2)
BuyPrice1()에서 매수 신호 발생후 SellPrice1()에서 매도 신호 발생하고 하락시
BuyPrice1() 에서 다시 매수 신호가 발생합니다
이 경우 BuyPrice1()에서는 매수 신호가 발생하지 않고 그보다 낮은 BuyPrice2()에서만 매수 신호가 발생하게 수식 수정 부탁드립니다
즉 한번 발생한 매수 신호는 다음에 그 가격 터치할 경우 매수 신호를 발생시키지 않는 방식입니다
---------------
그리고 앞에서 답변해주신 수식을 검색식에서 크루드오일 차트에 적용해보니
오늘자 차트에는 바닥 위로는 숫자와 선이 나타나는데
천정 아래로는 숫자와 선이 출력되지 않습니다
그리고 지나간 어제 차트에는 선이 나타나지 않고 숫자로 -40 만 출력됩니다
확인 부탁드립니다
감사합니다
----------------
안녕하세요
예스스탁입니다.
해당 내용 추세선과 텍스트 함수로 구현해야 합니다.
따로 plot명령어로 출력되는 부분이 없으므로
검색식으로 작성해 차트에 적용하시면 됩니다.
input : N(40);
var : HH(0),LL(0),T(0),HD(0),HT(0),LD(0),LT(0),HL(0),LH(0);
var : Tx1(0),tx2(0),tx3(0),tx4(0),tx5(0),tx6(0),tx7(0),tx8(0),tx9(0);
var : Tx11(0);
var : TL1(0),tl2(0),tl3(0),tl4(0),tl5(0),tl6(0),tl7(0),tl8(0),tl9(0);
if bdate != bdate[1] then{
HH = H;
HD = sdate;
HT = stime;
HL = HH;
LL = L;
LD = sdate;
LT = stime;
T = 0;
LH = H;
}
if H > HH Then{
T = 1;
HH = H;
HD = sdate;
HT = stime;
HL = HH;
}
if L < LL Then{
T = -1;
LL = L;
LD = sdate;
LT = stime;
LH = LL;
}
if T == 1 and T[1] == 1 Then{
if L < HL Then
HL = L;
TL_Delete(TL1);
TL_Delete(TL2);
TL_Delete(TL3);
TL_Delete(TL4);
TL_Delete(TL5);
TL_Delete(TL6);
TL_Delete(TL7);
TL_Delete(TL8);
TL_Delete(TL9);
TL1 = TL_New(HT,HT,dayhigh-PriceScale*(N*1),sdate,stime,dayhigh-PriceScale*(N*1));
TL2 = TL_New(HT,HT,dayhigh-PriceScale*(N*2),sdate,stime,dayhigh-PriceScale*(N*2));
TL3 = TL_New(HT,HT,dayhigh-PriceScale*(N*3),sdate,stime,dayhigh-PriceScale*(N*3));
TL4 = TL_New(HT,HT,dayhigh-PriceScale*(N*4),sdate,stime,dayhigh-PriceScale*(N*4));
TL5 = TL_New(HT,HT,dayhigh-PriceScale*(N*5),sdate,stime,dayhigh-PriceScale*(N*5));
TL6 = TL_New(HT,HT,dayhigh-PriceScale*(N*6),sdate,stime,dayhigh-PriceScale*(N*6));
TL7 = TL_New(HT,HT,dayhigh-PriceScale*(N*7),sdate,stime,dayhigh-PriceScale*(N*7));
TL8 = TL_New(HT,HT,dayhigh-PriceScale*(N*8),sdate,stime,dayhigh-PriceScale*(N*8));
TL9 = TL_New(HT,HT,dayhigh-PriceScale*(N*9),sdate,stime,dayhigh-PriceScale*(N*9));
TL_SetColor(TL1,blue);
TL_SetColor(TL2,blue);
TL_SetColor(TL3,blue);
TL_SetColor(TL4,blue);
TL_SetColor(TL5,blue);
TL_SetColor(TL6,blue);
TL_SetColor(TL7,blue);
TL_SetColor(TL8,blue);
TL_SetColor(TL9,blue);
Text_Delete(tx1);
Text_Delete(tx2);
Text_Delete(tx3);
Text_Delete(tx4);
Text_Delete(tx5);
Text_Delete(tx6);
Text_Delete(tx7);
Text_Delete(tx8);
Text_Delete(tx9);
tx1 = Text_New(sdate,stime,dayhigh-PriceScale*(N*1),"-"+NumToStr(N*1,0));
tx2 = Text_New(sdate,stime,dayhigh-PriceScale*(N*2),"-"+NumToStr(N*2,0));
tx3 = Text_New(sdate,stime,dayhigh-PriceScale*(N*3),"-"+NumToStr(N*3,0));
tx4 = Text_New(sdate,stime,dayhigh-PriceScale*(N*4),"-"+NumToStr(N*4,0));
tx5 = Text_New(sdate,stime,dayhigh-PriceScale*(N*5),"-"+NumToStr(N*5,0));
tx6 = Text_New(sdate,stime,dayhigh-PriceScale*(N*6),"-"+NumToStr(N*6,0));
tx7 = Text_New(sdate,stime,dayhigh-PriceScale*(N*7),"-"+NumToStr(N*7,0));
tx8 = Text_New(sdate,stime,dayhigh-PriceScale*(N*8),"-"+NumToStr(N*8,0));
tx9 = Text_New(sdate,stime,dayhigh-PriceScale*(N*9),"-"+NumToStr(N*9,0));
if HL <= dayhigh-PriceScale*(N*1) and HL[1] > dayhigh-PriceScale*(N*1) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*1,0));
if HL <= dayhigh-PriceScale*(N*2) and HL[1] > dayhigh-PriceScale*(N*2) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*2,0));
if HL <= dayhigh-PriceScale*(N*3) and HL[1] > dayhigh-PriceScale*(N*3) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*3,0));
if HL <= dayhigh-PriceScale*(N*4) and HL[1] > dayhigh-PriceScale*(N*4) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*4,0));
if HL <= dayhigh-PriceScale*(N*5) and HL[1] > dayhigh-PriceScale*(N*5) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*5,0));
if HL <= dayhigh-PriceScale*(N*6) and HL[1] > dayhigh-PriceScale*(N*6) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*6,0));
if HL <= dayhigh-PriceScale*(N*7) and HL[1] > dayhigh-PriceScale*(N*7) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*7,0));
if HL <= dayhigh-PriceScale*(N*8) and HL[1] > dayhigh-PriceScale*(N*8) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*8,0));
if HL <= dayhigh-PriceScale*(N*9) and HL[1] > dayhigh-PriceScale*(N*9) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*9,0));
Text_SetStyle(tx11,2,2);
}
if T == -1 and T[1] == -1 Then{
if H > LH Then
LH = H;
TL_Delete(TL1);
TL_Delete(TL2);
TL_Delete(TL3);
TL_Delete(TL4);
TL_Delete(TL5);
TL_Delete(TL6);
TL_Delete(TL7);
TL_Delete(TL8);
TL_Delete(TL9);
TL1 = TL_New(LD,LT,daylow+PriceScale*(N*1),sdate,stime,daylow+PriceScale*(N*1));
TL2 = TL_New(LD,LT,daylow+PriceScale*(N*2),sdate,stime,daylow+PriceScale*(N*2));
TL3 = TL_New(LD,LT,daylow+PriceScale*(N*3),sdate,stime,daylow+PriceScale*(N*3));
TL4 = TL_New(LD,LT,daylow+PriceScale*(N*4),sdate,stime,daylow+PriceScale*(N*4));
TL5 = TL_New(LD,LT,daylow+PriceScale*(N*5),sdate,stime,daylow+PriceScale*(N*5));
TL6 = TL_New(LD,LT,daylow+PriceScale*(N*6),sdate,stime,daylow+PriceScale*(N*6));
TL7 = TL_New(LD,LT,daylow+PriceScale*(N*7),sdate,stime,daylow+PriceScale*(N*7));
TL8 = TL_New(LD,LT,daylow+PriceScale*(N*8),sdate,stime,daylow+PriceScale*(N*8));
TL9 = TL_New(LD,LT,daylow+PriceScale*(N*9),sdate,stime,daylow+PriceScale*(N*9));
TL_SetColor(TL1,red);
TL_SetColor(TL2,red);
TL_SetColor(TL3,red);
TL_SetColor(TL4,red);
TL_SetColor(TL5,red);
TL_SetColor(TL6,red);
TL_SetColor(TL7,red);
TL_SetColor(TL8,red);
TL_SetColor(TL9,red);
Text_Delete(tx1);
Text_Delete(tx2);
Text_Delete(tx3);
Text_Delete(tx4);
Text_Delete(tx5);
Text_Delete(tx6);
Text_Delete(tx7);
Text_Delete(tx8);
Text_Delete(tx9);
tx1 = Text_New(sdate,stime,daylow+PriceScale*(N*1),"+"+NumToStr(N*1,0));
tx2 = Text_New(sdate,stime,daylow+PriceScale*(N*2),"+"+NumToStr(N*2,0));
tx3 = Text_New(sdate,stime,daylow+PriceScale*(N*3),"+"+NumToStr(N*3,0));
tx4 = Text_New(sdate,stime,daylow+PriceScale*(N*4),"+"+NumToStr(N*4,0));
tx5 = Text_New(sdate,stime,daylow+PriceScale*(N*5),"+"+NumToStr(N*5,0));
tx6 = Text_New(sdate,stime,daylow+PriceScale*(N*6),"+"+NumToStr(N*6,0));
tx7 = Text_New(sdate,stime,daylow+PriceScale*(N*7),"+"+NumToStr(N*7,0));
tx8 = Text_New(sdate,stime,daylow+PriceScale*(N*8),"+"+NumToStr(N*8,0));
tx9 = Text_New(sdate,stime,daylow+PriceScale*(N*9),"+"+NumToStr(N*9,0));
if LH >= daylow+PriceScale*(N*1) and LH[1] < daylow+PriceScale*(N*1) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*1,0));
if LH >= daylow+PriceScale*(N*2) and LH[1] < daylow+PriceScale*(N*2) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*2,0));
if LH >= daylow+PriceScale*(N*3) and LH[1] < daylow+PriceScale*(N*3) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*3,0));
if LH >= daylow+PriceScale*(N*4) and LH[1] < daylow+PriceScale*(N*4) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*4,0));
if LH >= daylow+PriceScale*(N*5) and LH[1] < daylow+PriceScale*(N*5) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*5,0));
if LH >= daylow+PriceScale*(N*6) and LH[1] < daylow+PriceScale*(N*6) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*6,0));
if LH >= daylow+PriceScale*(N*7) and LH[1] < daylow+PriceScale*(N*7) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*7,0));
if LH >= daylow+PriceScale*(N*8) and LH[1] < daylow+PriceScale*(N*8) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*8,0));
if LH >= daylow+PriceScale*(N*9) and LH[1] < daylow+PriceScale*(N*9) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*9,0));
Text_SetStyle(tx11,2,2);
}
즐거운 하루되세요
> 타이쿤 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다
> (1)당일 저가에서 상승시 40틱 단위로 적색선 그리기
...선 우측에 +40,+80,+120,+160,+200,+240,+280,+320+360 글 쓰기
...해당 캔들 위에 +40,+80,+120+160,+200,+240,+280,+320,+360 글 쓰기
(2)당일 고가에서 하락시 40틱 단위로 청색선 그리기
...선 우측에 -40,-80,-120,-160,-200,-240,-280,-320-360 글 쓰기
...해당 캔들 아래에 -40,-80,-120-160,-200,-240,-280,-320,360 글 쓰기
감사합니다
답변 1
예스스탁 예스스탁 답변
2015-10-29 19:39:30
안녕하세요
예스스탁입니다.
1.
input : SellPrice1(),SellPrice2(),BuyPrice1(),BuyPrice2();
var : bcond1(false),Bcond2(false),Scond1(false),Scond2(false);
if Scond1 == false and CrossDown(c,SellPrice1) Then{
Scond1 = true;
sell("s1");
}
if Scond2 == false and CrossDown(c,SellPrice2) Then{
Scond2 = true;
sell("s2");
}
if bcond1 == false and CrossUp(c,BuyPrice1) Then{
bcond1 = true;
buy("b1");
}
if Bcond2 == false and CrossUp(c,BuyPrice2) Then{
Bcond2 = false;
buy("b2");
}
차트 전체에서 각 라인으로 신호는 1번만 발생하게 했습니다.
만약 당일 1회씩이면 아래와 같이 작성하시면 됩니다.
즉 특정시점에 초기화가 필요하시면
if 문으로 조건지정하시고 false로 초기화 하시면 됩니다.
input : SellPrice1(),SellPrice2(),BuyPrice1(),BuyPrice2();
var : bcond1(false),Bcond2(false),Scond1(false),Scond2(false);
if date != date[1] Then{
Scond1 = false;
Scond2 = false;
Bcond1 = false;
Bcond2 = false;
}
if Scond1 == false and CrossDown(c,SellPrice1) Then{
Scond1 = true;
sell("s1");
}
if Scond2 == false and CrossDown(c,SellPrice2) Then{
Scond2 = true;
sell("s2");
}
if bcond1 == false and CrossUp(c,BuyPrice1) Then{
bcond1 = true;
buy("b1");
}
if Bcond2 == false and CrossUp(c,BuyPrice2) Then{
Bcond2 = false;
buy("b2");
}
2.
해당식은 가장 최근의 당일최고가가 형성되었으면
최고가에서 아래쪽 가장최근에 당일 최저가가 형성되었으면
최저가에서 위쪽만 그려집니다.
즉 마지막 구간만 보여지게 됩니다.
식 다시 올려드립니다.
지표식으로 적용하시면 됩니다.
plot으로 전체 차트에 출력하게 작성했습니다.
input : N(40);
var : HH(0),LL(0),T(0),HD(0),HT(0),LD(0),LT(0),HL(0),LH(0);
var : Tx1(0),tx2(0),tx3(0),tx4(0),tx5(0);
var : tx6(0),tx7(0),tx8(0),tx9(0),Tx10(0);
if bdate != bdate[1] then{
T = 0;
HH = H;
LL = L;
}
if H > HH and Bdate == Bdate[1] Then{
T = 1;
HH = H;
Condition1 = false;
Condition2 = false;
Condition3 = false;
Condition4 = false;
Condition5 = false;
Condition6 = false;
Condition7 = false;
Condition8 = false;
Condition9 = false;
}
if L < LL and Bdate == Bdate[1] Then{
T = -1;
LL = L;
Condition1 = false;
Condition2 = false;
Condition3 = false;
Condition4 = false;
Condition5 = false;
Condition6 = false;
Condition7 = false;
Condition8 = false;
Condition9 = false;
}
if T == 1 Then{
var1 = dayhigh-PriceScale*(N*1);
var2 = dayhigh-PriceScale*(N*2);
var3 = dayhigh-PriceScale*(N*3);
var4 = dayhigh-PriceScale*(N*4);
var5 = dayhigh-PriceScale*(N*5);
var6 = dayhigh-PriceScale*(N*6);
var7 = dayhigh-PriceScale*(N*7);
var8 = dayhigh-PriceScale*(N*8);
var9 = dayhigh-PriceScale*(N*9);
plot1(var1,"1",blue);
plot2(var2,"2",blue);
plot3(var3,"3",blue);
plot4(var4,"4",blue);
plot5(var5,"5",blue);
plot6(var6,"6",blue);
plot7(var7,"7",blue);
plot8(var8,"8",blue);
plot9(var9,"9",blue);
Text_Delete(tx1);
Text_Delete(tx2);
Text_Delete(tx3);
Text_Delete(tx4);
Text_Delete(tx5);
Text_Delete(tx6);
Text_Delete(tx7);
Text_Delete(tx8);
Text_Delete(tx9);
tx1 = Text_New(sdate,stime,var1,"-"+NumToStr(N*1,0));
tx2 = Text_New(sdate,stime,var2,"-"+NumToStr(N*2,0));
tx3 = Text_New(sdate,stime,var3,"-"+NumToStr(N*3,0));
tx4 = Text_New(sdate,stime,var4,"-"+NumToStr(N*4,0));
tx5 = Text_New(sdate,stime,var5,"-"+NumToStr(N*5,0));
tx6 = Text_New(sdate,stime,var6,"-"+NumToStr(N*6,0));
tx7 = Text_New(sdate,stime,var7,"-"+NumToStr(N*7,0));
tx8 = Text_New(sdate,stime,var8,"-"+NumToStr(N*8,0));
tx9 = Text_New(sdate,stime,var9,"-"+NumToStr(N*9,0));
if Condition1 == false and CrossDown(c,var1) Then{
tx10 = Text_New(sdate,stime,H,"-"+NumToStr(N*1,0));
Condition1 = true;
}
if Condition2 == false and CrossDown(c,var2) Then{
tx10 = Text_New(sdate,stime,H,"-"+NumToStr(N*2,0));
Condition1 = true;
}
if Condition3 == false and CrossDown(c,var3) Then{
tx10 = Text_New(sdate,stime,H,"-"+NumToStr(N*3,0));
Condition3 = true;
}
if Condition4 == false and CrossDown(c,var4) Then{
tx10 = Text_New(sdate,stime,H,"-"+NumToStr(N*4,0));
Condition4 = true;
}
if Condition5 == false and CrossDown(c,var5) Then{
tx10 = Text_New(sdate,stime,H,"-"+NumToStr(N*5,0));
Condition5 = true;
}
if Condition6 == false and CrossDown(c,var6) Then{
tx10 = Text_New(sdate,stime,H,"-"+NumToStr(N*6,0));
Condition6 = true;
}
if Condition7 == false and CrossDown(c,var7) Then{
tx10 = Text_New(sdate,stime,H,"-"+NumToStr(N*7,0));
Condition7 = true;
}
if Condition8 == false and CrossDown(c,var8) Then{
tx10 = Text_New(sdate,stime,H,"-"+NumToStr(N*8,0));
Condition8 = true;
}
if Condition9 == false and CrossDown(c,var9) Then{
tx10 = Text_New(sdate,stime,H,"-"+NumToStr(N*8,0));
Condition9 = true;
}
Text_SetStyle(tx1,2,2);
Text_SetStyle(tx2,2,2);
Text_SetStyle(tx3,2,2);
Text_SetStyle(tx4,2,2);
Text_SetStyle(tx5,2,2);
Text_SetStyle(tx6,2,2);
Text_SetStyle(tx7,2,2);
Text_SetStyle(tx8,2,2);
Text_SetStyle(tx9,2,2);
Text_SetStyle(tx10,2,2);
}
if T == -1 Then{
var1 = daylow+PriceScale*(N*1);
var2 = daylow+PriceScale*(N*2);
var3 = daylow+PriceScale*(N*3);
var4 = daylow+PriceScale*(N*4);
var5 = daylow+PriceScale*(N*5);
var6 = daylow+PriceScale*(N*6);
var7 = daylow+PriceScale*(N*7);
var8 = daylow+PriceScale*(N*8);
var9 = daylow+PriceScale*(N*9);
plot1(var1,"1",red);
plot2(var2,"2",red);
plot3(var3,"3",red);
plot4(var4,"4",red);
plot5(var5,"5",red);
plot6(var6,"6",red);
plot7(var7,"7",red);
plot8(var8,"8",red);
plot9(var9,"9",red);
Text_Delete(tx1);
Text_Delete(tx2);
Text_Delete(tx3);
Text_Delete(tx4);
Text_Delete(tx5);
Text_Delete(tx6);
Text_Delete(tx7);
Text_Delete(tx8);
Text_Delete(tx9);
tx1 = Text_New(sdate,stime,var1,"+"+NumToStr(N*1,0));
tx2 = Text_New(sdate,stime,var2,"+"+NumToStr(N*2,0));
tx3 = Text_New(sdate,stime,var3,"+"+NumToStr(N*3,0));
tx4 = Text_New(sdate,stime,var4,"+"+NumToStr(N*4,0));
tx5 = Text_New(sdate,stime,var5,"+"+NumToStr(N*5,0));
tx6 = Text_New(sdate,stime,var6,"+"+NumToStr(N*6,0));
tx7 = Text_New(sdate,stime,var7,"+"+NumToStr(N*7,0));
tx8 = Text_New(sdate,stime,var8,"+"+NumToStr(N*8,0));
tx9 = Text_New(sdate,stime,var9,"+"+NumToStr(N*9,0));
if Condition1 == false and Crossup(c,var1) Then{
tx10 = Text_New(sdate,stime,H,"+"+NumToStr(N*1,0));
Condition1 = true;
}
if Condition2 == false and Crossup(c,var2) Then{
tx10 = Text_New(sdate,stime,H,"+"+NumToStr(N*2,0));
Condition1 = true;
}
if Condition3 == false and Crossup(c,var3) Then{
tx10 = Text_New(sdate,stime,H,"+"+NumToStr(N*3,0));
Condition3 = true;
}
if Condition4 == false and Crossup(c,var4) Then{
tx10 = Text_New(sdate,stime,H,"+"+NumToStr(N*4,0));
Condition4 = true;
}
if Condition5 == false and Crossup(c,var5) Then{
tx10 = Text_New(sdate,stime,H,"+"+NumToStr(N*5,0));
Condition5 = true;
}
if Condition6 == false and Crossup(c,var6) Then{
tx10 = Text_New(sdate,stime,H,"+"+NumToStr(N*6,0));
Condition6 = true;
}
if Condition7 == false and Crossup(c,var7) Then{
tx10 = Text_New(sdate,stime,H,"+"+NumToStr(N*7,0));
Condition7 = true;
}
if Condition8 == false and Crossup(c,var8) Then{
tx10 = Text_New(sdate,stime,H,"+"+NumToStr(N*8,0));
Condition8 = true;
}
if Condition9 == false and Crossup(c,var9) Then{
tx10 = Text_New(sdate,stime,H,"+"+NumToStr(N*8,0));
Condition9 = true;
}
Text_SetStyle(tx1,2,2);
Text_SetStyle(tx2,2,2);
Text_SetStyle(tx3,2,2);
Text_SetStyle(tx4,2,2);
Text_SetStyle(tx5,2,2);
Text_SetStyle(tx6,2,2);
Text_SetStyle(tx7,2,2);
Text_SetStyle(tx8,2,2);
Text_SetStyle(tx9,2,2);
Text_SetStyle(tx10,2,2);
}
즐거운 하루되세요
> 타이쿤 님이 쓴 글입니다.
> 제목 : 수식 수정 부탁드립니다
> input : SellPrice1(),SellPrice2(),BuyPrice1(),BuyPrice2();
if CrossDown(c,SellPrice1) Then
sell("s1");
if CrossDown(c,SellPrice2) Then
sell("s2");
if CrossUp(c,BuyPrice1) Then
buy("b1");
if CrossUp(c,BuyPrice2) Then
buy("b2");
<개선 희망 사항>
(1)
SellPrice1()에서 매도 신호 발생후 BuyPrice1()에서 매수 신호 발생하고 상승시
SellPrice1() 에서 다시 매도 신호가 발생합니다
이 경우 SellPrice1()에서는 매도 신호가 발생하지 않고 그보다 높은 SellPrice2()에서만 매도 신호가 발생하게 수식 수정 부탁드립니다
즉 한번 발생한 매도 신호는 다음에 그 가격 터치할 경우 매도 신호를 발생시키지 않는 방식입니다
(2)
BuyPrice1()에서 매수 신호 발생후 SellPrice1()에서 매도 신호 발생하고 하락시
BuyPrice1() 에서 다시 매수 신호가 발생합니다
이 경우 BuyPrice1()에서는 매수 신호가 발생하지 않고 그보다 낮은 BuyPrice2()에서만 매수 신호가 발생하게 수식 수정 부탁드립니다
즉 한번 발생한 매수 신호는 다음에 그 가격 터치할 경우 매수 신호를 발생시키지 않는 방식입니다
---------------
그리고 앞에서 답변해주신 수식을 검색식에서 크루드오일 차트에 적용해보니
오늘자 차트에는 바닥 위로는 숫자와 선이 나타나는데
천정 아래로는 숫자와 선이 출력되지 않습니다
그리고 지나간 어제 차트에는 선이 나타나지 않고 숫자로 -40 만 출력됩니다
확인 부탁드립니다
감사합니다
----------------
안녕하세요
예스스탁입니다.
해당 내용 추세선과 텍스트 함수로 구현해야 합니다.
따로 plot명령어로 출력되는 부분이 없으므로
검색식으로 작성해 차트에 적용하시면 됩니다.
input : N(40);
var : HH(0),LL(0),T(0),HD(0),HT(0),LD(0),LT(0),HL(0),LH(0);
var : Tx1(0),tx2(0),tx3(0),tx4(0),tx5(0),tx6(0),tx7(0),tx8(0),tx9(0);
var : Tx11(0);
var : TL1(0),tl2(0),tl3(0),tl4(0),tl5(0),tl6(0),tl7(0),tl8(0),tl9(0);
if bdate != bdate[1] then{
HH = H;
HD = sdate;
HT = stime;
HL = HH;
LL = L;
LD = sdate;
LT = stime;
T = 0;
LH = H;
}
if H > HH Then{
T = 1;
HH = H;
HD = sdate;
HT = stime;
HL = HH;
}
if L < LL Then{
T = -1;
LL = L;
LD = sdate;
LT = stime;
LH = LL;
}
if T == 1 and T[1] == 1 Then{
if L < HL Then
HL = L;
TL_Delete(TL1);
TL_Delete(TL2);
TL_Delete(TL3);
TL_Delete(TL4);
TL_Delete(TL5);
TL_Delete(TL6);
TL_Delete(TL7);
TL_Delete(TL8);
TL_Delete(TL9);
TL1 = TL_New(HT,HT,dayhigh-PriceScale*(N*1),sdate,stime,dayhigh-PriceScale*(N*1));
TL2 = TL_New(HT,HT,dayhigh-PriceScale*(N*2),sdate,stime,dayhigh-PriceScale*(N*2));
TL3 = TL_New(HT,HT,dayhigh-PriceScale*(N*3),sdate,stime,dayhigh-PriceScale*(N*3));
TL4 = TL_New(HT,HT,dayhigh-PriceScale*(N*4),sdate,stime,dayhigh-PriceScale*(N*4));
TL5 = TL_New(HT,HT,dayhigh-PriceScale*(N*5),sdate,stime,dayhigh-PriceScale*(N*5));
TL6 = TL_New(HT,HT,dayhigh-PriceScale*(N*6),sdate,stime,dayhigh-PriceScale*(N*6));
TL7 = TL_New(HT,HT,dayhigh-PriceScale*(N*7),sdate,stime,dayhigh-PriceScale*(N*7));
TL8 = TL_New(HT,HT,dayhigh-PriceScale*(N*8),sdate,stime,dayhigh-PriceScale*(N*8));
TL9 = TL_New(HT,HT,dayhigh-PriceScale*(N*9),sdate,stime,dayhigh-PriceScale*(N*9));
TL_SetColor(TL1,blue);
TL_SetColor(TL2,blue);
TL_SetColor(TL3,blue);
TL_SetColor(TL4,blue);
TL_SetColor(TL5,blue);
TL_SetColor(TL6,blue);
TL_SetColor(TL7,blue);
TL_SetColor(TL8,blue);
TL_SetColor(TL9,blue);
Text_Delete(tx1);
Text_Delete(tx2);
Text_Delete(tx3);
Text_Delete(tx4);
Text_Delete(tx5);
Text_Delete(tx6);
Text_Delete(tx7);
Text_Delete(tx8);
Text_Delete(tx9);
tx1 = Text_New(sdate,stime,dayhigh-PriceScale*(N*1),"-"+NumToStr(N*1,0));
tx2 = Text_New(sdate,stime,dayhigh-PriceScale*(N*2),"-"+NumToStr(N*2,0));
tx3 = Text_New(sdate,stime,dayhigh-PriceScale*(N*3),"-"+NumToStr(N*3,0));
tx4 = Text_New(sdate,stime,dayhigh-PriceScale*(N*4),"-"+NumToStr(N*4,0));
tx5 = Text_New(sdate,stime,dayhigh-PriceScale*(N*5),"-"+NumToStr(N*5,0));
tx6 = Text_New(sdate,stime,dayhigh-PriceScale*(N*6),"-"+NumToStr(N*6,0));
tx7 = Text_New(sdate,stime,dayhigh-PriceScale*(N*7),"-"+NumToStr(N*7,0));
tx8 = Text_New(sdate,stime,dayhigh-PriceScale*(N*8),"-"+NumToStr(N*8,0));
tx9 = Text_New(sdate,stime,dayhigh-PriceScale*(N*9),"-"+NumToStr(N*9,0));
if HL <= dayhigh-PriceScale*(N*1) and HL[1] > dayhigh-PriceScale*(N*1) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*1,0));
if HL <= dayhigh-PriceScale*(N*2) and HL[1] > dayhigh-PriceScale*(N*2) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*2,0));
if HL <= dayhigh-PriceScale*(N*3) and HL[1] > dayhigh-PriceScale*(N*3) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*3,0));
if HL <= dayhigh-PriceScale*(N*4) and HL[1] > dayhigh-PriceScale*(N*4) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*4,0));
if HL <= dayhigh-PriceScale*(N*5) and HL[1] > dayhigh-PriceScale*(N*5) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*5,0));
if HL <= dayhigh-PriceScale*(N*6) and HL[1] > dayhigh-PriceScale*(N*6) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*6,0));
if HL <= dayhigh-PriceScale*(N*7) and HL[1] > dayhigh-PriceScale*(N*7) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*7,0));
if HL <= dayhigh-PriceScale*(N*8) and HL[1] > dayhigh-PriceScale*(N*8) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*8,0));
if HL <= dayhigh-PriceScale*(N*9) and HL[1] > dayhigh-PriceScale*(N*9) Then
Tx11 = Text_New(sdate,stime,L,"-"+NumToStr(N*9,0));
Text_SetStyle(tx11,2,2);
}
if T == -1 and T[1] == -1 Then{
if H > LH Then
LH = H;
TL_Delete(TL1);
TL_Delete(TL2);
TL_Delete(TL3);
TL_Delete(TL4);
TL_Delete(TL5);
TL_Delete(TL6);
TL_Delete(TL7);
TL_Delete(TL8);
TL_Delete(TL9);
TL1 = TL_New(LD,LT,daylow+PriceScale*(N*1),sdate,stime,daylow+PriceScale*(N*1));
TL2 = TL_New(LD,LT,daylow+PriceScale*(N*2),sdate,stime,daylow+PriceScale*(N*2));
TL3 = TL_New(LD,LT,daylow+PriceScale*(N*3),sdate,stime,daylow+PriceScale*(N*3));
TL4 = TL_New(LD,LT,daylow+PriceScale*(N*4),sdate,stime,daylow+PriceScale*(N*4));
TL5 = TL_New(LD,LT,daylow+PriceScale*(N*5),sdate,stime,daylow+PriceScale*(N*5));
TL6 = TL_New(LD,LT,daylow+PriceScale*(N*6),sdate,stime,daylow+PriceScale*(N*6));
TL7 = TL_New(LD,LT,daylow+PriceScale*(N*7),sdate,stime,daylow+PriceScale*(N*7));
TL8 = TL_New(LD,LT,daylow+PriceScale*(N*8),sdate,stime,daylow+PriceScale*(N*8));
TL9 = TL_New(LD,LT,daylow+PriceScale*(N*9),sdate,stime,daylow+PriceScale*(N*9));
TL_SetColor(TL1,red);
TL_SetColor(TL2,red);
TL_SetColor(TL3,red);
TL_SetColor(TL4,red);
TL_SetColor(TL5,red);
TL_SetColor(TL6,red);
TL_SetColor(TL7,red);
TL_SetColor(TL8,red);
TL_SetColor(TL9,red);
Text_Delete(tx1);
Text_Delete(tx2);
Text_Delete(tx3);
Text_Delete(tx4);
Text_Delete(tx5);
Text_Delete(tx6);
Text_Delete(tx7);
Text_Delete(tx8);
Text_Delete(tx9);
tx1 = Text_New(sdate,stime,daylow+PriceScale*(N*1),"+"+NumToStr(N*1,0));
tx2 = Text_New(sdate,stime,daylow+PriceScale*(N*2),"+"+NumToStr(N*2,0));
tx3 = Text_New(sdate,stime,daylow+PriceScale*(N*3),"+"+NumToStr(N*3,0));
tx4 = Text_New(sdate,stime,daylow+PriceScale*(N*4),"+"+NumToStr(N*4,0));
tx5 = Text_New(sdate,stime,daylow+PriceScale*(N*5),"+"+NumToStr(N*5,0));
tx6 = Text_New(sdate,stime,daylow+PriceScale*(N*6),"+"+NumToStr(N*6,0));
tx7 = Text_New(sdate,stime,daylow+PriceScale*(N*7),"+"+NumToStr(N*7,0));
tx8 = Text_New(sdate,stime,daylow+PriceScale*(N*8),"+"+NumToStr(N*8,0));
tx9 = Text_New(sdate,stime,daylow+PriceScale*(N*9),"+"+NumToStr(N*9,0));
if LH >= daylow+PriceScale*(N*1) and LH[1] < daylow+PriceScale*(N*1) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*1,0));
if LH >= daylow+PriceScale*(N*2) and LH[1] < daylow+PriceScale*(N*2) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*2,0));
if LH >= daylow+PriceScale*(N*3) and LH[1] < daylow+PriceScale*(N*3) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*3,0));
if LH >= daylow+PriceScale*(N*4) and LH[1] < daylow+PriceScale*(N*4) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*4,0));
if LH >= daylow+PriceScale*(N*5) and LH[1] < daylow+PriceScale*(N*5) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*5,0));
if LH >= daylow+PriceScale*(N*6) and LH[1] < daylow+PriceScale*(N*6) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*6,0));
if LH >= daylow+PriceScale*(N*7) and LH[1] < daylow+PriceScale*(N*7) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*7,0));
if LH >= daylow+PriceScale*(N*8) and LH[1] < daylow+PriceScale*(N*8) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*8,0));
if LH >= daylow+PriceScale*(N*9) and LH[1] < daylow+PriceScale*(N*9) Then
Tx11 = Text_New(sdate,stime,H,"+"+NumToStr(N*9,0));
Text_SetStyle(tx11,2,2);
}
즐거운 하루되세요
> 타이쿤 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다
> (1)당일 저가에서 상승시 40틱 단위로 적색선 그리기
...선 우측에 +40,+80,+120,+160,+200,+240,+280,+320+360 글 쓰기
...해당 캔들 위에 +40,+80,+120+160,+200,+240,+280,+320,+360 글 쓰기
(2)당일 고가에서 하락시 40틱 단위로 청색선 그리기
...선 우측에 -40,-80,-120,-160,-200,-240,-280,-320-360 글 쓰기
...해당 캔들 아래에 -40,-80,-120-160,-200,-240,-280,-320,360 글 쓰기
감사합니다
다음글