커뮤니티

수식 부탁드립니다

프로필 이미지
와시1000
2023-01-02 17:04:27
857
글번호 165018
답변완료
var1 = ma(C,20); if MarketPosition == 0 and CrossUp(c,var1) Then Buy("b",OnClose,DEf,1); if MarketPosition == 1 Then { ExitLong("Bp",AtLimit,EntryPrice+PriceScale*30); Sell("bs",AtStop,EntryPrice-PriceScale*30,MaxContracts*2); } if MarketPosition == -1 Then { ExitShort("Sp",AtLimit,EntryPrice-PriceScale*30); Buy("sb",AtStop,EntryPrice+PriceScale*30,MaxContracts*2); } 안녕하세요 이평선 넘어가면 30틱 이익나면 끝내고 30틱 손실나면 계속 늘리는 식인데 진입후 바로 이익 손실이나면 다음 봉에서 실행되는 데 해결 방법 없을까요?
시스템
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2023-01-03 14:40:22

안녕하세요 예스스탁입니다. if문은 봉완성기준(다음봉시가수신)입니다. if조건의 MarketPosition도 봉완성시에 체크되므로 상향돌파 진입시에 다음봉에서 30틱 하락하면 스위칭되는 내용만 추가해 주시고 이익청산을 강제청산함수로 지정해 주시면 됩니다. var1 = ma(C,20); if MarketPosition == 0 and CrossUp(c,var1) Then { Buy("b",OnClose,DEf,1); Sell("bs1",AtStop,c-PriceScale*30); } if MarketPosition == 1 Then { Sell("bs",AtStop,EntryPrice-PriceScale*30,MaxContracts*2); } if MarketPosition == -1 Then { Buy("sb",AtStop,EntryPrice+PriceScale*30,MaxContracts*2); } SetStopProfittarget(PriceScale*30,PointStop); 즐거운 하루되세요 > 와시1000 님이 쓴 글입니다. > 제목 : 수식 부탁드립니다 > var1 = ma(C,20); if MarketPosition == 0 and CrossUp(c,var1) Then Buy("b",OnClose,DEf,1); if MarketPosition == 1 Then { ExitLong("Bp",AtLimit,EntryPrice+PriceScale*30); Sell("bs",AtStop,EntryPrice-PriceScale*30,MaxContracts*2); } if MarketPosition == -1 Then { ExitShort("Sp",AtLimit,EntryPrice-PriceScale*30); Buy("sb",AtStop,EntryPrice+PriceScale*30,MaxContracts*2); } 안녕하세요 이평선 넘어가면 30틱 이익나면 끝내고 30틱 손실나면 계속 늘리는 식인데 진입후 바로 이익 손실이나면 다음 봉에서 실행되는 데 해결 방법 없을까요?
프로필 이미지

와시1000

2023-01-05 16:10:05

스위칭은 진입봉에서는 안되고 다음 봉에서만 되는 건가요? > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 부탁드립니다 > 안녕하세요 예스스탁입니다. if문은 봉완성기준(다음봉시가수신)입니다. if조건의 MarketPosition도 봉완성시에 체크되므로 상향돌파 진입시에 다음봉에서 30틱 하락하면 스위칭되는 내용만 추가해 주시고 이익청산을 강제청산함수로 지정해 주시면 됩니다. var1 = ma(C,20); if MarketPosition == 0 and CrossUp(c,var1) Then { Buy("b",OnClose,DEf,1); Sell("bs1",AtStop,c-PriceScale*30); } if MarketPosition == 1 Then { Sell("bs",AtStop,EntryPrice-PriceScale*30,MaxContracts*2); } if MarketPosition == -1 Then { Buy("sb",AtStop,EntryPrice+PriceScale*30,MaxContracts*2); } SetStopProfittarget(PriceScale*30,PointStop); 즐거운 하루되세요 > 와시1000 님이 쓴 글입니다. > 제목 : 수식 부탁드립니다 > var1 = ma(C,20); if MarketPosition == 0 and CrossUp(c,var1) Then Buy("b",OnClose,DEf,1); if MarketPosition == 1 Then { ExitLong("Bp",AtLimit,EntryPrice+PriceScale*30); Sell("bs",AtStop,EntryPrice-PriceScale*30,MaxContracts*2); } if MarketPosition == -1 Then { ExitShort("Sp",AtLimit,EntryPrice-PriceScale*30); Buy("sb",AtStop,EntryPrice+PriceScale*30,MaxContracts*2); } 안녕하세요 이평선 넘어가면 30틱 이익나면 끝내고 30틱 손실나면 계속 늘리는 식인데 진입후 바로 이익 손실이나면 다음 봉에서 실행되는 데 해결 방법 없을까요?