
ایده من این است که هیستوگرام MACD را در محدوده 0-100 درست مانند RSI نوسان کنید. من این کار را با موفقیت انجام دادم ، اما در مقایسه با هیستوگرام معمولی MACD ، دیدن آن بسیار کم و سخت است زیرا اکثر مقادیر فقط کمی بالاتر از یا پایین تر از 50 هستند. تصویر مقایسه باند MACD (MACD. B - بالاتر) و MACD کلاسیک (در زیر). من می خواهم خط MACD و هیستوگرام در یک محدوده بزرگتر (از 0 تا 100) نوسان داشته باشد ، لطفاً به من بگویید که چگونه. خیلی ممنون. در زیر کد فعلی است.
//@version=5 //NhanTam indicator(title='MACD in BANDS', shorttitle='MACD.B', timeframe='') // Getting inputs fast_len = input(title='Fast Length', defval=12, inline='1') slow_len = input(title='Slow Length', defval=26, inline='1') signal_length = input.int(title='Signal Len:', minval=1, maxval=200, defval=9, inline='3') src = input(title='Input source', defval=close, inline='3') ma_type = input.string(title='Type MA : :', defval='E-MA', options=['SMA', 'E-MA'], inline='4') signal_type = input.string(title='Signal : : : : :', defval='E-MA', options=['SMA', 'E-MA'], inline='4') // MACD Plot colors height = input.int(50, 'Col height', options=[50,60,70,80,90], group='Histogram', tooltip='Column height, default value is 50') colmacd = input.color(#2962FF, 'MACD Line:', group='Histogram', inline='ma') colsign = input.color(#FF6D00, 'Sig:', group='Histogram', inline='ma', tooltip='MACD Line and Signal Line') col1 = input.color(#26A69A, 'Above Grow', group='Histogram', inline='ab') col2 = input.color(#B2DFDB, 'Fall', group='Histogram', inline='ab') col3 = input.color(#FFCDD2, 'Below Grow', group='Histogram', inline='be') col4 = input.color(#FF5252, 'Fall', group='Histogram', inline='be') // MACD Calculating fast_ma = ma_type == 'SMA' ? ta.sma(src, fast_len) : ta.ema(src, fast_len) slow_ma = ma_type == 'SMA' ? ta.sma(src, slow_len) : ta.ema(src, slow_len) macd = (fast_ma*height)/slow_ma sign = signal_type == 'SMA' ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length) hist = (macd*height)/sign // Plot plot(hist, title='Histogram', style=plot.style_columns, histbase=50, color=hist>= قد؟HIST [1]
دنبال کردن nqhai از 14 مه 2022 در 3:51 پرسید nqhai nqhai 33 5 5 نشان های برنز این را بررسی کنید: tradingview. com/script/s9rjmorz-macd-scaled 14 مه 2022 در 7:10 Vitruvius بسیار متشکرممن آن را تماشا کردم ، بیش از آنچه انتظار داشتم کار می کند و بسیار خوب است. 14 مه 2022 در ساعت 14:31 Vitruvius من کد خود را کامل کرده ام: tradingview. com/script/hrau0e. دوباره متشکرم 15 مه 2022 در 3:53
1 پاسخ 1
مرتب شده توسط: تنظیم مجدد به طور پیش فرض
من کد خود را تمام کردم.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © NhanTam // @version=5 indicator(title='MACD BAND', shorttitle='MACD Band', precision=3, timeframe='', timeframe_gaps=true) // Getting inputs fast_length = input.int(12, 'Fast Length', minval=6, maxval=19, tooltip='Default 12') slow_length = input.int(26, 'Slow Length', minval=19, maxval=39, tooltip='Default 26') src = input.source(close, 'Source') signal_length = input.int(9, 'Signal Smoothing', minval=1, maxval=50) ma_source = input.string('EMA', 'Oscillator MA Type', options=['SMA', 'EMA', 'WMA', 'RMA', 'HMA', 'ALMA', 'VWMA'], tooltip='Normally uses EMA') ma_signal = input.string('EMA', 'Signal Line MA Type', options=['SMA', 'EMA', 'WMA', 'RMA', 'HMA', 'ALMA', 'VWMA'], tooltip='Normally uses EMA') // Input color col_macd = input.color(#2962FF, 'MACD Line', group='Histogram', inline='1') showMACD = input.bool(true, 'Show', group='Histogram', inline='1') col_sign = input.color(#FF6D00, 'Signal Line:', group='Histogram', inline='2') showMACDSignal = input.bool(true, 'Show', group='Histogram', inline='2') col_grow_above = input.color(#26A69A, 'Above grow', group='Histogram', inline='3') col_fall_above = input.color(#B2DFDB, 'Fall', group='Histogram', inline='3') col_grow_below = input.color(#FFCDD2, 'Below grow', group='Histogram', inline='4') col_fall_below = input.color(#FF5252, 'Fall', group='Histogram', inline='4') showMACDHistogram = input.bool(true, 'Show Histogram', group='Histogram') histo_trans = input.int(30, 'Hist transparent', minval=0, maxval=100, group='Histogram', tooltip='Histogram transparency, Default 30') lowcolumn = input.int(10, 'Columns Low', minval=2, maxval=20, group='Histogram', tooltip='Default 10. Min = 2, max = 20. The larger the number, the lower the Histogram height.') lowline = input.int(5, 'Line Low', minval=2, maxval=20, group='Histogram', tooltip='Default 5. Min = 2, max = 20. The larger the number, the lower the height of the MACD line and the Signal line.') // MACD Calculating shortMA = ma_source == 'SMA' ? ta.sma(src, fast_length) : ma_source == 'EMA' ? ta.ema(src, fast_length) : ma_source == 'WMA' ? ta.wma(src, fast_length) : ma_source == 'RMA' ? ta.rma(src, fast_length) : ma_source == 'HMA' ? ta.hma(src, fast_length) : ma_source == 'ALMA' ? ta.alma(src, fast_length, 0.85, 6) : ma_source == 'VWMA' ? ta.vwma(src, fast_length) : ta.ema(src, fast_length) longMA = ma_source == 'SMA' ? ta.sma(src, slow_length) : ma_source == 'EMA' ? ta.ema(src, slow_length) : ma_source == 'WMA' ? ta.wma(src, slow_length) : ma_source == 'RMA' ? ta.rma(src, slow_length) : ma_source == 'HMA' ? ta.hma(src, slow_length) : ma_source == 'VWMA' ? ta.vwma(src, slow_length) : ma_source == 'ALMA' ? ta.alma(src, slow_length, 0.85, 6) : ta.ema(src, slow_length) macdLine = shortMA - longMA signalLine = ma_signal == 'SMA' ? ta.sma(macdLine, signal_length) : ma_signal == 'EMA' ? ta.ema(macdLine, signal_length) : ma_signal == 'WMA' ? ta.wma(macdLine, signal_length) : ma_signal == 'RMA' ? ta.rma(macdLine, signal_length) : ma_signal == 'HMA' ? ta.hma(macdLine, signal_length) : ma_source == 'VWMA' ? ta.vwma(macdLine, signal_length) : ma_signal == 'ALMA' ? ta.alma(macdLine, signal_length, 0.85, 6) : ta.ema(macdLine, signal_length) hist = macdLine - signalLine // Re-Calculating MACD midline = 50 sd_hist = ta.stdev(hist, 500) basis_hist = ta.ema(hist, 500) up_hist = basis_hist + sd_hist * lowcolumn dn_hist = basis_hist - sd_hist * lowcolumn re_hist = (hist - dn_hist) / (up_hist - dn_hist) * 100 sd_sig = ta.stdev(signalLine, 500) basis_sig = ta.ema(signalLine, 500) up_sig = basis_sig + sd_sig * lowline dn_sig = basis_sig - sd_sig * lowline rescaled_sig = (signalLine - dn_sig) / (up_sig - dn_sig) * 100 sd_mac = ta.stdev(macdLine, 500) basis_mac = ta.ema(macdLine, 500) up_mac = basis_mac + sd_mac * lowline dn_mac = basis_mac - sd_mac * lowline rescaled_mac = (macdLine - dn_mac) / (up_mac - dn_mac) * 100 // Plot histLineCol = hist>= 0؟HIST [1] < SPAN> گروه MACD را در TradingView ایجاد کنید
کسب درآمد از بیت کوین...
ما را در سایت کسب درآمد از بیت کوین دنبال می کنید
برچسب :
نویسنده : ماهور الوند
بازدید : <-PostHit->
تاريخ : چهارشنبه
15 شهريور
1402 ساعت: 2:06