Thank you deysmacro. I don't understand why, but it does work.
Edit: I take that back (not the thank you); I was checking more bars and noticed it was working more by coincidence.
This is not a good solution because at the beginning of a new bar, the direction will change and change.
Close > Close; up same problem
Close > Close - spread*Point ; up
Close > Open; up
((Close + Open)/2)> ((Close + Open)/2)
#define NEUTRAL 0
#define UP 1
#define DOWN 2
static double price;
I don't understand. How can comparing the current price with previous prices tell me whether or not the current bar is up or down. I don't want to know how it compares with previous bars; I just want to know if the current price (often called Last in other languages) is greater than or less than the current bar's Open.
I also tried using this function in the EA:
if(Open>Bid) return -1.0;
else if(Open<Bid) return 1.0;
else return 0.0;
It doesn't work either. All bars = 0.0;
I just realized what your code is doing. That seems to be working. Thanks!
Edit: I spoke too soon again. On closer examination, bars that are obviously down (Red on my chart) are sometimes classified as up bars and vice versa. Unfortunately, the discrepancies are not consistent.
To add comments, please log in or register