커뮤니티

수식 문의드립니다

프로필 이미지
고목리
2025-01-31 12:20:57
412
글번호 187601
답변완료
안녕하세요 ? 변수선언이 맞게 작성 되었는지 확인부탁드립니다 고맙습니다 input: period1(20), period2(100); var: mav1(0), mav2(0); mav1=ma(c, period1); mav2=ma(c, period2); #매수진입 if !(sTime>=090000 and sTime < 093500) and MarketPosition() != -1 and CrossUp(ma(c,20), ma(c,100)) and c>ma(c,100)+PriceScale*10 and Highest(h,200)-c>PriceScale*100 Then Buy("매수",AtMarket); #매수청산 if MarketPosition() == 1 Then { if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*290)Then ExitLong("수익1",AtStop, EntryPrice()+PriceScale*280,"매수"); if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*240)Then ExitLong("수익2",AtStop, EntryPrice()+PriceScale*190,"매수"); if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*190)Then ExitLong("수익3",AtStop, EntryPrice()+PriceScale*140,"매수"); if c<(EntryPrice()-PriceScale*190)Then ExitLong("손절", AtStop, c, "매수");} #매도 진입 if !(sTime >=090000 and sTime < 093500)and MarketPosition() != 1 and CrossDown(ma(c,20),ma(c,100)) and c<ma(c,100)-PriceScale*10 and Highest(h,200)-c>PriceScale*100 Then Sell("매도",AtMarket); #매도청산 if MarketPosition() == -1 Then { if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*490) Then ExitShort("매도수익0",AtStop,EntryPrice()-PriceScale*440,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*390) Then ExitShort("매도수익1",AtStop,EntryPrice()-PriceScale*340,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*190) Then ExitShort("매도수익2",AtStop,EntryPrice()-PriceScale*140,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*140) Then ExitShort("매도수익3",AtStop,EntryPrice()-PriceScale*90,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*50) Then ExitShort("매도수익4",AtStop,EntryPrice()-PriceScale*30,"매도"); if c>(EntryPrice()+PriceScale*200) Then ExitShort("매도손절",AtStop,c,"매도");}
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-02-03 10:18:09

안녕하세요 예스스탁입니다. 변수선언과 할당에는 문제가 없습니다. 다만 이동평균을 변수로 선언하고 할당했지만 if문에서 사용하지 않고 있습니다. if문에 20이평과 100이평을 변수로 대체해 드립니다. input: period1(20), period2(100); var: mav1(0), mav2(0); mav1=ma(c, period1); mav2=ma(c, period2); #매수진입 if !(sTime>=090000 and sTime < 093500) and MarketPosition() != -1 and CrossUp(mav1, mav2) and c>mav2+PriceScale*10 and Highest(h,200)-c>PriceScale*100 Then Buy("매수",AtMarket); #매수청산 if MarketPosition() == 1 Then { if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*290)Then ExitLong("수익1",AtStop, EntryPrice()+PriceScale*280,"매수"); if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*240)Then ExitLong("수익2",AtStop, EntryPrice()+PriceScale*190,"매수"); if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*190)Then ExitLong("수익3",AtStop, EntryPrice()+PriceScale*140,"매수"); if c<(EntryPrice()-PriceScale*190)Then ExitLong("손절", AtStop, c, "매수"); } #매도 진입 if !(sTime >=090000 and sTime < 093500)and MarketPosition() != 1 and CrossDown(mav1,mav2) and c<mav2-PriceScale*10 and Highest(h,200)-c>PriceScale*100 Then Sell("매도",AtMarket); #매도청산 if MarketPosition() == -1 Then { if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*490) Then ExitShort("매도수익0",AtStop,EntryPrice()-PriceScale*440,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*390) Then ExitShort("매도수익1",AtStop,EntryPrice()-PriceScale*340,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*190) Then ExitShort("매도수익2",AtStop,EntryPrice()-PriceScale*140,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*140) Then ExitShort("매도수익3",AtStop,EntryPrice()-PriceScale*90,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*50) Then ExitShort("매도수익4",AtStop,EntryPrice()-PriceScale*30,"매도"); if c>(EntryPrice()+PriceScale*200) Then ExitShort("매도손절",AtStop,c,"매도"); } 즐거운 하루되세요 > 고목리 님이 쓴 글입니다. > 제목 : 수식 문의드립니다 > 안녕하세요 ? 변수선언이 맞게 작성 되었는지 확인부탁드립니다 고맙습니다 input: period1(20), period2(100); var: mav1(0), mav2(0); mav1=ma(c, period1); mav2=ma(c, period2); #매수진입 if !(sTime>=090000 and sTime < 093500) and MarketPosition() != -1 and CrossUp(ma(c,20), ma(c,100)) and c>ma(c,100)+PriceScale*10 and Highest(h,200)-c>PriceScale*100 Then Buy("매수",AtMarket); #매수청산 if MarketPosition() == 1 Then { if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*290)Then ExitLong("수익1",AtStop, EntryPrice()+PriceScale*280,"매수"); if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*240)Then ExitLong("수익2",AtStop, EntryPrice()+PriceScale*190,"매수"); if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*190)Then ExitLong("수익3",AtStop, EntryPrice()+PriceScale*140,"매수"); if c<(EntryPrice()-PriceScale*190)Then ExitLong("손절", AtStop, c, "매수");} #매도 진입 if !(sTime >=090000 and sTime < 093500)and MarketPosition() != 1 and CrossDown(ma(c,20),ma(c,100)) and c<ma(c,100)-PriceScale*10 and Highest(h,200)-c>PriceScale*100 Then Sell("매도",AtMarket); #매도청산 if MarketPosition() == -1 Then { if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*490) Then ExitShort("매도수익0",AtStop,EntryPrice()-PriceScale*440,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*390) Then ExitShort("매도수익1",AtStop,EntryPrice()-PriceScale*340,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*190) Then ExitShort("매도수익2",AtStop,EntryPrice()-PriceScale*140,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*140) Then ExitShort("매도수익3",AtStop,EntryPrice()-PriceScale*90,"매도"); if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*50) Then ExitShort("매도수익4",AtStop,EntryPrice()-PriceScale*30,"매도"); if c>(EntryPrice()+PriceScale*200) Then ExitShort("매도손절",AtStop,c,"매도");}