커뮤니티

수식작성 이렇게 하는게 맞나요?

프로필 이미지
무결점
2013-08-09 09:43:58
164
글번호 66273
답변완료
var : Bcnt(0),BPrice(0),Scnt(0),SPrice(0); # 현재 매수진입중인 포지션들 중에서 제일 낮은 가격의 매수포지션이 20틱 손실일때 매수진입. 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)); # 현재 매도진입중인 포지션들 중에서 제일 높은 가격의 매도포지션이 20틱 손실일때 매도진입. 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)); 이렇게 수식을 작성하는게 맞는 건가요? 그리고 두번째에 있는 수식이 마켓포지션이 -1이 아니라 1인데 이거 -1 로 고쳐야 하는것 아닌가요??
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-08-09 16:08:17

안녕하세요 예스스탁입니다. 예 작성하신 식 내용 맞습니다. 두번째 매도쪽 수식에 MarketPosition == 1을 MarketPosition == -1로 변경해 주시면 됩니다. 해당 식은 매수 피라미딩(동일진입이 중복으로 발생) 중에 가격이 하락하여 가장 낮은 진입가격에서 20틱 더 떨어지면 추가매수하고 매도 피라미딩(동일진입이 중복으로 발생) 중에 가격이 상승하여 가장 높은 진입가격에서 20틱 더 떨어지면 추가매도하는 내용입니다. var : Bcnt(0),BPrice(0),Scnt(0),SPrice(0); 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 == -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)); 즐거운 하루되세요 > 무결점 님이 쓴 글입니다. > 제목 : 수식작성 이렇게 하는게 맞나요? > var : Bcnt(0),BPrice(0),Scnt(0),SPrice(0); # 현재 매수진입중인 포지션들 중에서 제일 낮은 가격의 매수포지션이 20틱 손실일때 매수진입. 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)); # 현재 매도진입중인 포지션들 중에서 제일 높은 가격의 매도포지션이 20틱 손실일때 매도진입. 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)); 이렇게 수식을 작성하는게 맞는 건가요? 그리고 두번째에 있는 수식이 마켓포지션이 -1이 아니라 1인데 이거 -1 로 고쳐야 하는것 아닌가요??