- Primary chart - tick based chart - say 1000 tick chart
- secondary series - 5 minute gets added as part of the code.
Flow:
- Calculate whether current time > 09:00 ( based on 5 minute chart ) and mark the bar(on primary) for which first tick is > 09:00. However the following code - doesn't work as expected due to the limitation of Ninja - where it always process primary series FIRST irrespective of the way the code is written.
Code:
#region Variables
private bool common=false;
private int endTime=090000;
#endregion
protected override void Initialize()
{
CalculateOnBarClose = false;
Overlay = true;
Add(PeriodType.Minute, 5);
}
protected override void OnBarUpdate()
{
if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired) return;
if (BarsInProgress == 1 && FirstTickOfBar && !common && ToTime(Time[1]) <= endTime && ToTime(Time[0]) > endTime)
{
common=true;
Print(Bars.Period + ":" + ToTime(Time[0]));
}
// Now is the condition is met - mark the color of the candle as blue
//- for this to work - the would expect the secondary series(5 minute) data to be
//processed first and then the primary as per this order
//- however - it doesn't work like that in Ninja ( irrespective of the code
//- it would always process primary first and then secondary series next
if (BarsInProgress == 0 && FirstTickOfBar && common)
{
common=false;
BarColorSeries[0] = Color.Blue;
Print(Bars.Period + ":" + ToTime(Time[0]));
}
}

Comment