커뮤니티
지표식 수정
2013-08-18 08:17:13
203
글번호 66544
감사드립니다
아래 손절식을 구현해보니 손절후 같은방향으로 재진입합니다
손절폭도 9틱,11틱으로 15틱설정값이 나오질않네요(첨부1)
5-1.
Condition1 = ExitDate(1) == true and IsExitName("bx") and MarketPosition(1) == 1;
Condition2 = ExitDate(1) == true and IsExitName("sx") and MarketPosition(1) == -1;
if (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False)) and
매수조건 Then
buy();
if (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False)) and
매도조건 Then
sell();
if MarketPosition == 1 Then{
if (highest(H,BarsSinceEntry) <= EntryPrice+PriceScale*10) Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-PriceScale*15);
}
if MarketPosition == -1 Then{
if ( Lowest(L,BarsSinceEntry) >= EntryPrice-PriceScale*10) Then
ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+PriceScale* 15);
}
5-2 위 5-1손절식을 수정했다면
아래조건으로 시스템을 수정해주시기 바랍니다
1). 매수신호(B1)/매도신호(S1) 이후 손절 30틱발생시 같은방향으로 진입금지
(위식은 시스템에 적용해보니 정상적으로 나옵니다)
2) 위 1)번조건에서 5-1)식을 합성해서 사용하고저 합니다
1)번식이 구동되는 상태에서
5-1)번식인 10틱이내의 이익발생시 15틱손절발생시 같은방향진입금지...
1)번식
Condition1 = ExitDate(1) == sdate and IsExitName("StopLoss",1) == true and
MarketPosition(1) == 1;
Condition2 = ExitDate(1) == sdate and IsExitName("StopLoss",1) == true and
MarketPosition(1) == -1;
if (c>o and var10 == 1 and var20==1 and var11 == 1 and var12== 1 and var3>10) and
((MarketPosition == 0 and Condition1 == false) or MarketPosition == -1) Then
buy("B1");
if (c<o and var10 == -1 and var20==-1 and var11 == -1 and var12== -1 and
var3<90) and
((MarketPosition == 0 and Condition2 == false) or MarketPosition == 1) Then
sell("S1") ;
5-1)식(수정필요)
Condition1 = ExitDate(1) == true and IsExitName("bx") and MarketPosition(1) == 1;
Condition2 = ExitDate(1) == true and IsExitName("sx") and MarketPosition(1) == -1;
if (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False)) and
(c>o and var10 == 1 and var20==1 and var11 == 1 and var12== 1 and var3>10) Then
buy("B2");
if (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False)) and
(c<o and var10 == -1 and var20==-1 and var11 == -1 and var12== -1 and var3<90) Then
sell("S2");
if MarketPosition == 1 Then{
if (highest(H,BarsSinceEntry) <= EntryPrice+PriceScale*10) Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-PriceScale*15);
}
if MarketPosition == -1 Then{
if ( Lowest(L,BarsSinceEntry) >= EntryPrice-PriceScale*10) Then
ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+PriceScale* 15);
}
6-1.아래 지표식을 표현해보니 한가지만 표현됩니다
상승방향과 하락방향을 따로 같은챠트에 표현하고자 합니다.
그래프가 상승방향은 0선위로 가고 하락방향은 0선아래로 향합니다
var : HH(0),LL(0);
value1 = macd(5,20)*100;
if date != date[1] Then{
HH = value1;
LL = value1;
}
if HH > value1 Then
value1 = HH;
if LL < value1 Then
value1 = LL;
plot1(HH,"상승방향",red,def,2);
plot2(LL,"하락방향",BLUE,def,2);
6-2 아래지표식도 한가지만 표현되고 위의지표식이 바뀌면 달라질듯 합니다
var : HH(0),LL(0);
value1 = macd(5,20)*100;
if date != date[1] Then{
HH = value1;
LL = value1;
}
if HH > value1 Then
value1 = HH;
if LL < value1 Then
value1 = LL;
if HH > HH[1] Then
var1 = 1;
Else
var1 = 0;
if LL < LL[1] Then
var2 = 1;
Else
var2 = 0;
plot1(var1,"상승방향",red,def,2);
plot2(var2,"하락방향",BLUE,def,2);
7.시스템에서의 시간의미
아침 09시 05분 01초 부터 시스템을 가동할려고 하면
090500 또는 090400 어느것을 적용해야하나요
그리고 시스템에 매매설정란 강제청산 14:30 발생시간과
시스템식에서의 14:30청산식과의 차이가 나는데요
왜 차이가 나는지 궁금합니다.
- 1. 첨부1.png (0.13 MB)
답변 1
예스스탁 예스스탁 답변
2013-08-19 11:17:29
안녕하세요
예스스탁입니다.
1.
랭귀지에 청산과 관련된 함수는 포지션의 지칭이 최소 1입니다.
IsExitName("bx") - > IsExitName("bx",1)
2
수정한 식입니다.
Condition1 = ExitDate(1) == true and MarketPosition(1) == 1 and
(IsExitName("bx",1) == true or IsExitName("StopLoss",1) == true);
Condition2 = ExitDate(1) == true and MarketPosition(1) == -1 and
(IsExitName("sx",1) == true or IsExitName("StopLoss",1) == true);
if (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False)) and
매수조건 Then
buy();
if (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False)) and
매도조건 Then
sell();
if MarketPosition == 1 Then{
if (highest(H,BarsSinceEntry) <= EntryPrice+PriceScale*10) Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-PriceScale*15);
}
if MarketPosition == -1 Then{
if ( Lowest(L,BarsSinceEntry) >= EntryPrice-PriceScale*10) Then
ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+PriceScale* 15);
}
SetStopLoss(PriceScale*30,PointStop);
2.
var : HH(0),LL(0);
value1 = macd(5,20)*100;
if sdate != sdate[1] Then{
HH = value1;
LL = value1;
}
if value1 > HH Then
HH = value1;
if value1 < LL Then
LL = value1;
plot1(HH,"상승방향",red,def,2);
plot2(LL,"하락방향",BLUE,def,2);
plot3(value1);
3.
stime >= 090500
으로 설정하시면 됩니다.
stime >= 090500으로 하시면 시가시간이 9시 5분 이후인 봉부터 신호가 발생합니다.
4.
설정창의 당일청산과 SetStopEndofday는 같은 기능입니다.
수식에서 SetStopEndofday를 사용하면 설정창에서 설정할수 없고
수식에 SetStopEndofday이 없으면 설정창의 강제청산이 적용됩니다.
모두 지정한 시간이후의 첫틱이 들어오면 당일청산이 됩니다.
2개의 기능은 다른부분이 없습니다.
if문으로 if stime == 143000으로 시간을 지정하시면 봉의 시가시간이
14시 30분인 봉이 완성이 되면 청산이 됩니다.
즐거운 하루되세요
> 한산도 님이 쓴 글입니다.
> 제목 : 지표식 수정
> 감사드립니다
아래 손절식을 구현해보니 손절후 같은방향으로 재진입합니다
손절폭도 9틱,11틱으로 15틱설정값이 나오질않네요(첨부1)
5-1.
Condition1 = ExitDate(1) == true and IsExitName("bx") and MarketPosition(1) == 1;
Condition2 = ExitDate(1) == true and IsExitName("sx") and MarketPosition(1) == -1;
if (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False)) and
매수조건 Then
buy();
if (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False)) and
매도조건 Then
sell();
if MarketPosition == 1 Then{
if (highest(H,BarsSinceEntry) <= EntryPrice+PriceScale*10) Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-PriceScale*15);
}
if MarketPosition == -1 Then{
if ( Lowest(L,BarsSinceEntry) >= EntryPrice-PriceScale*10) Then
ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+PriceScale* 15);
}
5-2 위 5-1손절식을 수정했다면
아래조건으로 시스템을 수정해주시기 바랍니다
1). 매수신호(B1)/매도신호(S1) 이후 손절 30틱발생시 같은방향으로 진입금지
(위식은 시스템에 적용해보니 정상적으로 나옵니다)
2) 위 1)번조건에서 5-1)식을 합성해서 사용하고저 합니다
1)번식이 구동되는 상태에서
5-1)번식인 10틱이내의 이익발생시 15틱손절발생시 같은방향진입금지...
1)번식
Condition1 = ExitDate(1) == sdate and IsExitName("StopLoss",1) == true and
MarketPosition(1) == 1;
Condition2 = ExitDate(1) == sdate and IsExitName("StopLoss",1) == true and
MarketPosition(1) == -1;
if (c>o and var10 == 1 and var20==1 and var11 == 1 and var12== 1 and var3>10) and
((MarketPosition == 0 and Condition1 == false) or MarketPosition == -1) Then
buy("B1");
if (c<o and var10 == -1 and var20==-1 and var11 == -1 and var12== -1 and
var3<90) and
((MarketPosition == 0 and Condition2 == false) or MarketPosition == 1) Then
sell("S1") ;
5-1)식(수정필요)
Condition1 = ExitDate(1) == true and IsExitName("bx") and MarketPosition(1) == 1;
Condition2 = ExitDate(1) == true and IsExitName("sx") and MarketPosition(1) == -1;
if (MarketPosition == -1 or (MarketPosition == 0 and Condition1 == False)) and
(c>o and var10 == 1 and var20==1 and var11 == 1 and var12== 1 and var3>10) Then
buy("B2");
if (MarketPosition == 1 or (MarketPosition == 0 and Condition2 == False)) and
(c<o and var10 == -1 and var20==-1 and var11 == -1 and var12== -1 and var3<90) Then
sell("S2");
if MarketPosition == 1 Then{
if (highest(H,BarsSinceEntry) <= EntryPrice+PriceScale*10) Then
ExitLong("bx",AtStop,highest(H,BarsSinceEntry)-PriceScale*15);
}
if MarketPosition == -1 Then{
if ( Lowest(L,BarsSinceEntry) >= EntryPrice-PriceScale*10) Then
ExitShort("sx",AtStop,Lowest(L,BarsSinceEntry)+PriceScale* 15);
}
6-1.아래 지표식을 표현해보니 한가지만 표현됩니다
상승방향과 하락방향을 따로 같은챠트에 표현하고자 합니다.
그래프가 상승방향은 0선위로 가고 하락방향은 0선아래로 향합니다
var : HH(0),LL(0);
value1 = macd(5,20)*100;
if date != date[1] Then{
HH = value1;
LL = value1;
}
if HH > value1 Then
value1 = HH;
if LL < value1 Then
value1 = LL;
plot1(HH,"상승방향",red,def,2);
plot2(LL,"하락방향",BLUE,def,2);
6-2 아래지표식도 한가지만 표현되고 위의지표식이 바뀌면 달라질듯 합니다
var : HH(0),LL(0);
value1 = macd(5,20)*100;
if date != date[1] Then{
HH = value1;
LL = value1;
}
if HH > value1 Then
value1 = HH;
if LL < value1 Then
value1 = LL;
if HH > HH[1] Then
var1 = 1;
Else
var1 = 0;
if LL < LL[1] Then
var2 = 1;
Else
var2 = 0;
plot1(var1,"상승방향",red,def,2);
plot2(var2,"하락방향",BLUE,def,2);
7.시스템에서의 시간의미
아침 09시 05분 01초 부터 시스템을 가동할려고 하면
090500 또는 090400 어느것을 적용해야하나요
그리고 시스템에 매매설정란 강제청산 14:30 발생시간과
시스템식에서의 14:30청산식과의 차이가 나는데요
왜 차이가 나는지 궁금합니다.
이전글