커뮤니티

문의드립니다

프로필 이미지
cjfdk
2025-11-12 12:59:03
62
글번호 227961
답변완료


inputs: Length( 90 ), nK( 3 ), nBB( 2 ), AlertLine( 1 ), TargetPctOfRange( 100 ) ; variables: Rectangle( false ), ATRv( 0 ), SDev( 0 ), BBS_Ind( 0 ), RectangleTop( 0 ), RectangleBase( 0 ), RectangleRange( 0 ),Price(0); Price = C; if MarketPosition <> 0 then Rectangle = false ; ATRv = atr( Length ) ; SDev = std(Price, Length) ; if nK <> 0 and ATRv <> 0 then begin BBS_Ind = ( nBB * SDev ) / ( nK * ATRv ) ; if crossdown(BBS_Ind , AlertLine) and Rectangle == false and MarketPosition == 0 then begin RectangleTop = Highest( Close, Length ) ; RectangleBase = Lowest( Close, Length ) ; RectangleRange = RectangleTop - RectangleBase ; Rectangle = true ; end ; end ; if Rectangle == true then begin if Close >= RectangleTop then Buy("b"); else if Close <= RectangleBase then Sell("s"); end ; if MarketPosition == 1 then begin if Close >= RectangleTop + 0.01 * TargetPctOfRange * RectangleRange then ExitLong("LX PT"); if Close <= RectangleTop - .5 * RectangleRange then ExitLong("LX SL"); end else if MarketPosition == -1 then begin if Close <= RectangleBase - 0.01 * TargetPctOfRange * RectangleRange then ExitShort("SX PT"); if Close >= RectangleBase + .5 * RectangleRange then ExitShort("SX SL"); end; 수고 많으십니다 위 시스템에서 상황에 따라 계약 수량 변경하는 식을 추가로 부탁드립니다 진입후 손실로 마감했다면 다음 진입시 2계약 진입 익절로 마감 했다면 다음 진입시 다시 1계약으로 진입하는 식을 추가로 부탁드립니다 항상 감사드립니다

시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-11-12 14:08:31

안녕하세요 예스스탁입니다. inputs: Length( 90 ), nK( 3 ), nBB( 2 ), AlertLine( 1 ), TargetPctOfRange( 100 ),기본수량(1),최대수량(2) ; variables: Rectangle( false ), ATRv( 0 ), SDev( 0 ), BBS_Ind( 0 ), RectangleTop( 0 ), RectangleBase( 0 ), RectangleRange( 0 ),Price(0),EntryVol(0); Price = C; if MarketPosition <> 0 then Rectangle = false ; ATRv = atr( Length ) ; SDev = std(Price, Length) ; if nK <> 0 and ATRv <> 0 then begin BBS_Ind = ( nBB * SDev ) / ( nK * ATRv ) ; if crossdown(BBS_Ind , AlertLine) and Rectangle == false and MarketPosition == 0 then begin RectangleTop = Highest( Close, Length ) ; RectangleBase = Lowest( Close, Length ) ; RectangleRange = RectangleTop - RectangleBase ; Rectangle = true ; end ; end ; if Rectangle == true then begin if Close >= RectangleTop then { //현재 무포지션 if MarketPosition == 0 Then { //전체 첫진입이면 진입수량은 기본수량 if TotalTrades == 0 Then EntryVol = 기본수량; Else //첫진입이 아니면 { if PositionProfit(1) < 0 Then EntryVol = MaxContracts(1)*2; //직전거래가 손실이면 직전거래수량의 2배 Else EntryVol = 기본수량; //직전거래가 손실이 아니면 기본수량 } } Else //무포지션이 아니면(매도포지션) { if MarketPosition == -1 Then { if PositionProfit < 0 Then EntryVol = MaxContracts*2; //현재거래가 손실이면 현재진입수량의 2배 Else EntryVol = 기본수량;//현재거래가 손실이 아니면 기본수량 } } EntryVol = min(EntryVol,최대수량); Buy("b",OnClose,Def,EntryVol); } else if Close <= RectangleBase then { //현재 무포지션 if MarketPosition == 0 Then { //전체 첫진입이면 수량은 기본수량 if TotalTrades == 0 Then EntryVol = 기본수량; Else //첫진입이 아니면 { if PositionProfit(1) < 0 Then EntryVol = MaxContracts(1)*2; //직전거래가 손실이면 직전거래수량의 2배 Else EntryVol = 기본수량; //직전거래가 손실이 아니면 기본수량 } } Else //무포지션이 아니고(매수포지션) { if PositionProfit < 0 Then EntryVol = MaxContracts*2; //현재거래가 손실이면 현재진입수량*2 Else EntryVol = 기본수량; //현재거래가 손실이 아니면 기본수량 } EntryVol = min(EntryVol,최대수량); Sell("s",OnClose,def,EntryVol); } end ; if MarketPosition == 1 then begin if Close >= RectangleTop + 0.01 * TargetPctOfRange * RectangleRange then ExitLong("LX PT"); if Close <= RectangleTop - .5 * RectangleRange then ExitLong("LX SL"); end else if MarketPosition == -1 then begin if Close <= RectangleBase - 0.01 * TargetPctOfRange * RectangleRange then ExitShort("SX PT"); if Close >= RectangleBase + .5 * RectangleRange then ExitShort("SX SL"); end; 즐거운 하루되세요