커뮤니티

수식 검토좀 부탁합니다.

프로필 이미지
무결점
2013-08-22 09:33:35
144
글번호 66700
답변완료
var : Bcnt(0),BPrice(0),Scnt(0),SPrice(0); var1 = ma(c,1000); var2 = ma(c,2000); if MarketPosition <= 0 and crossup(var1,var2) Then buy("b1"); if MarketPosition == 0 and var1 > var2 and !(crossup(var1,var2)) Then buy("b2"); if MarketPosition == 1 Then{ if CurrentContracts > CurrentContracts[1] Then{ if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) == 1 Then{ Bcnt = 1; BPrice = EntryPrice; } if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) >= 2 and C[1] < BPrice Then{ Bcnt = countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry); BPrice = C[1]; } } } if MarketPosition == 1 Then buy("bb",atlimit,BPrice-(PriceScale*20)); if MarketPosition >= 0 and CrossDown(var1,var2) Then Sell("s1"); if MarketPosition == 0 and var1 < var2 and !(CrossDown(var1,var2)) Then Sell("s2"); if MarketPosition == -1 Then{ if CurrentContracts > CurrentContracts[1] Then{ if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) == 1 Then{ Scnt = 1; SPrice = EntryPrice; } if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) >= 2 and C[1] > SPrice Then{ Scnt = countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry); SPrice = C[1]; } } } if MarketPosition == -1 Then Sell("ss",atlimit,SPrice+(PriceScale*20)); #20틱 목표수익 청산(개별 진입별로 발동) SetStopProfittarget(PriceScale*20,PointStop); MessageLog("수치 %.f",CurrentContracts); 제가 이 수식을 1분봉으로 시뮬레이션 해본 결과, 처음 포지션 진입후에 피라미딩을 잘 잡아가는데, 아시다시피 CurrentContracts > CurrentContracts[1] 이 수식때문에 항상 전 계약수보다 현재 계약수가 많아야 한다는 조건때문에 피라미딩이 예를들어 3개였는데 2개로 줄었을때 2개에서 다시 3개로 포지션을 늘리지 못하는 문제가 발생이 되더군요. 3개에서 2개로 줄은 상태에서 항상 최근 진입한 포지션이 -20틱 손실일때 진입이 원칙인데 말입니다. if MarketPosition == 1 Then buy("bb",atlimit,BPrice-(PriceScale*20)); 이 수식대로 항상 제가 원하는 것은 최근 포지션이 -20틱 손실일때 해당 포지션 진입입니다. 그런데 포지션이 3개였다가 고정수익으로 포지션이 2개가 된 상태에서 시세가 다시 밀리면 또 진입하는건데 CurrentContracts > CurrentContracts[1] 이 수식때문에 시세가 -20틱 밀려도 진입을 못하는 상황이 연출이 됩니다. 어떻게 하면 될까요..?
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-08-22 10:49:35

안녕하세요 예스스탁입니다. 오후 1시 이후에 02-3453-1060으로 전화주시기 바라니다. 즐거운 하루되세요 > 무결점 님이 쓴 글입니다. > 제목 : 수식 검토좀 부탁합니다. > var : Bcnt(0),BPrice(0),Scnt(0),SPrice(0); var1 = ma(c,1000); var2 = ma(c,2000); if MarketPosition <= 0 and crossup(var1,var2) Then buy("b1"); if MarketPosition == 0 and var1 > var2 and !(crossup(var1,var2)) Then buy("b2"); if MarketPosition == 1 Then{ if CurrentContracts > CurrentContracts[1] Then{ if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) == 1 Then{ Bcnt = 1; BPrice = EntryPrice; } if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) >= 2 and C[1] < BPrice Then{ Bcnt = countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry); BPrice = C[1]; } } } if MarketPosition == 1 Then buy("bb",atlimit,BPrice-(PriceScale*20)); if MarketPosition >= 0 and CrossDown(var1,var2) Then Sell("s1"); if MarketPosition == 0 and var1 < var2 and !(CrossDown(var1,var2)) Then Sell("s2"); if MarketPosition == -1 Then{ if CurrentContracts > CurrentContracts[1] Then{ if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) == 1 Then{ Scnt = 1; SPrice = EntryPrice; } if countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry) >= 2 and C[1] > SPrice Then{ Scnt = countif(CurrentContracts > CurrentContracts[1],BarsSinceEntry); SPrice = C[1]; } } } if MarketPosition == -1 Then Sell("ss",atlimit,SPrice+(PriceScale*20)); #20틱 목표수익 청산(개별 진입별로 발동) SetStopProfittarget(PriceScale*20,PointStop); MessageLog("수치 %.f",CurrentContracts); 제가 이 수식을 1분봉으로 시뮬레이션 해본 결과, 처음 포지션 진입후에 피라미딩을 잘 잡아가는데, 아시다시피 CurrentContracts > CurrentContracts[1] 이 수식때문에 항상 전 계약수보다 현재 계약수가 많아야 한다는 조건때문에 피라미딩이 예를들어 3개였는데 2개로 줄었을때 2개에서 다시 3개로 포지션을 늘리지 못하는 문제가 발생이 되더군요. 3개에서 2개로 줄은 상태에서 항상 최근 진입한 포지션이 -20틱 손실일때 진입이 원칙인데 말입니다. if MarketPosition == 1 Then buy("bb",atlimit,BPrice-(PriceScale*20)); 이 수식대로 항상 제가 원하는 것은 최근 포지션이 -20틱 손실일때 해당 포지션 진입입니다. 그런데 포지션이 3개였다가 고정수익으로 포지션이 2개가 된 상태에서 시세가 다시 밀리면 또 진입하는건데 CurrentContracts > CurrentContracts[1] 이 수식때문에 시세가 -20틱 밀려도 진입을 못하는 상황이 연출이 됩니다. 어떻게 하면 될까요..?