커뮤니티

수식 문의

프로필 이미지
부똘이
2022-12-28 08:20:37
1416
글번호 164912
답변완료
항상 친절한 답변 감사드립니다. 일전 아래와 같은 수식을 도움 받았는데, 이에 추가하여, 연속으로 진입 신호가 나올 때 마다 진입의 수량을 마틴게일로 설정하고 싶습니다. 그 비율은 인풋값에서 입력가능토록 하고 싶습니다. (최초 진입수량은 1로 설정) 감사합니다. Input : Vector(14), Period(9), 매수선(50), 매도선(50); input : n(10),n1(10); Var : rsi_(0), rsi_signal(0) ; var : ll(0),hh(0),eh(0),el(0),BuyEntry(False),SellEntry(False); rsi_ = RSI(Period); rsi_signal = MA(RSI(Period), Vector); ll = lowest(l,n); hh = highest(h,n); if MarketPosition != 0 Then { if MarketPosition != MarketPosition[1] or CurrentContracts > CurrentContracts[1] Then { eh = hh; el = ll; } } BuyEntry = true; SellEntry = true; if MarketPosition == 0 Then { if MarketPosition(1) == 1 and (C > ll[BarsSinceEntry(1)]-PriceScale*n1 and C < HH[BarsSinceEntry(1)]+PriceScale*n1) Then BuyEntry = False; if MarketPosition(1) == -1 and (C > ll[BarsSinceEntry(1)]-PriceScale*n1 and C < HH[BarsSinceEntry(1)]+PriceScale*n1) Then SellEntry = False; } else { if MarketPosition == 1 and C > el-PriceScale*n1 and C < eh+PriceScale*n1 Then BuyEntry = false; if MarketPosition == -1 and C > el-PriceScale*n1 and C < eh+PriceScale*n1 Then SellEntry = false; } if rsi_signal < 매수선 && rsi_ > rsi_signal && rsi_[1] < rsi_signal[1] Then { if BuyEntry == true Then Buy(); } if rsi_signal > 매도선 && rsi_ < rsi_signal && rsi_[1] > rsi_signal[1] Then { if SellEntry == true Then Sell(); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-12-28 13:26:52

안녕하세요 예스스탁입니다. Input : Vector(14), Period(9), 매수선(50), 매도선(50),기본진입수량(1); input : n(10),n1(10); Var : rsi_(0), rsi_signal(0) ; var : ll(0),hh(0),eh(0),el(0),BuyEntry(False),SellEntry(False),vol(1); rsi_ = RSI(Period); rsi_signal = MA(RSI(Period), Vector); ll = lowest(l,n); hh = highest(h,n); if MarketPosition != 0 Then { if MarketPosition != MarketPosition[1] or CurrentContracts > CurrentContracts[1] Then { eh = hh; el = ll; } } BuyEntry = true; SellEntry = true; if MarketPosition == 0 Then { if MarketPosition(1) == 1 and (C > ll[BarsSinceEntry(1)]-PriceScale*n1 and C < HH[BarsSinceEntry(1)]+PriceScale*n1) Then BuyEntry = False; if MarketPosition(1) == -1 and (C > ll[BarsSinceEntry(1)]-PriceScale*n1 and C < HH[BarsSinceEntry(1)]+PriceScale*n1) Then SellEntry = False; } else { if MarketPosition == 1 and C > el-PriceScale*n1 and C < eh+PriceScale*n1 Then BuyEntry = false; if MarketPosition == -1 and C > el-PriceScale*n1 and C < eh+PriceScale*n1 Then SellEntry = false; } if rsi_signal < 매수선 && rsi_ > rsi_signal && rsi_[1] < rsi_signal[1] Then { if BuyEntry == true Then { if MarketPosition == 0 Then { if PositionProfit(1) >= 0 Then vol = 기본진입수량; Else vol = vol*2; } Else if MarketPosition == -1 Then { IF PositionProfit(0) >= 0 Then vol = 기본진입수량; Else vol = vol*2; } Buy("b",OnClose,def,vol); } } if rsi_signal > 매도선 && rsi_ < rsi_signal && rsi_[1] > rsi_signal[1] Then { if SellEntry == true Then { if MarketPosition == 0 Then { if PositionProfit(1) >= 0 Then vol = 기본진입수량; Else vol = vol*2; } Else if MarketPosition == 1 Then { IF PositionProfit(0) >= 0 Then vol = 기본진입수량; Else vol = vol*2; } Sell("s",OnClose,def,vol); } } 즐거운 하루되세요 > 부똘이 님이 쓴 글입니다. > 제목 : 수식 문의 > 항상 친절한 답변 감사드립니다. 일전 아래와 같은 수식을 도움 받았는데, 이에 추가하여, 연속으로 진입 신호가 나올 때 마다 진입의 수량을 마틴게일로 설정하고 싶습니다. 그 비율은 인풋값에서 입력가능토록 하고 싶습니다. (최초 진입수량은 1로 설정) 감사합니다. Input : Vector(14), Period(9), 매수선(50), 매도선(50); input : n(10),n1(10); Var : rsi_(0), rsi_signal(0) ; var : ll(0),hh(0),eh(0),el(0),BuyEntry(False),SellEntry(False); rsi_ = RSI(Period); rsi_signal = MA(RSI(Period), Vector); ll = lowest(l,n); hh = highest(h,n); if MarketPosition != 0 Then { if MarketPosition != MarketPosition[1] or CurrentContracts > CurrentContracts[1] Then { eh = hh; el = ll; } } BuyEntry = true; SellEntry = true; if MarketPosition == 0 Then { if MarketPosition(1) == 1 and (C > ll[BarsSinceEntry(1)]-PriceScale*n1 and C < HH[BarsSinceEntry(1)]+PriceScale*n1) Then BuyEntry = False; if MarketPosition(1) == -1 and (C > ll[BarsSinceEntry(1)]-PriceScale*n1 and C < HH[BarsSinceEntry(1)]+PriceScale*n1) Then SellEntry = False; } else { if MarketPosition == 1 and C > el-PriceScale*n1 and C < eh+PriceScale*n1 Then BuyEntry = false; if MarketPosition == -1 and C > el-PriceScale*n1 and C < eh+PriceScale*n1 Then SellEntry = false; } if rsi_signal < 매수선 && rsi_ > rsi_signal && rsi_[1] < rsi_signal[1] Then { if BuyEntry == true Then Buy(); } if rsi_signal > 매도선 && rsi_ < rsi_signal && rsi_[1] > rsi_signal[1] Then { if SellEntry == true Then Sell(); }