Wondering how to add the ema 9 (Signal line) to the MACD chart attached?
How to delete and/or modify an Indicator within a chart without going to the Code Editor?
How to delete and/or modify an Indicator within a chart without going to the Code Editor?
Rename
The signal line is simply the EMA9 of the MACD itself. See the computation of signal9 in the code below.
But in practice, you only care about the "difference" between the MACD and the signal9 line, and that difference is what MACDHist returns. Notice how the blue dots corresponding to the computed difference is superimposed exactly on the MACDHist line in the screenshot.
Bottom line, if you have the MACDHist line, then you don't need the signal9 line because it's their difference that really matters.

You can modify/edit drag-and-drop indicators from the Chart. But you cannot modify indicators created by C# code. If you want to modify indicators from the Chart, I would create "indicators sets" that are modifiable. See the Help docs under "indicator sets".
But in practice, you only care about the "difference" between the MACD and the signal9 line, and that difference is what MACDHist returns. Notice how the blue dots corresponding to the computed difference is superimposed exactly on the MACDHist line in the screenshot.
Bottom line, if you have the MACDHist line, then you don't need the signal9 line because it's their difference that really matters.
CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; namespace WealthScript1 { public class MyStrategy : UserStrategyBase { public override void Initialize(BarHistory bars) { IndicatorBase macd = MACDClassic.Series(bars.Close); IndicatorBase signal9 = EMA.Series(macd, 9); PlotIndicator(macd); PlotIndicator(signal9, paneTag: macd.PaneTag); IndicatorBase macdHist = MACDHist.Series(bars.Close, 12, 26, 9); TimeSeries macdSignal9Diff = macd - signal9; PlotIndicatorHistogramTwoColor(macdHist,paneTag: "MACDHist"); PlotTimeSeries(macdSignal9Diff, "MACD signal diff", "MACDHist", plotStyle: PlotStyle.Dots); } public override void Execute(BarHistory bars, int idx) { } } }
You can modify/edit drag-and-drop indicators from the Chart. But you cannot modify indicators created by C# code. If you want to modify indicators from the Chart, I would create "indicators sets" that are modifiable. See the Help docs under "indicator sets".
Thanks superticker.
Your Response
Post
Edit Post
Login is required