커뮤니티

문의드립니다.

프로필 이미지
카르마다
2023-11-26 23:33:17
738
글번호 174306
답변완료
수고 많으십니다. 국내선물로 미니 5계약 매매를 하는데 청산에서 잘 안되는 부분이 있어 문의드립니다. 1. 진입후 10틱 수익이면 1계약만 일단 부분 익절로 챙기고 나머지 계약수는 다른 청산식으로 청산대응을 하고 싶은데 문제는 1계약 익절후 그 다음 봉에서 또 익절을 하고 심지어 1개봉에서 2계약 익절도 나옵니다. var : 익절틱수1(10); if MarketPosition == 1 Then ExitLong("B_P1",AtLimit,EntryPrice+PriceScale*익절틱수1,"",1,1); 이렇게도 해보고 if H < EntryPrice+PriceScale*익절틱수1 Then ExitLong("B_P1",AtStop,EntryPrice+PriceScale*익절틱수1,"",1,1); 이렇게도 해보고 if MarketPosition == 1 Then { if CurrentContracts < CurrentContracts[1] Then { if LatestExitName(0) == "B_P1" Then Condition1 = true; } if Condition1 == False and H < EntryPrice+PriceScale*익절틱수1 Then ExitLong("B_P1"atstop,Var6-PriceScale*익절틱수1,"",1,1); } Else { Condition1 = False; } 이렇게도 해봤으나 마찬가지입니다. ★ 다계약 진입후 "단 1번만" 진입가에서 위든 아래든 10틱 가면 익절하고 그뒤는 적용 안되는 청산식을 부탁드립니다 ★ ================================================================================================================= 2. 트레이딩스탑도 마찬가지로 "단 1번씩만" 신호가 적용되고 그뒤 같은 조건이되도 적용안되게 부탁드립니다. var : 최소수익1(20),수익감소1(10); var : 최소수익2(30),수익감소2(20); var : HH(0),LL(0); if MarketPosition == 1 Then { HH = Highest(H,BarsSinceEntry); if HH >= EntryPrice+PriceScale*최소수익1 and HH < EntryPrice+PriceScale*최소수익2 Then ExitLong("B_TS1",AtStop,HH-PriceScale*수익감소1,"",2,1); if HH >= EntryPrice+PriceScale*최소수익2 Then ExitLong("B_TS2",AtStop,HH-PriceScale*수익감소2,"",1,1); } if MarketPosition == -1 Then { LL = lowest(L,BarsSinceEntry); if LL <= EntryPrice-PriceScale*최소수익1 and LL > EntryPrice-PriceScale*최소수익2 Then ExitShort("S_TS1",AtStop,LL+PriceScale*수익감소1,"",2,1); if LL <= EntryPrice-PriceScale*최소수익2 Then ExitShort("S_TS2",AtStop,LL+PriceScale*수익감소2,"",1,1); } 노고에 늘 감사드립니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-11-27 13:07:01

안녕하세요 예스스탁입니다. 각 청산함수는 발생한 진입신호당 1회가 동작합니다. 진입이 한번이면 청산도 한번만 발생하지만 동일방향 진입이 2번이상이면 각 청산함수는 진입횟수만큼 발생가능합니다. 그러므로 피라미딩으로 여러번 진입후에 1회만 청산을 한다면 아래와 같이 지정한 청산은 한번만 발동하게 변수로 제어하셔야 합니다. 1 input : 익절틱수1(10); var : BXcond1(False); if MarketPosition == 1 Then { if CurrentContracts < CurrentContracts[1] Then { if LatestExitName(0) == "B_P1" Then BXcond1 = true; } if BXcond1 == False Then ExitLong("B_P1",AtLimit,EntryPrice+PriceScale*익절틱수1,"",1,1); } Else { BXcond1 = False; } 2 var : 최소수익1(20),수익감소1(10); var : 최소수익2(30),수익감소2(20); var : HH(0),LL(0); var : BXcond2(False),BXcond3(False); var : SXcond2(False),SXcond3(False); if MarketPosition == 1 Then { if CurrentContracts < CurrentContracts[1] Then { if LatestExitName(0) == "B_TS1" Then BXcond2 = true; if LatestExitName(0) == "B_TS2" Then BXcond3 = true; } HH = Highest(H,BarsSinceEntry); if BXcond2 == False and HH >= EntryPrice+PriceScale*최소수익1 and HH < EntryPrice+PriceScale*최소수익2 Then ExitLong("B_TS1",AtStop,HH-PriceScale*수익감소1,"",2,1); if BXcond3 == False and HH >= EntryPrice+PriceScale*최소수익2 Then ExitLong("B_TS2",AtStop,HH-PriceScale*수익감소2,"",1,1); } Else { BXcond2 = False; BXcond3 = False; } if MarketPosition == -1 Then { if CurrentContracts < CurrentContracts[1] Then { if LatestExitName(0) == "S_TS1" Then BXcond2 = true; if LatestExitName(0) == "S_TS2" Then BXcond3 = true; } LL = lowest(L,BarsSinceEntry); if SXcond2 == False and LL <= EntryPrice-PriceScale*최소수익1 and LL > EntryPrice-PriceScale*최소수익2 Then ExitShort("S_TS1",AtStop,LL+PriceScale*수익감소1,"",2,1); if SXcond3 == False and LL <= EntryPrice-PriceScale*최소수익2 Then ExitShort("S_TS2",AtStop,LL+PriceScale*수익감소2,"",1,1); } Else { SXcond2 = False; SXcond3 = False; } 즐거운 하루되세요 > 카르마다 님이 쓴 글입니다. > 제목 : 문의드립니다. > 수고 많으십니다. 국내선물로 미니 5계약 매매를 하는데 청산에서 잘 안되는 부분이 있어 문의드립니다. 1. 진입후 10틱 수익이면 1계약만 일단 부분 익절로 챙기고 나머지 계약수는 다른 청산식으로 청산대응을 하고 싶은데 문제는 1계약 익절후 그 다음 봉에서 또 익절을 하고 심지어 1개봉에서 2계약 익절도 나옵니다. var : 익절틱수1(10); if MarketPosition == 1 Then ExitLong("B_P1",AtLimit,EntryPrice+PriceScale*익절틱수1,"",1,1); 이렇게도 해보고 if H < EntryPrice+PriceScale*익절틱수1 Then ExitLong("B_P1",AtStop,EntryPrice+PriceScale*익절틱수1,"",1,1); 이렇게도 해보고 if MarketPosition == 1 Then { if CurrentContracts < CurrentContracts[1] Then { if LatestExitName(0) == "B_P1" Then Condition1 = true; } if Condition1 == False and H < EntryPrice+PriceScale*익절틱수1 Then ExitLong("B_P1"atstop,Var6-PriceScale*익절틱수1,"",1,1); } Else { Condition1 = False; } 이렇게도 해봤으나 마찬가지입니다. ★ 다계약 진입후 "단 1번만" 진입가에서 위든 아래든 10틱 가면 익절하고 그뒤는 적용 안되는 청산식을 부탁드립니다 ★ ================================================================================================================= 2. 트레이딩스탑도 마찬가지로 "단 1번씩만" 신호가 적용되고 그뒤 같은 조건이되도 적용안되게 부탁드립니다. var : 최소수익1(20),수익감소1(10); var : 최소수익2(30),수익감소2(20); var : HH(0),LL(0); if MarketPosition == 1 Then { HH = Highest(H,BarsSinceEntry); if HH >= EntryPrice+PriceScale*최소수익1 and HH < EntryPrice+PriceScale*최소수익2 Then ExitLong("B_TS1",AtStop,HH-PriceScale*수익감소1,"",2,1); if HH >= EntryPrice+PriceScale*최소수익2 Then ExitLong("B_TS2",AtStop,HH-PriceScale*수익감소2,"",1,1); } if MarketPosition == -1 Then { LL = lowest(L,BarsSinceEntry); if LL <= EntryPrice-PriceScale*최소수익1 and LL > EntryPrice-PriceScale*최소수익2 Then ExitShort("S_TS1",AtStop,LL+PriceScale*수익감소1,"",2,1); if LL <= EntryPrice-PriceScale*최소수익2 Then ExitShort("S_TS2",AtStop,LL+PriceScale*수익감소2,"",1,1); } 노고에 늘 감사드립니다.