Data from indicator to robot

Created at 14 Nov 2013, 15:00
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
jeex's avatar

jeex

Joined 18.10.2013

Data from indicator to robot
14 Nov 2013, 15:00


Completely puzzled here. I have an indicator that draws a very simple bar in the bottom.

The robot gets iets values from that bar with:

protected override void OnStart() 
_massa = Indicators.GetIndicator<MasterAndSlavesRobot>(__FormingBars, __ExpireBars, __MinMasterLength, __MinBoLenght, __EmaPeriods);
}
protected override void OnBar()
{ 
            if (_massa.EnterLine.LastValue != 0)
                Print(MooieDatum(MarketSeries.OpenTime.LastValue) + " = " + _massa.EnterLine.LastValue);
}

But the values shown bij the Print command seem to be completely at random and do not match the visual indicator as shown in the picture. It should only give a value -1, or 1 when the dark line below bounces of the 0-line.

Is this a backtesting bug, am i forgetting something?

 


@jeex
Replies

Spotware
15 Nov 2013, 11:36

Most probably that the problem is that you take last value in OnBar method. This method is called when the first tick of new bur came so the last value is not value of the completed bar, but value of newly created bur with only one tick. Please try ro print previous value.


@Spotware