I use an indicator and a strategy, each with 2 data series.
- Series 1 minute
- Series 5 seconds
And I want that with every bar, first the indicator and then the strategy is called.
I did read the documentation. This has not yet brought me.
The indicator was added to the strategy normally in the OnStateChange method.
Current status
Indikator OnBarUpdate()
if (0 == BarsInProgress)
{
}
else if (1 == BarsInProgress)
{
Print("Indicator " + Time[0] + " CurrentBar: " + CurrentBar + " (" + BarsInProgress + ")");
}
Strategy OnBarUpdate()
if (0 == BarsInProgress)
{
}
else if (1 == BarsInProgress)
{
// indikator Update
MyVariableIndicator.Update();
Print("Strategy " + Time[0] + " CurrentBar: " + CurrentBar + " (" + BarsInProgress + ")");
}
current result (Ninja Script output)
Indicator 15.06.2020 00:03:00 CurrentBar: 35 (1)
Indicator 15.06.2020 00:03:05 CurrentBar: 36 (1)
Indicator 15.06.2020 00:03:10 CurrentBar: 37 (1)
Indicator 15.06.2020 00:03:45 CurrentBar: 38 (1)
Indicator 15.06.2020 00:03:55 CurrentBar: 39 (1)
Strategy 15.06.2020 00:03:00 CurrentBar: 35 (1)
Strategy 15.06.2020 00:03:05 CurrentBar: 36 (1)
Strategy 15.06.2020 00:03:10 CurrentBar: 37 (1)
Strategy 15.06.2020 00:03:45 CurrentBar: 38 (1)
Strategy 15.06.2020 00:03:55 CurrentBar: 39 (1)
Indicator 15.06.2020 00:04:00 CurrentBar: 40 (1)
Indicator 15.06.2020 00:04:05 CurrentBar: 41 (1)
Indicator 15.06.2020 00:04:10 CurrentBar: 42 (1)
Indicator 15.06.2020 00:04:15 CurrentBar: 43 (1)
Indicator 15.06.2020 00:04:20 CurrentBar: 44 (1)
Indicator 15.06.2020 00:04:25 CurrentBar: 45 (1)
Indicator 15.06.2020 00:04:30 CurrentBar: 46 (1)
Indicator 15.06.2020 00:04:35 CurrentBar: 47 (1)
Indicator 15.06.2020 00:04:45 CurrentBar: 48 (1)
Indicator 15.06.2020 00:04:55 CurrentBar: 49 (1)
... etc
But i need
Indicator 15.06.2020 00:03:00 CurrentBar: 35 (1)
Strategy 15.06.2020 00:03:00 CurrentBar: 35 (1)
Indicator 15.06.2020 00:03:05 CurrentBar: 36 (1)
Strategy 15.06.2020 00:03:05 CurrentBar: 36 (1)
... etc
How can I achieve that with each bar, first the indicator and then the strategy is called?
Comment