How to code the following indicator:
Indicator 2 = Indicator 1 Smoothed with X-Period EMA
Indicator 2 = Indicator 1 Smoothed with X-Period EMA
Rename
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript123 { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) { _rsi = RSI.Series(bars.Close, 10); _smoothedRsi = EMA.Series(_rsi, 5); PlotIndicatorLine(_rsi); PlotIndicatorLine(_smoothedRsi); } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { if (!HasOpenPosition(bars, PositionType.Long)) { //code your buy conditions here } else { //code your sell conditions here } } //declare private variables below RSI _rsi; EMA _smoothedRsi; } }
Okay. Thanks!
Crash2022, what games are you playing? I specifically pointed you by email to this topic and warned not to raise duplicate topics:
https://www.wealth-lab.com/Discussion/X-period-EMA-of-Indicator-in-C-code-8232
https://www.wealth-lab.com/Discussion/X-period-EMA-of-Indicator-in-C-code-8232
Your Response
Post
Edit Post
Login is required