커뮤니티

수식 전환 부탁드립니다

프로필 이미지
seayun1
2023-04-14 23:25:46
1272
글번호 168200
답변완료
안녕하세요 항상 감사드립니다 아래수식 전환부탁드립니다 study("RB_ReversalTabs", overlay=true) //Developer: Andrew Palladino //Owner: Rob Booker //Date Modified: 11/25/2018 macd_fast_period = input(title="MACD Fast Period", defval=12, type=integer) macd_slow_period = input(title="MACD Slow Period", defval=26, type=integer) macd_signal_period = input(title="MACD Signal Period", defval=9, type=integer) stoch_period = input(title="Stochastic RSI Period", defval=70, type=integer) prc_k_period = input(title="%K Period", defval=30, type=integer) prc_d_period = input(title="%D Period", defval=30, type=integer) stoch_ob = input(title="Stochastic Overbought Level", defval=70, type=integer) stoch_os = input(title="Stochastic Oversold Level", defval=30, type=integer) [macd_line, signal_line, hist_line] = macd(close, macd_fast_period, macd_slow_period, macd_signal_period) fast_prc_k = 100*(close - lowest(low, stoch_period))/(highest(high, stoch_period) - lowest(low, stoch_period)) fast_prc_d = sma(fast_prc_k, prc_d_period) slow_prc_k = sma(fast_prc_k, prc_k_period) slow_prc_d = sma(slow_prc_k, prc_d_period) full_prc_k = sma(fast_prc_k, prc_k_period) full_prc_d = sma(full_prc_k, prc_d_period) is_buy_reversal = crossover(macd_line, 0) and full_prc_k < stoch_os is_sell_reversal = crossunder(macd_line, 0) and full_prc_k > stoch_ob plotshape(is_buy_reversal, style=shape.triangleup, color=green, size=size.small, location=location.belowbar) plotshape(is_sell_reversal, style=shape.triangledown, color=red, size=size.small, location=location.abovebar) alertcondition(is_buy_reversal, title='Buy Reversal Tab Alert', message='Reversal Tab BUY ALERT!') alertcondition(is_sell_reversal, title='Sell Reversal Tab Alert', message='Reversal Tab SELL ALERT!') alertcondition(is_sell_reversal or is_buy_reversal, title='Buy or Sell Reversal Tab Alert', message='Reversal Tab BUY OR SELL ALERT!') //plot(full_prc_k, color=blue) //plot(full_prc_d, color=red) //plot(macd_line, color=blue)
검색
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-04-17 08:45:20

안녕하세요 예스스탁입니다. input : macd_fast_period(12),macd_slow_period(26),macd_signal_period(9); input : stoch_period(70),prc_k_period(30),prc_d_period(30),stoch_ob(70),stoch_os(30); var : macd_line(0),signal_line(0),hist_line(0); var : fast_prc_k(0),fast_prc_d(0); var : slow_prc_k(0),slow_prc_d(0); var : full_prc_k(0),full_prc_d(0); var : is_buy_reversal(False),is_sell_reversal(False),tx(0); macd_line = macd(macd_fast_period, macd_slow_period); signal_line = Ema(macd_line,macd_signal_period); hist_line = macd_line-signal_line; fast_prc_k = 100*(close - lowest(low, stoch_period))/(highest(high, stoch_period) - lowest(low, stoch_period)); fast_prc_d = ma(fast_prc_k, prc_d_period); slow_prc_k = ma(fast_prc_k, prc_k_period); slow_prc_d = ma(slow_prc_k, prc_d_period); full_prc_k = ma(fast_prc_k, prc_k_period); full_prc_d = ma(full_prc_k, prc_d_period); is_buy_reversal = CrossUp(macd_line, 0) and full_prc_k < stoch_os; is_sell_reversal = CrossDown(macd_line, 0) and full_prc_k > stoch_ob; if is_buy_reversal Then { tx = Text_New(sdate,stime,L,"▲"); Text_SetColor(tx,Green); Text_SetStyle(tx,2,0); } if is_sell_reversal Then { tx = Text_New(sdate,stime,H,"▼"); Text_SetColor(tx,Red); Text_SetStyle(tx,2,1); } plot1(full_prc_k,"full_prc_k",blue); plot2(full_prc_d,"full_prc_d",red); plot3(macd_line,"macd_line",blue); 즐거운 하루되세요 > seayun1 님이 쓴 글입니다. > 제목 : 수식 전환 부탁드립니다 > 안녕하세요 항상 감사드립니다 아래수식 전환부탁드립니다 study("RB_ReversalTabs", overlay=true) //Developer: Andrew Palladino //Owner: Rob Booker //Date Modified: 11/25/2018 macd_fast_period = input(title="MACD Fast Period", defval=12, type=integer) macd_slow_period = input(title="MACD Slow Period", defval=26, type=integer) macd_signal_period = input(title="MACD Signal Period", defval=9, type=integer) stoch_period = input(title="Stochastic RSI Period", defval=70, type=integer) prc_k_period = input(title="%K Period", defval=30, type=integer) prc_d_period = input(title="%D Period", defval=30, type=integer) stoch_ob = input(title="Stochastic Overbought Level", defval=70, type=integer) stoch_os = input(title="Stochastic Oversold Level", defval=30, type=integer) [macd_line, signal_line, hist_line] = macd(close, macd_fast_period, macd_slow_period, macd_signal_period) fast_prc_k = 100*(close - lowest(low, stoch_period))/(highest(high, stoch_period) - lowest(low, stoch_period)) fast_prc_d = sma(fast_prc_k, prc_d_period) slow_prc_k = sma(fast_prc_k, prc_k_period) slow_prc_d = sma(slow_prc_k, prc_d_period) full_prc_k = sma(fast_prc_k, prc_k_period) full_prc_d = sma(full_prc_k, prc_d_period) is_buy_reversal = crossover(macd_line, 0) and full_prc_k < stoch_os is_sell_reversal = crossunder(macd_line, 0) and full_prc_k > stoch_ob plotshape(is_buy_reversal, style=shape.triangleup, color=green, size=size.small, location=location.belowbar) plotshape(is_sell_reversal, style=shape.triangledown, color=red, size=size.small, location=location.abovebar) alertcondition(is_buy_reversal, title='Buy Reversal Tab Alert', message='Reversal Tab BUY ALERT!') alertcondition(is_sell_reversal, title='Sell Reversal Tab Alert', message='Reversal Tab SELL ALERT!') alertcondition(is_sell_reversal or is_buy_reversal, title='Buy or Sell Reversal Tab Alert', message='Reversal Tab BUY OR SELL ALERT!') //plot(full_prc_k, color=blue) //plot(full_prc_d, color=red) //plot(macd_line, color=blue)