커뮤니티

수정좀 부탁합니다.

프로필 이미지
천왕봉
2017-02-22 23:45:37
138
글번호 107154
답변완료

첨부 이미지

청산후에는 청산 전에 발생한 신호와 같은 방향으로는 진입 금지 하는 청산 식을 삽입하고자 본 게시판을 검색하여 아래와 같이 청산수식을 삽입하였습니다. 그런데 청산 전에 발생한 신호와 같은 방향으로 진입하는 경우가 자주 있습니다. (첨부 이미지 참고) 어디가 문제인지 수정좀 부탁합니다. input : Period(3), Period1(1), Period2(2); var : T(0); value3 = StochasticsK(Period, Period1); value4 = StochasticsD(Period, Period1, Period2); value5 = (highest(H,1)+lowest(L,1))/2; value8 = (highest(H,32)+lowest(L,32))/2; if T <= 0 and CrossUp(value3, value4) Then{ T = 1; value1 = C; } if T >= 0 and CrossDown(value3, value4) Then{ T = -1; value1 = C; } Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true ; Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true ; if Condition1 == false and (Close >= (value1 + (PriceScale * 5))) Then Buy("매수", OnClose); if Condition2 == false and (Close <= (value1 - (PriceScale *5))) Then Sell("매도", OnClose); SetStopLoss(1.25,PointStop); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*11 and value5 - value8 < PriceScale*-1 Then ExitLong("매수청산"); if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*11 and value8 - value5 < PriceScale*-1 Then ExitShort("매도청산"); if MarketPosition == 1 Then{ var1 = Floor((highest(H,BarsSinceEntry)-EntryPrice)/(PriceScale*3)); if var1 > var1[1] Then Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱"); } if MarketPosition == -1 Then{ var1 = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/(PriceScale*3)); if var1 > var1[1] Then Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱"); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-02-23 13:10:21

안녕하세요 예스스탁입니다. 기존식이 손절매로 끝날때만 제어되게 되어 있습니다. 모든 청산후에 동일 방향을 진입하지 않게 수정했습니다. input : Period(3), Period1(1), Period2(2); var : T(0); value3 = StochasticsK(Period, Period1); value4 = StochasticsD(Period, Period1, Period2); value5 = (highest(H,1)+lowest(L,1))/2; value8 = (highest(H,32)+lowest(L,32))/2; if T <= 0 and CrossUp(value3, value4) Then{ T = 1; value1 = C; } if T >= 0 and CrossDown(value3, value4) Then{ T = -1; value1 = C; } Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 ; Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 ; if MarketPosition <= 0 and Condition1 == false and (Close >= (value1 + (PriceScale * 5))) Then Buy("매수", OnClose); if MarketPosition >= 0 and Condition2 == false and (Close <= (value1 - (PriceScale *5))) Then Sell("매도", OnClose); SetStopLoss(1.25,PointStop); if MarketPosition == 1 and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*11 and value5 - value8 < PriceScale*-1 Then ExitLong("매수청산"); if MarketPosition == -1 and lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*11 and value8 - value5 < PriceScale*-1 Then ExitShort("매도청산"); if MarketPosition == 1 Then{ var1 = Floor((highest(H,BarsSinceEntry)-EntryPrice)/(PriceScale*3)); if var1 > var1[1] Then Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱"); } if MarketPosition == -1 Then{ var1 = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/(PriceScale*3)); if var1 > var1[1] Then Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱"); } 즐거운 하루되세요 > 천왕봉 님이 쓴 글입니다. > 제목 : 수정좀 부탁합니다. > 청산후에는 청산 전에 발생한 신호와 같은 방향으로는 진입 금지 하는 청산 식을 삽입하고자 본 게시판을 검색하여 아래와 같이 청산수식을 삽입하였습니다. 그런데 청산 전에 발생한 신호와 같은 방향으로 진입하는 경우가 자주 있습니다. (첨부 이미지 참고) 어디가 문제인지 수정좀 부탁합니다. input : Period(3), Period1(1), Period2(2); var : T(0); value3 = StochasticsK(Period, Period1); value4 = StochasticsD(Period, Period1, Period2); value5 = (highest(H,1)+lowest(L,1))/2; value8 = (highest(H,32)+lowest(L,32))/2; if T <= 0 and CrossUp(value3, value4) Then{ T = 1; value1 = C; } if T >= 0 and CrossDown(value3, value4) Then{ T = -1; value1 = C; } Condition1 = MarketPosition == 0 and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true ; Condition2 = MarketPosition == 0 and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true ; if Condition1 == false and (Close >= (value1 + (PriceScale * 5))) Then Buy("매수", OnClose); if Condition2 == false and (Close <= (value1 - (PriceScale *5))) Then Sell("매도", OnClose); SetStopLoss(1.25,PointStop); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*11 and value5 - value8 < PriceScale*-1 Then ExitLong("매수청산"); if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*11 and value8 - value5 < PriceScale*-1 Then ExitShort("매도청산"); if MarketPosition == 1 Then{ var1 = Floor((highest(H,BarsSinceEntry)-EntryPrice)/(PriceScale*3)); if var1 > var1[1] Then Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱"); } if MarketPosition == -1 Then{ var1 = Floor((EntryPrice-Lowest(L,BarsSinceEntry))/(PriceScale*3)); if var1 > var1[1] Then Text_New(sdate,stime,H,NumToStr(var1*3,0)+"틱"); }