I needed a little help on a step for a strategy I'm currently developing.
The strategy involves hardcoding some price levels into the where i'd like to take profit. The data required for the lines is the high low and close, for the previous day, 2 days before and 3 days before. Also, I don't want it to be a rolling 3 days, which I guess could be done be specifying the number of bars in 24 hours and using the MAX() and MIN() functions. I shall include the code of what I have tried to solve below, however I keep getting 'an object reference is required' error.
The code I have tried to run so far is:
public double d1p = (Bars.GetDayBar(1).High + Bars.GetDayBar(1).Low + Bars.GetDayBar(1).Close)/3;
public double d2p = (Bars.GetDayBar(2).High + Bars.GetDayBar(2).Low + Bars.GetDayBar(2).Close)/3;
public double d3p = (Bars.GetDayBar(3).High + Bars.GetDayBar(3).Low + Bars.GetDayBar(3).Close)/3
Any help is much appreciated!
Comment