- ago
How to code the following indicator:
Indicator 2 = Indicator 1 Smoothed with X-Period EMA
0
242
3 Replies

Reply

Bookmark

Sort
Cone8
 ( 28.25% )
- ago
#1
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; } }
1
- ago
#2
Okay. Thanks!
0
- ago
#3
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
0

Reply

Bookmark

Sort