I'm very new to coding and a bit of a copy and paster. But I wanted to ask if anyone could help with this.
I'm wanting to have a horizontal line plot globally at the EMA of the 5 min chart and change on bar close or each tick.
This is what I hacked to together. The line plots but doesn't move.
Thanks for any help.
James
EMA1_Color = Brushes.DodgerBlue;
Show_EMA1 = true;
EMA1_TimeFrame = 5;
EMA1_Period = 20;
}
else if (State == State.Configure)
{
AddDataSeries(Data.BarsPeriodType.Minute, (EMA1_TimeFrame)); //add our secondary data series for calculating the EMA
}
else if (State == State.DataLoaded)
{
EMA1 = EMA(BarsArray[1], (EMA1_Period)); //set EMA here so we make sure it's calculated on the secondary data series
}
}
protected override void OnBarUpdate()
{
if (CurrentBars[0] < 1 || CurrentBars[1] < 20 ) // make sure there's at least one bar for the primary series and at least 20 of the secondary series prior to processing
return;
if(BarsInProgress == 0) // if OnBarUpdate was called from the primary bar series, then set the current value to the latest EMA1 value
if
(Show_EMA1==true)
Draw.HorizontalLine(this, @"dyno1", false, EMA1[0], EMA1_Color, true);
{
Comment