커뮤니티

질문드립니다.

프로필 이미지
stockric
2017-11-23 09:05:22
164
글번호 114412
답변완료
이전의 질문과같이 진입제한이 되고있지않습니다. 이후의 청산식이 문제인걸까요? var : 매수시그널(false),매도시그널(false),BLcnt(0),SLcnt(0); if Bdate != Bdate[1] Then Lcnt = 0; if TotalTrades > TotalTrades[1] and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true Then BLcnt = BLcnt+1; if TotalTrades > TotalTrades[1] and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true Then SLcnt = SLcnt+1; 매수시그널 = false; if 매매조건1 then{ 매수시그널 = true; } if 매매조건2 then{ 매수시그널 = true; } if 매매조건3 then{ 매수시그널 = true; } if 매매조건4 then{ 매수시그널 = true; } if 매수시그널 and BLcnt < 2 then buy(); 매도시그널 = false; if 매매조건1 then{ 매도시그널 = true; } if 매매조건2 then{ 매도시그널 = true; } if 매매조건3 then{ 매도시그널 = true; } if 매매조건4 then{ 매도시그널 = true; } if 매도시그널 and SLcnt < 2 then sell(); SetStopLoss(~~~~); 올려주신 로직인데요. 이것이 적용하면 말을 듣지않습니다. 현재 로직의 경우 var : 매수시그널(false),매도시그널(false),BLcnt(0),SLcnt(0); if Bdate != Bdate[1] Then Lcnt = 0; if TotalTrades > TotalTrades[1] and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true Then BLcnt = BLcnt+1; if TotalTrades > TotalTrades[1] and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true Then SLcnt = SLcnt+1; 매수시그널 = false; if 매매조건1 then{ 매수시그널 = true; } if 매매조건2 then{ 매수시그널 = true; } if 매매조건3 then{ 매수시그널 = true; } if 매매조건4 then{ 매수시그널 = true; } If MarketPosition == 0 Then If 매수시그널 and BLcnt <2 Then Buy("매수"); If MarketPosition == 1 Then If 조건 Then //기본 청산 ExitLong("기본청산"); if MarketPosition == 1 then if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*12 Then exitlong("매수본전청산",AtStop,EntryPrice); // 본전청산 if MarketPosition ==1 Then #매수후 If highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*10 and #진입가 대비 10틱이상 상승후 CountIF(CrossUp(close,r1),30) and CrossDown(c+PriceScale*10,r1) Then #윗선 하향이탈하면 청산 exitlong("윗선청산"); If stime == 050000 or(stime > 050000 and stime[1] < 050000) then{ ExitLong("5시매수만료");} 매도시그널 = false; if 매매조건1 then{ 매도시그널 = true; } if 매매조건2 then{ 매도시그널 = true; } if 매매조건3 then{ 매도시그널 = true; } if 매매조건4 then{ 매도시그널 = true; } If MarketPosition == 0 Then If 매도시그널 and Lcnt2 <2 Then Sell("매도"); If MarketPosition == -1 Then If 조건 Then ExitShort("매도청산"); if MarketPosition == -1 Then if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*10 Then ExitShort("매도본전청산",AtStop,EntryPrice); if MarketPosition == -1 Then #매수후 if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*10 and #진입가 대비 20틱이상 하락후 CountIF(CrossDown(Close,s1),30)and CrossUp(Close-PriceScale*10,s1) Then #s1하향청산 ExitShort("하향청산"); If stime == 050000 or(stime > 050000 and stime[1] < 050000) then{ ExitShort("5시매도만료");} SetStopLoss(PriceScale*10,PointStop); 이것이 현 로직의 진입 청산인데요. 적용하면 밑의 청산로직때문인지 본 sell과buy의 2번 스탑로스후 진입제한이 걸리지않는다는것입니다..ㅠㅠ 무엇이 문제인지 도통 알 수가 없네요. 이렇게 짜니 5시 포지션청산도 작동이 안되네요.. 도와주세요!! 자력으로 타계가 힘든 포지션함수인듯합니다..
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2017-11-23 16:28:39

안녕하세요 예스스탁입니다. 변수 초기화 문제인것 같습니다. 수식에서 사용되는 변수와 다른부분이 없는지 확인하시기 바랍니다. 수정한 식입니다. var : 매수시그널(false),매도시그널(false),BLcnt(0),SLcnt(0); if Bdate != Bdate[1] Then{ BLcnt = 0; SLcnt = 0; } if TotalTrades > TotalTrades[1] and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true Then BLcnt = BLcnt+1; if TotalTrades > TotalTrades[1] and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true Then SLcnt = SLcnt+1; 매수시그널 = false; if 매매조건1 then{ 매수시그널 = true; } if 매매조건2 then{ 매수시그널 = true; } if 매매조건3 then{ 매수시그널 = true; } if 매매조건4 then{ 매수시그널 = true; } If MarketPosition == 0 then{ if 매수시그널 and BLcnt <2 Then Buy("매수"); } If MarketPosition == 1 Then{ If 조건 Then //기본 청산 ExitLong("기본청산"); if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*12 Then exitlong("매수본전청산",AtStop,EntryPrice); // 본전청산 If highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*10 and #진입가 대비 10틱이상 상승후 CountIF(CrossUp(close,r1),30) and CrossDown(c+PriceScale*10,r1) Then #윗선 하향이탈하면 청산 exitlong("윗선청산"); If stime == 050000 or(stime > 050000 and stime[1] < 050000) then{ ExitLong("5시매수만료");} } 매도시그널 = false; if 매매조건1 then{ 매도시그널 = true; } if 매매조건2 then{ 매도시그널 = true; } if 매매조건3 then{ 매도시그널 = true; } if 매매조건4 then{ 매도시그널 = true; } If MarketPosition == 0 Then{ If 매도시그널 and SLcnt < 2 Then Sell("매도"); } If MarketPosition == -1 Then{ If 조건 Then ExitShort("매도청산"); if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*10 Then ExitShort("매도본전청산",AtStop,EntryPrice); if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*10 and CountIF(CrossDown(Close,s1),30)and CrossUp(Close-PriceScale*10,s1) Then #s1하향청산 ExitShort("하향청산"); If stime == 050000 or(stime > 050000 and stime[1] < 050000) then{ ExitShort("5시매도만료");} } SetStopLoss(PriceScale*10,PointStop); 즐거운 하루되세요 > stockric 님이 쓴 글입니다. > 제목 : 질문드립니다. > 이전의 질문과같이 진입제한이 되고있지않습니다. 이후의 청산식이 문제인걸까요? var : 매수시그널(false),매도시그널(false),BLcnt(0),SLcnt(0); if Bdate != Bdate[1] Then Lcnt = 0; if TotalTrades > TotalTrades[1] and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true Then BLcnt = BLcnt+1; if TotalTrades > TotalTrades[1] and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true Then SLcnt = SLcnt+1; 매수시그널 = false; if 매매조건1 then{ 매수시그널 = true; } if 매매조건2 then{ 매수시그널 = true; } if 매매조건3 then{ 매수시그널 = true; } if 매매조건4 then{ 매수시그널 = true; } if 매수시그널 and BLcnt < 2 then buy(); 매도시그널 = false; if 매매조건1 then{ 매도시그널 = true; } if 매매조건2 then{ 매도시그널 = true; } if 매매조건3 then{ 매도시그널 = true; } if 매매조건4 then{ 매도시그널 = true; } if 매도시그널 and SLcnt < 2 then sell(); SetStopLoss(~~~~); 올려주신 로직인데요. 이것이 적용하면 말을 듣지않습니다. 현재 로직의 경우 var : 매수시그널(false),매도시그널(false),BLcnt(0),SLcnt(0); if Bdate != Bdate[1] Then Lcnt = 0; if TotalTrades > TotalTrades[1] and MarketPosition(1) == 1 and IsExitName("StopLoss",1) == true Then BLcnt = BLcnt+1; if TotalTrades > TotalTrades[1] and MarketPosition(1) == -1 and IsExitName("StopLoss",1) == true Then SLcnt = SLcnt+1; 매수시그널 = false; if 매매조건1 then{ 매수시그널 = true; } if 매매조건2 then{ 매수시그널 = true; } if 매매조건3 then{ 매수시그널 = true; } if 매매조건4 then{ 매수시그널 = true; } If MarketPosition == 0 Then If 매수시그널 and BLcnt <2 Then Buy("매수"); If MarketPosition == 1 Then If 조건 Then //기본 청산 ExitLong("기본청산"); if MarketPosition == 1 then if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*12 Then exitlong("매수본전청산",AtStop,EntryPrice); // 본전청산 if MarketPosition ==1 Then #매수후 If highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*10 and #진입가 대비 10틱이상 상승후 CountIF(CrossUp(close,r1),30) and CrossDown(c+PriceScale*10,r1) Then #윗선 하향이탈하면 청산 exitlong("윗선청산"); If stime == 050000 or(stime > 050000 and stime[1] < 050000) then{ ExitLong("5시매수만료");} 매도시그널 = false; if 매매조건1 then{ 매도시그널 = true; } if 매매조건2 then{ 매도시그널 = true; } if 매매조건3 then{ 매도시그널 = true; } if 매매조건4 then{ 매도시그널 = true; } If MarketPosition == 0 Then If 매도시그널 and Lcnt2 <2 Then Sell("매도"); If MarketPosition == -1 Then If 조건 Then ExitShort("매도청산"); if MarketPosition == -1 Then if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*10 Then ExitShort("매도본전청산",AtStop,EntryPrice); if MarketPosition == -1 Then #매수후 if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*10 and #진입가 대비 20틱이상 하락후 CountIF(CrossDown(Close,s1),30)and CrossUp(Close-PriceScale*10,s1) Then #s1하향청산 ExitShort("하향청산"); If stime == 050000 or(stime > 050000 and stime[1] < 050000) then{ ExitShort("5시매도만료");} SetStopLoss(PriceScale*10,PointStop); 이것이 현 로직의 진입 청산인데요. 적용하면 밑의 청산로직때문인지 본 sell과buy의 2번 스탑로스후 진입제한이 걸리지않는다는것입니다..ㅠㅠ 무엇이 문제인지 도통 알 수가 없네요. 이렇게 짜니 5시 포지션청산도 작동이 안되네요.. 도와주세요!! 자력으로 타계가 힘든 포지션함수인듯합니다..