- ago
I don't understand the behaviour of RisingFalling Indicator in this case:

Why is the (IndicatorBase) cast necessary?

CODE:
public class MyStrategy : UserStrategyBase {       //Deere (DE) 22.04.2024 - 03.05.2024        //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) {                         TimeSeries indicator = new SMI(bars, 20);          TimeSeries smoothedIndi = new Gaussian(indicator, 13, 2);          PlotTimeSeries(smoothedIndi, "smoothedIndi", "3", WLColor.Green);          RisingFalling rs2 = new RisingFalling(bars, (IndicatorBase)smoothedIndi, HistoryScale.Daily);          PlotTimeSeries(rs2, rs2.Name, "4", WLColor.Black);           } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { } }


Examples:
Why is on 27.02.2024 the indicator -1?
Why is between 18.04.2024 and 22.04.2024 the indicator +1?



0
31
Solved
2 Replies

Reply

Bookmark

Sort
Cone8
 ( 13.35% )
- ago
#1
It's pretty clear by casual observation that you applied RisingFalling to bars.Close and not smoothedIndi
0
- ago
#2
I can't follow you, the syntax for RisingFalling is:
• RisingFalling(BarHistory source, TimeSeries indicator, HistoryScale scale)

and smoothedIndi is the indicator.

But anyway, this syntax is working:

CODE:
RisingFalling rs2 = new RisingFalling(bars, new IndOnInd(bars, new Gaussian(bars.Close, 13, 2), new SMI(bars, 20)), HistoryScale.Daily);


0
Best Answer

Reply

Bookmark

Sort