커뮤니티

청산 후 재진입3(Lcount 구별)

프로필 이미지
목마와숙녀
2021-12-16 11:38:06
738
글번호 154351
답변완료

첨부 이미지

손절이후 당일 저점 1번째 돌파시 변수 적용 결과를 살펴보았습니다.(첨부파일) 387.24 저점을 돌파할 때 진입해야는데 다른 지점에서 진입합니다. 살펴주십시요. input : n(1); var : cnt(0),count(0); Count = 0 ; for cnt = 0 to 10 { if EntryDate(cnt) == sdate then Count = Count + 1; } input : 갭하락(1.5),손절진입(50),트레진입(50),최소진입(50); input : loss(0.5),trail(1.5),최소가격(0.4),봉갯수(150); if c < DayOpen - 갭하락 and count < n Then Sell("s"); 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 == 손절진입 Then Sell("손절진입"); if IsExitName("StopTrailing",1) == true and ExitDate(1) == sDate and count == 트레진입 Then Sell("트레진입"); if IsExitName("StopInactivity",1) == true and ExitDate(1) == sDate and count == 최소진입 Then Sell("최소진입"); } *********************************************************************************** 안녕하세요 예스스탁입니다. 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();
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-12-10 10:25:11

안녕하세여 예스스탁입니다. Count = 0 ; for cnt = 0 to 10 { if EntryDate(cnt) == sdate then Count = Count + 1; } 올리신 식에 당일 진입횟수 저장하는 변수도 count이고 if MarketPosition == 0 Then { if TotalTrades > TotalTrades[1] Then count = 0; if daylow(0) < DayLow(0)[1] Then count = count+1; 저가를 갱신을 카운트 하는 것도 count입니다. 답변 받은 수식을 기존식에 넣으실때 기존식에서 사용하는 변수와 겹치지 않는지 확인하셔야 하고 겹치면 다른이름으로 변경해서 적용하셔야 합니다. 다른 이름으로 변경해 드립니다. input : n(1); var : cnt(0),count(0),Lcount(0); Count = 0 ; for cnt = 0 to 10 { if EntryDate(cnt) == sdate then Count = Count + 1; } input : 갭하락(1.5),손절진입(50),트레진입(50),최소진입(50); input : loss(0.5),trail(1.5),최소가격(0.4),봉갯수(150); if c < DayOpen - 갭하락 and count < n Then Sell("s"); SetStopLoss(loss,PercentStop); SetStopTrailing(trail,0,PercentStop,1); SetStopInactivity(최소가격,봉갯수,PercentStop); if MarketPosition == 0 Then { if TotalTrades > TotalTrades[1] Then Lcount = 0; if daylow(0) < DayLow(0)[1] Then Lcount = Lcount+1; if IsExitName("StopLoss",1) == true and ExitDate(1) == sDate and Lcount == 손절진입 Then Sell("손절진입"); if IsExitName("StopTrailing",1) == true and ExitDate(1) == sDate and Lcount == 트레진입 Then Sell("트레진입"); if IsExitName("StopInactivity",1) == true and ExitDate(1) == sDate and Lcount == 최소진입 Then Sell("최소진입"); } 즐거운 하루되세요 > 목마와숙녀 님이 쓴 글입니다. > 제목 : 문의 > 손절이후 당일 저점 1번째 돌파시 변수 적용 결과를 살펴보았습니다.(첨부파일) 387.24 저점을 돌파할 때 진입해야는데 다른 지점에서 진입합니다. 살펴주십시요. input : n(1); var : cnt(0),count(0); Count = 0 ; for cnt = 0 to 10 { if EntryDate(cnt) == sdate then Count = Count + 1; } input : 갭하락(1.5),손절진입(50),트레진입(50),최소진입(50); input : loss(0.5),trail(1.5),최소가격(0.4),봉갯수(150); if c < DayOpen - 갭하락 and count < n Then Sell("s"); 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 == 손절진입 Then Sell("손절진입"); if IsExitName("StopTrailing",1) == true and ExitDate(1) == sDate and count == 트레진입 Then Sell("트레진입"); if IsExitName("StopInactivity",1) == true and ExitDate(1) == sDate and count == 최소진입 Then Sell("최소진입"); } *********************************************************************************** 안녕하세요 예스스탁입니다. 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();