커뮤니티

안녕하세요?

프로필 이미지
상중하
2017-01-12 03:00:09
140
글번호 105802
답변완료

첨부 이미지

항상 감사드립니다. 1. 어제 만들어주신 수식을 활용하는데 잘 안되어서 질문 드립니다. 추가매수 b2가 발생하지 않는데 수정 부탁드립니다.(첨부그림참조_51415번 질문내용 참고) 2.청산식에서 EntryPrice를 사용하게 되면 진입가가 기준이 되나요? 예를들어 1차 청산후 2차 진입이 50.00 이라면 EntryPrice를 사용하면 기준가격이 50.00이 되게 하고 싶습니다. 그이전의 가격은 무시하고 2차진입가격(b2)의 가격으로 손절이나 본절하고 싶습니다. if MarketPosition == 1 then{ if CurrentContracts > CurrentContracts[1] Then HH = H; if H > HH Then HH = H; if MaxEntries == 1 Then ExitLong("dl1",atlimit,EntryPrice+PriceScale*20,"",1,1); if MaxEntries == 2 Then ExitLong("bp2",atlimit,EntryPrice+PriceScale*20); if HH < AvgEntryPrice+PriceScale*13 Then ExitLong("bl1",AtStop,AEntryPrice-PriceScale*10); if HH >= AvgEntryPrice+PriceScale*13 Then ExitLong("bl2",AtStop,EntryPrice+PriceScale*1); } 3. 기존 수식은 추가 매수 한번 하고 올청산인데요. 기존 수식은 추가 매수 두번 하고 올청산하는 수식도 요청합니다. 이런 부분도 외부변수로 할수 있나요 가능하면 부탁드립니다. 감사합니다. ---------------------------------------------------------------------------------------- var : Xcond(false),HH(0); var1 = ma(c,5); var2 = ma(c,20); if TotalTrades > TotalTrades[1] Then{ if (IsExitName("dl1",1) == true or IsExitName("dl2",1) == true or IsExitName("bl1",1) or IsExitName("bl2",1)) Then Xcond = True; Else Xcond = false; } if MarketPosition ==0 and (Xcond == false or (MarketPosition == 1 and MaxEntries == 1) or (Xcond == true and BarsSinceExit(1) >= 1)) then { if 매수조건 Then{ buy("b1",AtStop,NextBarOpen+PriceScale*3,2); if MarketPosition == 1 and MaxEntries == 1 Then buy("b2",AtStop,NextBarOpen+PriceScale*1,1); } } if MarketPosition == 1 then{ if CurrentContracts > CurrentContracts[1] Then HH = H; if H > HH Then HH = H; if MaxEntries == 1 Then ExitLong("dl1",atlimit,AvgEntryPrice+PriceScale*20,"",1,1); if MaxEntries == 2 Then ExitLong("bp2",atlimit,AvgEntryPrice+PriceScale*20); if HH < AvgEntryPrice+PriceScale*13 Then ExitLong("bl1",AtStop,AvgEntryPrice-PriceScale*10); if HH >= AvgEntryPrice+PriceScale*13 Then ExitLong("bl2",AtStop,AvgEntryPrice+PriceScale*1); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-01-12 09:30:47

안녕하세요 예스스탁입니다. 1 if MarketPosition == 0 and (Xcond == false or (MarketPosition == 1 and MaxEntries == 1) or (Xcond == true and BarsSinceExit(1) >= 1)) then { 추가매수가 b1조건가 같이 결합되어 위 조건에 같이 적용을 받습니다. 1차 진입의 조건과 결합이 되지 않게 하셔야 합니다. 2 EntryPrice는 무조건 포지션의 첫진입의 진입가만 리턴합니다. 현재 포지션 상태에서 평단가는 AvgEntryPrice 포지션 진행 중 가장 최근의 진입가는 LatestEntryPrice(0)입니다. 수식은 가장최근진입가격으로 변경해 드립니다. 3 input : 최대진입횟수(2); var : Xcond(false),HH(0); var1 = ma(c,5); var2 = ma(c,20); if TotalTrades > TotalTrades[1] Then{ if (IsExitName("dl1",1) == true or IsExitName("dl2",1) == true or IsExitName("bl1",1) or IsExitName("bl2",1)) Then Xcond = True; Else Xcond = false; } if MarketPosition == 0 and (Xcond == false or (MarketPosition == 1 and MaxEntries == 1) or (Xcond == true and BarsSinceExit(1) >= 1)) then { if 매수조건 Then{ buy("b1",AtStop,NextBarOpen+PriceScale*3,2); } if MarketPosition == 1 then{ if MaxEntries >= 1 and MaxEntries < 최대진입횟수 Then buy("b2",AtStop,NextBarOpen+PriceScale*1,1); } if CurrentContracts > CurrentContracts[1] Then HH = H; if H > HH Then HH = H; if MaxEntries == 1 Then ExitLong("dl1",atlimit,LatestEntryPrice(0)+PriceScale*20,"",1,1); if MaxEntries == 2 Then ExitLong("bp2",atlimit,LatestEntryPrice(0)+PriceScale*20); if HH < AvgEntryPrice+PriceScale*13 Then ExitLong("bl1",AtStop,LatestEntryPrice(0)-PriceScale*10); if HH >= AvgEntryPrice+PriceScale*13 Then ExitLong("bl2",AtStop,LatestEntryPrice(0)+PriceScale*1); } 즐거운 하루되세요 > 상중하 님이 쓴 글입니다. > 제목 : 안녕하세요? > 항상 감사드립니다. 1. 어제 만들어주신 수식을 활용하는데 잘 안되어서 질문 드립니다. 추가매수 b2가 발생하지 않는데 수정 부탁드립니다.(첨부그림참조_51415번 질문내용 참고) 2.청산식에서 EntryPrice를 사용하게 되면 진입가가 기준이 되나요? 예를들어 1차 청산후 2차 진입이 50.00 이라면 EntryPrice를 사용하면 기준가격이 50.00이 되게 하고 싶습니다. 그이전의 가격은 무시하고 2차진입가격(b2)의 가격으로 손절이나 본절하고 싶습니다. if MarketPosition == 1 then{ if CurrentContracts > CurrentContracts[1] Then HH = H; if H > HH Then HH = H; if MaxEntries == 1 Then ExitLong("dl1",atlimit,EntryPrice+PriceScale*20,"",1,1); if MaxEntries == 2 Then ExitLong("bp2",atlimit,EntryPrice+PriceScale*20); if HH < AvgEntryPrice+PriceScale*13 Then ExitLong("bl1",AtStop,AEntryPrice-PriceScale*10); if HH >= AvgEntryPrice+PriceScale*13 Then ExitLong("bl2",AtStop,EntryPrice+PriceScale*1); } 3. 기존 수식은 추가 매수 한번 하고 올청산인데요. 기존 수식은 추가 매수 두번 하고 올청산하는 수식도 요청합니다. 이런 부분도 외부변수로 할수 있나요 가능하면 부탁드립니다. 감사합니다. ---------------------------------------------------------------------------------------- var : Xcond(false),HH(0); var1 = ma(c,5); var2 = ma(c,20); if TotalTrades > TotalTrades[1] Then{ if (IsExitName("dl1",1) == true or IsExitName("dl2",1) == true or IsExitName("bl1",1) or IsExitName("bl2",1)) Then Xcond = True; Else Xcond = false; } if MarketPosition ==0 and (Xcond == false or (MarketPosition == 1 and MaxEntries == 1) or (Xcond == true and BarsSinceExit(1) >= 1)) then { if 매수조건 Then{ buy("b1",AtStop,NextBarOpen+PriceScale*3,2); if MarketPosition == 1 and MaxEntries == 1 Then buy("b2",AtStop,NextBarOpen+PriceScale*1,1); } } if MarketPosition == 1 then{ if CurrentContracts > CurrentContracts[1] Then HH = H; if H > HH Then HH = H; if MaxEntries == 1 Then ExitLong("dl1",atlimit,AvgEntryPrice+PriceScale*20,"",1,1); if MaxEntries == 2 Then ExitLong("bp2",atlimit,AvgEntryPrice+PriceScale*20); if HH < AvgEntryPrice+PriceScale*13 Then ExitLong("bl1",AtStop,AvgEntryPrice-PriceScale*10); if HH >= AvgEntryPrice+PriceScale*13 Then ExitLong("bl2",AtStop,AvgEntryPrice+PriceScale*1); }