지표와 종목검색식 부탁 드립니다
트레이딩뷰의 상보강도(Relative Strength) 소스코드이며, RSI 아닙니다.비교 대상은 주가지수입니다예스트레이더에서 사용할 수 있도록 지표와 종목검색식 부탁드립니다indicator('Relative Strength', shorttitle='RS', timeframe='')comparativeTickerId = input.symbol('SPX', title='Comparative Symbol')lenght = input.int(50, minval=1, title='Period')showMA = input(defval=false, title='Show Moving Average')lenghtMA = input.int(10, minval=1, title='Moving Average Period')baseSymbol = request.security(syminfo.tickerid, timeframe.period, close)comparativeSymbol = request.security(comparativeTickerId, timeframe.period, close)hline(0, color=color.black, linestyle=hline.style_dotted)res = baseSymbol / baseSymbol[lenght] / (comparativeSymbol / comparativeSymbol[lenght]) - 1plot(res, title='RS', color=color.new(#1155CC, 0))sma_1 = ta.sma(res, lenghtMA)plot(showMA ? sma_1 : na, color=color.new(color.gray, 0))
수정 부탁드립니다.
참고차트는 일봉차트이고 기본차트는 60분봉 차트입니다. 에스문법에 맞지 않을 부분이 많을 건데 맞게끔 수정좀 부탁드립니다. Inputs: atr_crash(1.5), atr_vtrig(1.7), lookback_d(7); # 일봉 (Data2) 지표 및 변수 정의 vars: d_osc(0), r(0), entry_amt(0), d_atr_avg(0); # 장세 판단 변수 # r=2 진입 트리거 상세 변수 vars: v_sig(false), w_sig(false), d_res_h(0), d_bb_down(0);# 일봉 지표 계산 d_osc = Data2(MACD(10, 20, 6, 1)); d_atr_avg = Data2(avg(ATR(20), 60)); # 1. r = -2 (폭락장, 1계약 Short) if Data2(c) < Data2(ema(c, 50)) and d_osc < 0 and Data2(c) < Data2(ema(c, 200)) and Data2(ATR(20)) > d_atr_avg * atr_crash then { r = -2; entry_amt = 1; } # 2. r = 2 (고위험 반등장 / 1계약 Long 진입 허용) else if Data2(c) < Data2(ema(c, 50)) and d_osc > d_osc[1] and Data2(c) < Data2(ema(c, 200)) then { r = 2; entry_amt = 1; }if r = 2 then # 일봉 Regime 2가 선언될 때만 60분봉 진입 로직 실행 # V-자형 Trigger (공격형/투매 반전) d_res_h = Data2(Highest(H, lookback_d)); #일봉상 7봉전 이내중 atr*1.5보다 긴 음봉중 가장 긴 장대음봉의 고점-을 표현하는 함수로 수정좀 해주세요 d_bb_down = Data2(BollBandDown(20, 2)); if atr(20) > average(atr(20), 60) *atr_vtrig then { if c > d_res_h then { if Data2(c) > d_bb_down and barsSince(Data2(L) < d_bb_down, 3) <= 3 then { v_sig = true; } if macd(10, 20, 6, 1) > 0 then { w_sig = true; } (60분봉상) if v_sig or w_sig then { buy("r2long", entry_amt); } } # 최종 매수 실행
문의 드립니다.
안녕하세요 ~ 수고 많으십니다.아래의 1라인이 2라인을 돌파할때 종목 검색식 부탁 드립니다. 1라인 LinearRegressionvalue(C,5,0)+ LinearRegressionSlope(C,5)2라인 A=RSI(11);B=macd(9,18);D=macd(9,18)-eavg(macd(9,18),6);a1=crossup(A,30);a2=crossdown(A,70);b1=crossup(B,D);b2=crossdown(B,D);E=valuewhen(1,a1 or a2 or b1 or b2,o);wavg(e,2)*1.00382;감사합니다.
문의드립니다
수고하십니다. 수식부탁드립니다. 1. 총자금 1백만원 1.rsi oscillator bull 매수신호시 a%(10%)씩 매수한다. 매수신호날때마다 피라미딩매수.총매도회수 p(10)회차2. 1차매도 = 총잔액이 b%(5%,6%,7%. . . .) 상승시 일정량 c%(10%,20%.30%,40%..)매도한다 3. 2차매도 =1차매도후 총잔액이 1차+ d%(2%,3%,4%,5%)추가상승시 일정량 c%(10%,20%,30%,40%)매도한다4. 3차매도= 2차매도후 총잔액이 2차+d%(2%,3%,4%,5%) 추가상승시 일정량 c%(10,20,30,40%)매도 5차 6차 ......1차2차3차4차5차6차매도 또는 스토캐스틱과열시 전부매도한다.아래수식을참고하여부탁드립니다. value = data1(StochasticsK(Period,Period1)); If data1(CrossDown(value, 80)) Then Sell("S") 감사합니다
답변완료
문의 드립니다
input : P1(1),P2(2),P3(3);input : short1(1),long1(2),sig1(3);input : shor(1),long(2),sig(3);input : sho(1),lon(2),si(3);input : sho1(1),lon1(2),si1(3);input : evPeriod(1),Per(2);Input : Peri(1),OverSold(2); Input : Period(1), LPercent(2), SPercent(3);Input : ATRLen(1), ATRMin(2), ATRMax(3.0); Input : ATRStop(1.5), ATRTake(3.0); var : mav1(0),mav2(0),mav3(0);var : macdv1(0),macdv2(0),macdv3(0),macdv4(0), macds1(0),macds2(0),macds3(0),macds4(0);var : evup(0),evdn(0);Var : par1(0), par2(0);Var : ATRVal(0), allowVol(false);Var : stopPrice(0), takePrice(0);par1 = Disparity(Period);par2 = Disparity(Peri);mav1 = ma(C,P1);mav2 = ma(C,P2);mav3 = ma(C,P3);macdv1 = macd(short1,long1);macdv2 = macd(shor,long);macdv3 = macd(sho,lon);macdv4 = macd(sho1,lon1);macds1 = Ema(macdv1,sig1);macds2 = Ema(macdv2,sig);macds3 = Ema(macdv3,si);macds4 = Ema(macdv4,si1);evup = EnvelopeUp(evPeriod,Per);evdn = EnvelopeDown(evPeriod,Per);ATRVal = AvgTrueRange(ATRLen);allowVol = (ATRVal > ATRMin) and (ATRVal < ATRMax);if MarketPosition <= 0 and allowVol and CrossUp(macdv1,0) and macdv4 < 0 and macdv4 > macds4 and C < Evup and par1<LPercent Then{ Buy("b0",AtMarket);}if MarketPosition <= 0 and allowVol and macdv4 > macds4 and macdv1 > 0 and macdv4 < 0 and CrossDown(macdv3, 0) and C < Evup and par1<LPercent Then{ Buy("b1",AtMarket);}if MarketPosition <= 0 and allowVol and macdv4 > macds4 and macdv1 > 0 and macdv4 < 0 and CrossUp(macdv3,macds3) and C < Evup and par1<LPercent Then{ Buy("b2",AtMarket);}if allowVol and CrossDown(OverSold,par2 ) Then { Buy("BBB",AtMarket); }if MarketPosition == 1 and CrossDown(par1,LPercent ) Then{ ExitLong("st"); }if MarketPosition == 1 then begin stopPrice = EntryPrice(0) - ATRVal * ATRStop; takePrice = EntryPrice(0) + ATRVal * ATRTake; // ATR 손절 Sell("ATRStop") next bar at stopPrice stop; // ATR 익절 Sell("ATRTake") next bar at takePrice limit;end;기존 수식에 ATR 을 추가 하려니 문법이 틀리다고 나오네요. 수정 부탁 드립니다.