The code looks like below under OnBarUpdate() method. The indicator is to trade ES and I am trying to chart to the value of 'risk1' as defined in the formula below. But for some reason when I chart this indicator, I get no values.
I have 'risk' and 'risk1' defined as DataSeries and also added in Initialize area.
{
if ((SMA(34)[0] > DEMA(500)[0]))
{
risk.Set(High[0] - (DEMA(500)[0] - 8 * TickSize));
}
int barsAgo = MRO(delegate {return (CrossAbove(SMA(34),DEMA(500),0));}, 1, 500);
if (barsAgo > -1)
risk1.Set(risk[barsAgo]);
Value.Set(risk1[0]);
}
I am not sure why the code is not working. I do not get any error while compiling either.
Can someone help please? I appreciate any assistance or direction you can provide.
Comment