I compare current, previous Bar heights, high, low, open, close.
The result is always negative, despite the candle direction. Have tried int, char data types.
Is it MT5 bug ?
Why negative symbol appears in both directions ?
you need to be clearer about what you are saying, maybe attached your code and show the output..
int OnInit() { return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { ObjectDelete(0,"Label5"); } void PutLabel(string name,string text,int x,int y,color clr) { ObjectDelete(0,name); ObjectCreate(0,name,OBJ_LABEL,0,0,0); ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x); ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y); ObjectSetInteger(0,name,OBJPROP_CORNER,CORNER_RIGHT_UPPER); ObjectSetString(0,name,OBJPROP_TEXT,text); ObjectSetString(0,name,OBJPROP_FONT,"Arial"); ObjectSetInteger(0,name,OBJPROP_FONTSIZE,12); ObjectSetInteger(0,name,OBJPROP_COLOR,clr); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int barHighLow=0; int high1 = iHigh(Symbol(), PERIOD_M1,0); int low1 = iLow(Symbol(), PERIOD_M1,0); barHighLow=low1-high1; PutLabel("Label5"," lowhigh: "+(int)NormalizeDouble(barHighLow,10)+" $ ",150,30,Yellow); return(rates_total); }
you need to be clearer about what you are saying, maybe attached your code and show the output..
I have uploaded the code.
you need to change the variables to double instead of int
you need to take the low from the high instead of the high from the low
you need to change the variables to double instead of int
you need to take the low from the high instead of the high from the low
well if you want it to represent bear/bull you need to change your logic.
check if the Close is > Open
if yes High - Low gives positive for a bull bar
if no Low - High gives a negative for a bear bar
well if you want it to represent bear/bull you need to change your logic.
check if the Close is > Open
if yes High - Low gives positive for a bull bar
if no Low - High gives a negative for a bear bar
Has nothing to do with "MT5 peculiarities." That is reality. The high is always greater or equal to the low. Therefor high-low will always be
positive.
Has nothing to do with "MT5 peculiarities." That is reality. The high is always greater or equal to the low. Therefor high-low will always be
positive.
I have uploaded the code.
As already said by other people, High will be always greater than Low.
High is the maximum of the candle, Low the minimum. How can maximum be less than minimum?!
High-Low will be always positve.
Low-High will be always negative.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I compare current, previous Bar heights, high, low, open, close.
The result is always negative, despite the candle direction. Have tried int, char data types.
Is it MT5 bug ?
Why negative symbol appears in both directions ?