Download MetaTrader 5

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

To add comments, please log in or register
Ask your broker to open the official channel. Thousands of traders will read the news!
Laurentiu Sorin Tene
692
Laurentiu Sorin Tene 2013.03.22 13:51 

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
18001
Simon Gniadkowski 2013.03.22 13:56  
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 2013.03.22 20:55  
Thank you, it works!
To add comments, please log in or register