Download MetaTrader 5

how to check if last price is the highest on current bar

To add comments, please log in or register
Laurentiu Sorin Tene
692
Laurentiu Sorin Tene  

Hello,

I am new to MQL5 programming. 

I want to check if the last price (from MqlTick structure) is the highest on the current timeframe bar. I coded something like:

if (last_price.last=mrate[0].high) and I receive an warning "expression not boolean", which is very correct, but I have no other ideea how to code this. 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Chart Timeframes
Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Chart Timeframes
  • www.mql5.com
Standard Constants, Enumerations and Structures / Chart Constants / Chart Timeframes - Documentation on MQL5
Simon Gniadkowski
Moderator
18023
Simon Gniadkowski  
tenlau:

Hello,

I am new to MQL5 programming. 

I want to check if the last price (from MqlTick structure) is the highest on the current timeframe bar. I coded something like:

if (last_price.last=mrate[0].high) and I receive an warning "expression not boolean", which is very correct, but I have no other ideea how to code this. 

Try

if (last_price.last  ==  mrate[0].high)
Laurentiu Sorin Tene
692
Laurentiu Sorin Tene  
Thank you, it works!
To add comments, please log in or register