I have created a Multi Timeframe strategy which is running on a 1 Tick chart and has conditions based on an indicator which is running on a different PeriodType.
The strategy is set to Calculate On Bar Close = False, but the indicator running on the different PeriodType in BarsArray[1] seems to be Calculating On Bar Close = True.
Below I will provide the script I have right now, perhaps someone could assist me in finding the issue.
protected override void Initialize()
{
CalculateOnBarClose = false;
Add(Indicator(Type, Period));
Add(Indicator(Type, Period));
Add(PeriodType.Custom9, 20);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (Indicator(BarsArray[1], Type, Period).Diff[0] > 0
&& CurrentBar!=savedLongBar
&& ToTime(Time[0]) >= ToTime(0, 5, 0)
&& ToTime(Time[0]) <= ToTime(21, 55, 0)
&& Closes[1][0] > Opens[1][0] +17*TickSize)
{
EnterLong(DefaultQuantity, "L");
savedLongBar = CurrentBar;
}
So the problem is that the indicator running on the added PeriodType still Calculates On Bar Close = True. Perhaps it has to do with the "savedLongBar" methods, something that I also would like to run on the added PeriodType.
Comment