Just testing some code, and based on the current realtime price is higher or lower than the previous high or low I want to colour the forming bar (not bar[1]) but, it doesn't seem to work, what am I missing ?
//snippets of code
if (State == State.SetDefaults)
{
Description = "test";
Name = "test";
Calculate = Calculate.OnEachTick;
}
//add additional data sources
else if (State == State.Configure)
{
AddDataSeries(Instrument.FullName, BarsPeriodType.Day, 1); /// not used in this example,
AddDataSeries(Instrument.FullName, BarsPeriodType.Tick, 1); /// tick data for realtime prices
}
protected override void OnBarUpdate()
{
if(BarsInProgress == 2){
if( Closes[2][0]<Lows[0][1] ) BarBrushes[0] = Brushes.Magenta;
if( Closes[2][0]>Highs[0][1] ) BarBrushes[0] = Brushes.Lime;
}
}

Comment