커뮤니티
퇴출전략이 실행이 안됩니다.
2012-05-02 00:50:33
422
글번호 50680
안녕하세요.
수식이 맞는것 같은데, 실제로 시뮬레이션 하면 퇴출전략이 작동이 안되네요.
문제가 무엇인지 확인, 수정 부탁드립니다.
==============================================================================
Input : Period1(100), Losscut(15), StopCut(120), st11(10), st12(10), st21(10), st22(10), stoptime(150500);
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("stopLoss", AtStop, EntryPrice-(PriceScale*Losscut));
Exitlong("Profit", AtLimit, EntryPrice+(PriceScale*StopCut));
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st21) Then
exitlong("stop2step",AtStop,highest(H,BarsSinceEntry)-st22);
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st11) Then
exitlong("stop1step",AtStop,highest(H,BarsSinceEntry)-st12);
}
If MarketPosition == -1 Then {
ExitShort("stopLoss", AtStop, EntryPrice+(PriceScale*Losscut));
ExitShort("Profit", AtLimit, EntryPrice-(PriceScale*StopCut));
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st21) Then
ExitShort("stop2step",AtStop,Lowest(L,BarsSinceEntry)+st22);
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st11) Then
ExitShort("stop1step",AtStop,Lowest(L,BarsSinceEntry)+st12);
}
SetStopEndofday(Var3-000001);
==============================================================================
궁굼한 것이 있는데요,
퇴출전략도 봉이 완성되어야 실제로 체결이 이루어지나요?
조건에 만족하면(예, 저의 시스템 스탑트레일링 전략처럼 10틱 이상 상승 후 10틱 내려오면 청산) 바로 청산이 이루어지는지, 아니면 조건이 만족한 봉이 완성된 후 주문이 나가는지 궁굼합니다. IF 문은 봉 완성이 되어야 주문이 발생된다는 말을 들었습니다.
답변 1
예스스탁 예스스탁 답변
2012-05-02 14:42:18
안녕하세요
예스스탁입니다.
작성하신 모든 청산신호 정상적으로 발생하고 있습니다.
적용시 발생하지 않는 청산은 그전에 다른 청산이 발생하기 때문입니다.
각 청산을 개별적으로 적용해 보시면 모두 신호발생합니다.
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로 변경했습니다.
또한 신호는 모두 정규장안에 발생하게 작성하셔야 합니다.
정규장내 시간으로 설정하시기 바랍니다.
즐거운 하루되세요
> 해탈인생 님이 쓴 글입니다.
> 제목 : 퇴출전략이 실행이 안됩니다.
> 안녕하세요.
수식이 맞는것 같은데, 실제로 시뮬레이션 하면 퇴출전략이 작동이 안되네요.
문제가 무엇인지 확인, 수정 부탁드립니다.
==============================================================================
Input : Period1(100), Losscut(15), StopCut(120), st11(10), st12(10), st21(10), st22(10), stoptime(150500);
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("stopLoss", AtStop, EntryPrice-(PriceScale*Losscut));
Exitlong("Profit", AtLimit, EntryPrice+(PriceScale*StopCut));
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st21) Then
exitlong("stop2step",AtStop,highest(H,BarsSinceEntry)-st22);
if highest(H,BarsSinceEntry) >= EntryPrice+(PriceScale*st11) Then
exitlong("stop1step",AtStop,highest(H,BarsSinceEntry)-st12);
}
If MarketPosition == -1 Then {
ExitShort("stopLoss", AtStop, EntryPrice+(PriceScale*Losscut));
ExitShort("Profit", AtLimit, EntryPrice-(PriceScale*StopCut));
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st21) Then
ExitShort("stop2step",AtStop,Lowest(L,BarsSinceEntry)+st22);
If Lowest(L,BarsSinceEntry) <= EntryPrice-(PriceScale*st11) Then
ExitShort("stop1step",AtStop,Lowest(L,BarsSinceEntry)+st12);
}
SetStopEndofday(Var3-000001);
==============================================================================
궁굼한 것이 있는데요,
퇴출전략도 봉이 완성되어야 실제로 체결이 이루어지나요?
조건에 만족하면(예, 저의 시스템 스탑트레일링 전략처럼 10틱 이상 상승 후 10틱 내려오면 청산) 바로 청산이 이루어지는지, 아니면 조건이 만족한 봉이 완성된 후 주문이 나가는지 궁굼합니다. IF 문은 봉 완성이 되어야 주문이 발생된다는 말을 들었습니다.