커뮤니티

진입봉의 저가/고가

프로필 이미지
sewzie
2025-05-25 22:37:57
219
글번호 191147
답변완료
안녕하세요 해당 코드로 진입 시 손절라인을 진입봉의 저가/고가 or 특정 봉 수 지난 후로 설정하고 있습니다 var : hh(0),ll(0); input:X1(5); // 1~10, 직전 XX봉 횟수 ll = lowest(L,X1); hh = highest(H,X1); Condition1 = CrossUp(C,hh[1]) and MarketPosition == 0; Condition2 = CrossDown(C,ll[1]) and MarketPosition == 0; If Condition1 == True then Buy("B1",AtMarket,DEf,1); If Condition2 == True then Sell("B2",AtMarket,DEf,1); // 손절: 진입신호 봉의 저가 손절 input:FF(8); // 1~10, 진입 후 XX봉 경과 If MarketPosition == 1 and (EntryPrice < L[BarsSinceEntry[0]] or BarsSinceEntry > FF) Then ExitLong("C1"); If MarketPosition == -1 and (EntryPrice > H[BarsSinceEntry[0]] or BarsSinceEntry > FF) Then ExitShort("C2"); // 청산: 1% 단위로 일정 되돌림 비율 If OpenPositionProfit / EntryPrice >= 0.01 and OpenPositionProfit / EntryPrice < 0.02 Then SetStopTrailing(1,2,PercentStop); If OpenPositionProfit / EntryPrice >= 0.02 and OpenPositionProfit / EntryPrice < 0.03 Then SetStopTrailing(1.8,3,PercentStop); If OpenPositionProfit / EntryPrice >= 0.03 and OpenPositionProfit / EntryPrice < 0.04 Then SetStopTrailing(2.8,4,PercentStop); If OpenPositionProfit / EntryPrice >= 0.04 and OpenPositionProfit / EntryPrice < 0.05 Then SetStopTrailing(4,5,PercentStop); 하지만 NG.1로 백테스트했을때 진입봉 저가/고가 조건이 전혀 발동이 안되네요 확인 부탁드리겠습니다 감사합니다
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-05-26 14:58:55

안녕하세요 예스스탁입니다. EntryPrice < L[BarsSinceEntry[0]] EntryPrice > H[BarsSinceEntry[0]] 위 조건은 진입가가 진입봉의 저가보다 작다,진입가가 진입봉의 고가보다 크다입니다. 현재봉종가가 진입봉의 저가/고가보다 작다/크다이므로 진입가가 아닌 종가로 변경하시면 됩니다. var : hh(0),ll(0); input:X1(5); // 1~10, 직전 XX봉 횟수 ll = lowest(L,X1); hh = highest(H,X1); Condition1 = CrossUp(C,hh[1]) and MarketPosition == 0; Condition2 = CrossDown(C,ll[1]) and MarketPosition == 0; If Condition1 == True then Buy("B1",AtMarket,DEf,1); If Condition2 == True then Sell("B2",AtMarket,DEf,1); // 손절: 진입신호 봉의 저가 손절 input:FF(8); // 1~10, 진입 후 XX봉 경과 If MarketPosition == 1 and (c < L[BarsSinceEntry[0]] or BarsSinceEntry > FF) Then ExitLong("C1"); If MarketPosition == -1 and (c > H[BarsSinceEntry[0]] or BarsSinceEntry > FF) Then ExitShort("C2"); // 청산: 1% 단위로 일정 되돌림 비율 If OpenPositionProfit / EntryPrice >= 0.01 and OpenPositionProfit / EntryPrice < 0.02 Then SetStopTrailing(1,2,PercentStop); If OpenPositionProfit / EntryPrice >= 0.02 and OpenPositionProfit / EntryPrice < 0.03 Then SetStopTrailing(1.8,3,PercentStop); If OpenPositionProfit / EntryPrice >= 0.03 and OpenPositionProfit / EntryPrice < 0.04 Then SetStopTrailing(2.8,4,PercentStop); If OpenPositionProfit / EntryPrice >= 0.04 and OpenPositionProfit / EntryPrice < 0.05 Then SetStopTrailing(4,5,PercentStop); 즐거운 하루되세요 > sewzie 님이 쓴 글입니다. > 제목 : 진입봉의 저가/고가 > 안녕하세요 해당 코드로 진입 시 손절라인을 진입봉의 저가/고가 or 특정 봉 수 지난 후로 설정하고 있습니다 var : hh(0),ll(0); input:X1(5); // 1~10, 직전 XX봉 횟수 ll = lowest(L,X1); hh = highest(H,X1); Condition1 = CrossUp(C,hh[1]) and MarketPosition == 0; Condition2 = CrossDown(C,ll[1]) and MarketPosition == 0; If Condition1 == True then Buy("B1",AtMarket,DEf,1); If Condition2 == True then Sell("B2",AtMarket,DEf,1); // 손절: 진입신호 봉의 저가 손절 input:FF(8); // 1~10, 진입 후 XX봉 경과 If MarketPosition == 1 and (EntryPrice < L[BarsSinceEntry[0]] or BarsSinceEntry > FF) Then ExitLong("C1"); If MarketPosition == -1 and (EntryPrice > H[BarsSinceEntry[0]] or BarsSinceEntry > FF) Then ExitShort("C2"); // 청산: 1% 단위로 일정 되돌림 비율 If OpenPositionProfit / EntryPrice >= 0.01 and OpenPositionProfit / EntryPrice < 0.02 Then SetStopTrailing(1,2,PercentStop); If OpenPositionProfit / EntryPrice >= 0.02 and OpenPositionProfit / EntryPrice < 0.03 Then SetStopTrailing(1.8,3,PercentStop); If OpenPositionProfit / EntryPrice >= 0.03 and OpenPositionProfit / EntryPrice < 0.04 Then SetStopTrailing(2.8,4,PercentStop); If OpenPositionProfit / EntryPrice >= 0.04 and OpenPositionProfit / EntryPrice < 0.05 Then SetStopTrailing(4,5,PercentStop); 하지만 NG.1로 백테스트했을때 진입봉 저가/고가 조건이 전혀 발동이 안되네요 확인 부탁드리겠습니다 감사합니다