커뮤니티

안녕하세요?

프로필 이미지
상중하
2017-07-26 02:30:28
109
글번호 111572
답변완료
안녕하세요? 당일 청산기준으로 손실이 -100틱이상일때 매매종료하는 수식 부탁드립니다. bl22,bl11,sl22,sl11 은 진입가청산이지만 수식작성시 포함해주세요 if MarketPosition == 1 and MaxContracts == 3 then{ if CurrentContracts == 3 then{ exitlong("bl31",AtStop,EntryPrice-PriceScale*20,"",1,1); } if CurrentContracts == 2 then{ exitlong("bl21",AtStop,EntryPrice-PriceScale*5,"",1,1); exitlong("bl22",AtStop,EntryPrice,"",1,1); } if CurrentContracts == 1 then{ exitlong("bl11",AtStop,EntryPrice,"",1,1); } } if MarketPosition == -1 and MaxContracts == 3 then{ if CurrentContracts == 3 then{ ExitShort("sl31",AtStop,EntryPrice+PriceScale*20,"",1,1); } if CurrentContracts == 2 then{ ExitShort("sl21",AtStop,EntryPrice+PriceScale*5,"",1,1); ExitShort("sl22",AtStop,EntryPrice,"",1,1); } if CurrentContracts == 2 then{ ExitShort("sl11",AtStop,EntryPrice,"",1,1); } }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-07-26 17:05:51

안녕하세요 예스스탁입니다. input : 하루손실틱수(100); var : NP(0),PreNP(0),DayPL(0),하루손실(0),Xcond(false); NP = NetProfit; 하루손실 = PriceScale*하루손실틱수; if date != date[1] Then{ preNP = NP[1]; Xcond = false; } dayPL = NP-PreNP; if TotalTrades > TotalTrades[1] and (IsExitName("dbx",1) == true or IsExitName("dsx",1) == true) Then Xcond = true; if Xcond == false then{ if 매수진입 Then buy(); if 매도진입 Then sell(); } if MarketPosition == 1 and MaxContracts == 3 then{ ExitLong("dbx",AtStop,AvgEntryPrice-(-하루손실-dayPL)/CurrentContracts); if CurrentContracts == 3 then{ exitlong("bl31",AtStop,EntryPrice-PriceScale*20,"",1,1); } if CurrentContracts == 2 then{ exitlong("bl21",AtStop,EntryPrice-PriceScale*5,"",1,1); exitlong("bl22",AtStop,EntryPrice,"",1,1); } if CurrentContracts == 1 then{ exitlong("bl11",AtStop,EntryPrice,"",1,1); } } if MarketPosition == -1 and MaxContracts == 3 then{ ExitShort("dsx",AtStop,AvgEntryPrice+(-하루손실-daypl)/CurrentContracts); if CurrentContracts == 3 then{ ExitShort("sl31",AtStop,EntryPrice+PriceScale*20,"",1,1); } if CurrentContracts == 2 then{ ExitShort("sl21",AtStop,EntryPrice+PriceScale*5,"",1,1); ExitShort("sl22",AtStop,EntryPrice,"",1,1); } if CurrentContracts == 2 then{ ExitShort("sl11",AtStop,EntryPrice,"",1,1); } } 즐거운 하루되세요 > 상중하 님이 쓴 글입니다. > 제목 : 안녕하세요? > 안녕하세요? 당일 청산기준으로 손실이 -100틱이상일때 매매종료하는 수식 부탁드립니다. bl22,bl11,sl22,sl11 은 진입가청산이지만 수식작성시 포함해주세요 if MarketPosition == 1 and MaxContracts == 3 then{ if CurrentContracts == 3 then{ exitlong("bl31",AtStop,EntryPrice-PriceScale*20,"",1,1); } if CurrentContracts == 2 then{ exitlong("bl21",AtStop,EntryPrice-PriceScale*5,"",1,1); exitlong("bl22",AtStop,EntryPrice,"",1,1); } if CurrentContracts == 1 then{ exitlong("bl11",AtStop,EntryPrice,"",1,1); } } if MarketPosition == -1 and MaxContracts == 3 then{ if CurrentContracts == 3 then{ ExitShort("sl31",AtStop,EntryPrice+PriceScale*20,"",1,1); } if CurrentContracts == 2 then{ ExitShort("sl21",AtStop,EntryPrice+PriceScale*5,"",1,1); ExitShort("sl22",AtStop,EntryPrice,"",1,1); } if CurrentContracts == 2 then{ ExitShort("sl11",AtStop,EntryPrice,"",1,1); } }