I am coding a simple EA that I want to calculate the difference between the CLOSE of the previous bar and the Low or High of the current bar. As I use 1 min charts it sometimes gaps from the previous bars Close to the Open of the current bar. I therefore don't want it to just calculate the High and Low of the current bar.
In a nutshell I'm wanting to code the following:
- The Highest point from the Close of the previous 1 Min candle to the Close of the current candle.
- The Lowest point from the Close of the previous 1 Min candle to the Close of the current candle.
This is the code I need to amend as it simply takes the high and low of the 1 candle:
SwingHigh = iHigh(NULL, PERIOD_M1, ChartShift);
SwingLow = iLow(NULL, PERIOD_M1, ChartShift);
If that's not so easy I could look at taking the High and Low between a start and finish time if that's easier.
Help would be really appreciated.
In a nutshell I'm wanting to code the following:
- The Highest point from the Close of the previous 1 Min candle to the Close of the current candle.
- The Lowest point from the Close of the previous 1 Min candle to the Close of the current candle.
This is the code I need to amend as it simply takes the high and low of the 1 candle:
SwingHigh = iHigh(NULL, PERIOD_M1, ChartShift);
SwingLow = iLow(NULL, PERIOD_M1, ChartShift);
If that's not so easy I could look at taking the High and Low between a start and finish time if that's easier.
Help would be really appreciated.