커뮤니티

문의드립니다

프로필 이미지
부동여산
2020-01-21 17:07:06
165
글번호 135325
답변완료
모든 신호는 항생을 기준으로 하고 매수매도만 미니항생으로 해보려고 하는데 미니항생에 Data2를 불러와서 짜봐도 잘 되지 않습니다 아래식을 위 처럼 운용하려면 어떻게 식을 짜야하나요? Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), stopPer(1.0), 최소수익1(0.4),수익감소1(20), Ratio(0.2); Vars: FastMA(0), SlowMA(0),LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999), ReCnt(0), MP(0), BH(0),BL(0), ShotMaxRatio(0), LongMaxRatio(0); FastMA = ma(C , FastLen ); SlowMA = ma(C , SlowLen ); if!(stime >= 033500 and stime <= 040000) then{ If CrossUp(FastMA , SlowMA) and index > 1 then { LEntryPrice = Highest(H , TrailBar )[1]; LCount = index; LongMaxRatio = FastMA * (1+((Ratio/100))); } If MarketPosition <> 1 AND index < LCount + ChLen AND LEntryPrice <= LongMaxRatio then Buy ("매수진입", atstop,LEntryPrice); If CrossDown(FastMA , SlowMA) and index > 1 then { SEntryPrice = Lowest(L , TrailBar )[1]; SCount = index; ShotMaxRatio = FastMA * (1-((Ratio/100))); } If MarketPosition <> -1 AND index < SCount + ChLen AND SEntryPrice > ShotMaxRatio then Sell ("매도진입", atstop,SEntryPrice ); } If MarketPosition == 1 then { LCount = -999; ExitLong ("매수청산", atstop, Lowest(L , TrailBar )); BH = highest(H,BarsSinceEntry); if BH >= EntryPrice*(1+최소수익1/100) Then ExitLong("bx1",AtStop,BH-(BH-EntryPrice)*(수익감소1/100)); } If MarketPosition == -1 then { SCount = -999; ExitShort ("매도청산", atstop, Highest(H , TrailBar )); BL = Lowest(L,BarsSinceEntry); if BL <= EntryPrice*(1-최소수익1/100) Then ExitShort("sx1",AtStop,BL+(EntryPrice-BL)*(수익감소1/100)); } SetStopLoss(stopPer, PercentStop); if sTime == 034800 Then { exitlong("장마감매수청산"); exitshort("장마감매도청산"); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-01-22 12:42:11

안녕하세요 예스스탁입니다. data2를 이용해 data1에 신호를 발생하게 작성해 드립니다. atstop이나 atlimit 신호타입은 지정한 가격과 data1의 현재가를 비교하므로 data2를 이용하면 해당 신호타입은 사용할수 없습니다. 모두 봉완성으로 작성을 해야 합니다. 아래 내용을 참고하시기 바랍니다. Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), stopPer(1.0), 최소수익1(0.4),수익감소1(20), Ratio(0.2); Var : FastMA(0,data2), SlowMA(0,data2),LEntryPrice(0,data2),SEntryPrice(0,data2),LCount(-999,data2),SCount(-999,data2); var : BH(0,data2),BL(0,data2), ShotMaxRatio(0,data2), LongMaxRatio(0,data2); var : HH(0,data2),LL(0,data2),H2(0,data1),L2(0,data1),EP(0,data1); FastMA = data2(ma(C,FastLen)); SlowMA = data2(ma(C,SlowLen)); HH = data2(Highest(H,TrailBar)); LL = data2(Lowest(L,TrailBar)); H2 = data2(H); L2 = data2(L); if data2(!(stime >= 033500 and stime <= 040000)) then { If data2(CrossUp(FastMA , SlowMA) and index > 1) then { LEntryPrice = HH[1]; LCount = data2(index); LongMaxRatio = FastMA * (1+((Ratio/100))); } If MarketPosition <> 1 AND data2(index > LCount and index < LCount + ChLen AND LEntryPrice <= LongMaxRatio and H >= LEntryPrice) then { Buy ("매수진입"); EP = max(O,LEntryPrice); } If data2(CrossDown(FastMA , SlowMA) and index > 1) then { SEntryPrice = LL[1]; SCount = data2(index); ShotMaxRatio = FastMA * (1-((Ratio/100))); } If MarketPosition <> -1 AND data2(index > SCount and index < SCount + ChLen AND SEntryPrice > ShotMaxRatio and L <= SEntryPrice) then { Sell ("매도진입"); EP = min(O,SEntryPrice); } } If MarketPosition == 1 then { LCount = -999; if data2(L <= LL[1]) Then ExitLong("매수청산"); BH = data1(highest(H2,BarsSinceEntry)); if data2(BH >= EP*(1+최소수익1/100) and L <= BH[1]-(BH[1]-EP)*(수익감소1/100)) Then ExitLong("bx1"); if data2(L <= EP*(1-stopPer/100)) Then ExitLong("bx2"); } If MarketPosition == -1 then { SCount = -999; if data2(H >= HH[1]) Then ExitShort ("매도청산"); BL = data1(Lowest(L2,BarsSinceEntry)); if BL <= EP*(1-최소수익1/100) and H >= BL[1]+(EP[1]-BL[1])*(수익감소1/100) Then ExitShort("sx1"); if data2(H >= EP*(1+stopPer/100)) Then ExitShort("sx2"); } if data1(sTime == 034800) Then { exitlong("장마감매수청산"); exitshort("장마감매도청산"); } 즐거운 명절 되시기 바랍니다. > 부동여산 님이 쓴 글입니다. > 제목 : 문의드립니다 > 모든 신호는 항생을 기준으로 하고 매수매도만 미니항생으로 해보려고 하는데 미니항생에 Data2를 불러와서 짜봐도 잘 되지 않습니다 아래식을 위 처럼 운용하려면 어떻게 식을 짜야하나요? Input: FastLen(10), SlowLen(500), ChLen(30), TrailBar(160), stopPer(1.0), 최소수익1(0.4),수익감소1(20), Ratio(0.2); Vars: FastMA(0), SlowMA(0),LEntryPrice(0), SEntryPrice(0), LCount(-999), SCount(-999), ReCnt(0), MP(0), BH(0),BL(0), ShotMaxRatio(0), LongMaxRatio(0); FastMA = ma(C , FastLen ); SlowMA = ma(C , SlowLen ); if!(stime >= 033500 and stime <= 040000) then{ If CrossUp(FastMA , SlowMA) and index > 1 then { LEntryPrice = Highest(H , TrailBar )[1]; LCount = index; LongMaxRatio = FastMA * (1+((Ratio/100))); } If MarketPosition <> 1 AND index < LCount + ChLen AND LEntryPrice <= LongMaxRatio then Buy ("매수진입", atstop,LEntryPrice); If CrossDown(FastMA , SlowMA) and index > 1 then { SEntryPrice = Lowest(L , TrailBar )[1]; SCount = index; ShotMaxRatio = FastMA * (1-((Ratio/100))); } If MarketPosition <> -1 AND index < SCount + ChLen AND SEntryPrice > ShotMaxRatio then Sell ("매도진입", atstop,SEntryPrice ); } If MarketPosition == 1 then { LCount = -999; ExitLong ("매수청산", atstop, Lowest(L , TrailBar )); BH = highest(H,BarsSinceEntry); if BH >= EntryPrice*(1+최소수익1/100) Then ExitLong("bx1",AtStop,BH-(BH-EntryPrice)*(수익감소1/100)); } If MarketPosition == -1 then { SCount = -999; ExitShort ("매도청산", atstop, Highest(H , TrailBar )); BL = Lowest(L,BarsSinceEntry); if BL <= EntryPrice*(1-최소수익1/100) Then ExitShort("sx1",AtStop,BL+(EntryPrice-BL)*(수익감소1/100)); } SetStopLoss(stopPer, PercentStop); if sTime == 034800 Then { exitlong("장마감매수청산"); exitshort("장마감매도청산"); }