커뮤니티

청산 후 재진입2(속도 단축 수식)

프로필 이미지
목마와숙녀
2021-12-16 11:36:47
393
글번호 154317
답변완료
답변 수식 고맙습니다. 그런데... 아래 수식을 사용하면 수식 추가 이전보다 시뮬레이션 속도가 현저히 느려지는데요. 이유가 있을까요? 피시 메모리는 동일한 조건에서 비교했습니다. 속도를 고려한 다른 수식은 없겠는지요? *************************************************************************** SetStopLoss(loss,PercentStop); SetStopTrailing(trail,0,PercentStop,1); SetStopInactivity(최소가격,봉갯수,PercentStop); if MarketPosition == 0 and IsExitName("StopLoss",1) == true and ExitDate(1) == sDate and CountIf(daylow(0) < DayLow(0)[1],BarsSinceExit(1)) == 3 Then Sell(); if MarketPosition == 0 and IsExitName("StopTrailing",1) == true and ExitDate(1) == sDate and CountIf(daylow(0) < DayLow(0)[1],BarsSinceExit(1)) == 2 Then Sell(); if MarketPosition == 0 and IsExitName("StopInactivity",1) == true and ExitDate(1) == sDate and CountIf(daylow(0) < DayLow(0)[1],BarsSinceExit(1)) == 1 Then Sell();
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-12-09 14:20:12

안녕하세요 예스스탁입니다. CountIf가 현재봉에서 청산봉까지 루프를 반복하게 되므로 다른 방법으로 작성하면 아래와 같습니다. var : count(0); SetStopLoss(loss,PercentStop); SetStopTrailing(trail,0,PercentStop,1); SetStopInactivity(최소가격,봉갯수,PercentStop); if MarketPosition == 0 Then { if TotalTrades > TotalTrades[1] Then count = 0; if daylow(0) < DayLow(0)[1] Then count = count+1; if IsExitName("StopLoss",1) == true and ExitDate(1) == sDate and count == 3 Then Sell(); if IsExitName("StopTrailing",1) == true and ExitDate(1) == sDate and count == 2 Then Sell(); if IsExitName("StopInactivity",1) == true and ExitDate(1) == sDate and count == 1 Then Sell(); } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 답변 수식 고맙습니다. 그런데... 아래 수식을 사용하면 수식 추가 이전보다 시뮬레이션 속도가 현저히 느려지는데요. 이유가 있을까요? 피시 메모리는 동일한 조건에서 비교했습니다. 속도를 고려한 다른 수식은 없겠는지요? *************************************************************************** SetStopLoss(loss,PercentStop); SetStopTrailing(trail,0,PercentStop,1); SetStopInactivity(최소가격,봉갯수,PercentStop); if MarketPosition == 0 and IsExitName("StopLoss",1) == true and ExitDate(1) == sDate and CountIf(daylow(0) < DayLow(0)[1],BarsSinceExit(1)) == 3 Then Sell(); if MarketPosition == 0 and IsExitName("StopTrailing",1) == true and ExitDate(1) == sDate and CountIf(daylow(0) < DayLow(0)[1],BarsSinceExit(1)) == 2 Then Sell(); if MarketPosition == 0 and IsExitName("StopInactivity",1) == true and ExitDate(1) == sDate and CountIf(daylow(0) < DayLow(0)[1],BarsSinceExit(1)) == 1 Then Sell();