커뮤니티
재문의 드립니다.
2012-05-02 16:27:34
461
글번호 50717
빠른 답변 감사합니다 ^^
그런데 제가 다시 해봤지만 정상적으로 동작이 안됩니다.
첨부파일로 드린 이미지에 보시면 매수 진입 후 10틱 이상 상승한 후
고점에서 10틱 이하로 내려왔는데도, 스탑트레일링이 걸리지 않습니다.
결국 종가에 청산하게 되구요.
저도 개별적으로 퇴출전략을 하나씩 해보았지만, 유독 스탑트레일링만 안되네요..
그림처럼 결과가 나온 수식 올립니다.
Input : Period1(100), Losscut(15), StopCut(120), st11(10), st12(10), st21(10), st22(10), stoptime(150000);
value1 = ma(O, Period1);
If sTime == 151500 and Open < Value1 Then
buy("매수", AtMarket);
If sTime == 151500 and Open > Value1 Then
Sell("매도", AtMarket);
If MarketPosition == 1 Then {
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st21) Then
exitlong("Bstop2step",AtStop,highest(H,BarsSinceEntry)-st22);
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st11) Then
exitlong("Bstop1step",AtStop,highest(H,BarsSinceEntry)-st12);
# ExitLong("BLoss", AtStop, EntryPrice-(PriceScale*Losscut));
#Exitlong("BProfit", AtLimit, EntryPrice+(PriceScale*StopCut));
}
If MarketPosition == -1 Then {
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st21) Then
ExitShort("Sstop2step",AtStop,Lowest(L,BarsSinceEntry)+st22);
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st11) Then
ExitShort("Sstop1step",AtStop,Lowest(L,BarsSinceEntry)+st12);
# ExitShort("SstopLoss", AtStop, EntryPrice+(PriceScale*Losscut));
#ExitShort("SProfit", AtLimit, EntryPrice-(PriceScale*StopCut));
}
SetStopEndofday(stoptime-000001);
확인해 주시고 문제가 무엇인지 알려주세요.
더운날 시원한 하루 되시길 바랍니다.
==============================================================================
안녕하세요
예스스탁입니다.
작성하신 모든 청산신호 정상적으로 발생하고 있습니다.
적용시 발생하지 않는 청산은 그전에 다른 청산이 발생하기 때문입니다.
각 청산을 개별적으로 적용해 보시면 모두 신호발생합니다.
Input : Period1(100), Losscut(15), StopCut(120), st11(10), st12(10), st21(10), st22(10), stoptime(150000);
value1 = ma(O, Period1);
If sTime == 151500 and Open < Value1 Then
buy("매수", AtMarket);
If sTime == 151500 and Open > Value1 Then
Sell("매도", AtMarket);
If MarketPosition == 1 Then {
ExitLong("BLoss", AtStop, EntryPrice-(PriceScale*Losscut));
Exitlong("BProfit", AtLimit, EntryPrice+(PriceScale*StopCut));
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st21) Then
exitlong("Bstop2step",AtStop,highest(H,BarsSinceEntry)-st22);
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st11) Then
exitlong("Bstop1step",AtStop,highest(H,BarsSinceEntry)-st12);
}
If MarketPosition == -1 Then {
ExitShort("SstopLoss", AtStop, EntryPrice+(PriceScale*Losscut));
ExitShort("SProfit", AtLimit, EntryPrice-(PriceScale*StopCut));
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st21) Then
ExitShort("Sstop2step",AtStop,Lowest(L,BarsSinceEntry)+st22);
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st11) Then
ExitShort("Sstop1step",AtStop,Lowest(L,BarsSinceEntry)+st12);
}
SetStopEndofday(stoptime-000001);
당일청산이 var3-000001으로 되어 있고 수식내에 var3에
할당한 값이 없어 stoptime-000001로 변경했습니다.
또한 신호는 모두 정규장안에 발생하게 작성하셔야 합니다.
정규장내 시간으로 설정하시기 바랍니다.
즐거운 하루되세요
- 1. K-20120502_16.jpg (0.13 MB)
- 2. K-20120502_17.jpg (0.44 MB)
답변 1
예스스탁 예스스탁 답변
2012-05-02 17:15:46
안녕하세요
예스스탁입니다.
식을 수정했습니다.
수익은 틱으로 설정하고 수익하락은 포인트로 설정하시는 것으로 착각했습니다.
Input : Period1(100), Losscut(15), StopCut(120), st11(10), st12(10), st21(10), st22(10), stoptime(150000);
value1 = ma(O, Period1);
If sTime == 151500 and Open < Value1 Then
buy("매수", AtMarket);
If sTime == 151500 and Open > Value1 Then
Sell("매도", AtMarket);
If MarketPosition == 1 Then {
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st21) Then
exitlong("Bstop2step",AtStop,highest(H,BarsSinceEntry)-(PriceScale*st22));
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st11) Then
exitlong("Bstop1step",AtStop,highest(H,BarsSinceEntry)-(PriceScale*st12));
# ExitLong("BLoss", AtStop, EntryPrice-(PriceScale*Losscut));
#Exitlong("BProfit", AtLimit, EntryPrice+(PriceScale*StopCut));
}
If MarketPosition == -1 Then {
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st21) Then
ExitShort("Sstop2step",AtStop,Lowest(L,BarsSinceEntry)+(PriceScale*st22));
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st11) Then
ExitShort("Sstop1step",AtStop,Lowest(L,BarsSinceEntry)+(PriceScale*st12));
# ExitShort("SstopLoss", AtStop, EntryPrice+(PriceScale*Losscut));
#ExitShort("SProfit", AtLimit, EntryPrice-(PriceScale*StopCut));
}
SetStopEndofday(stoptime-000001);
즐거운 하루되세요
> 해탈인생 님이 쓴 글입니다.
> 제목 : 재문의 드립니다.
> 빠른 답변 감사합니다 ^^
그런데 제가 다시 해봤지만 정상적으로 동작이 안됩니다.
첨부파일로 드린 이미지에 보시면 매수 진입 후 10틱 이상 상승한 후
고점에서 10틱 이하로 내려왔는데도, 스탑트레일링이 걸리지 않습니다.
결국 종가에 청산하게 되구요.
저도 개별적으로 퇴출전략을 하나씩 해보았지만, 유독 스탑트레일링만 안되네요..
그림처럼 결과가 나온 수식 올립니다.
Input : Period1(100), Losscut(15), StopCut(120), st11(10), st12(10), st21(10), st22(10), stoptime(150000);
value1 = ma(O, Period1);
If sTime == 151500 and Open < Value1 Then
buy("매수", AtMarket);
If sTime == 151500 and Open > Value1 Then
Sell("매도", AtMarket);
If MarketPosition == 1 Then {
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st21) Then
exitlong("Bstop2step",AtStop,highest(H,BarsSinceEntry)-st22);
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st11) Then
exitlong("Bstop1step",AtStop,highest(H,BarsSinceEntry)-st12);
# ExitLong("BLoss", AtStop, EntryPrice-(PriceScale*Losscut));
#Exitlong("BProfit", AtLimit, EntryPrice+(PriceScale*StopCut));
}
If MarketPosition == -1 Then {
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st21) Then
ExitShort("Sstop2step",AtStop,Lowest(L,BarsSinceEntry)+st22);
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st11) Then
ExitShort("Sstop1step",AtStop,Lowest(L,BarsSinceEntry)+st12);
# ExitShort("SstopLoss", AtStop, EntryPrice+(PriceScale*Losscut));
#ExitShort("SProfit", AtLimit, EntryPrice-(PriceScale*StopCut));
}
SetStopEndofday(stoptime-000001);
확인해 주시고 문제가 무엇인지 알려주세요.
더운날 시원한 하루 되시길 바랍니다.
==============================================================================
안녕하세요
예스스탁입니다.
작성하신 모든 청산신호 정상적으로 발생하고 있습니다.
적용시 발생하지 않는 청산은 그전에 다른 청산이 발생하기 때문입니다.
각 청산을 개별적으로 적용해 보시면 모두 신호발생합니다.
Input : Period1(100), Losscut(15), StopCut(120), st11(10), st12(10), st21(10), st22(10), stoptime(150000);
value1 = ma(O, Period1);
If sTime == 151500 and Open < Value1 Then
buy("매수", AtMarket);
If sTime == 151500 and Open > Value1 Then
Sell("매도", AtMarket);
If MarketPosition == 1 Then {
ExitLong("BLoss", AtStop, EntryPrice-(PriceScale*Losscut));
Exitlong("BProfit", AtLimit, EntryPrice+(PriceScale*StopCut));
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st21) Then
exitlong("Bstop2step",AtStop,highest(H,BarsSinceEntry)-st22);
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st11) Then
exitlong("Bstop1step",AtStop,highest(H,BarsSinceEntry)-st12);
}
If MarketPosition == -1 Then {
ExitShort("SstopLoss", AtStop, EntryPrice+(PriceScale*Losscut));
ExitShort("SProfit", AtLimit, EntryPrice-(PriceScale*StopCut));
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st21) Then
ExitShort("Sstop2step",AtStop,Lowest(L,BarsSinceEntry)+st22);
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st11) Then
ExitShort("Sstop1step",AtStop,Lowest(L,BarsSinceEntry)+st12);
}
SetStopEndofday(stoptime-000001);
당일청산이 var3-000001으로 되어 있고 수식내에 var3에
할당한 값이 없어 stoptime-000001로 변경했습니다.
또한 신호는 모두 정규장안에 발생하게 작성하셔야 합니다.
정규장내 시간으로 설정하시기 바랍니다.
즐거운 하루되세요
다음글
이전글