Thread: MQL4 Learning
View Single Post
  #332 (permalink)  
Old 03-19-2008, 02:26 PM
Nudge Nudge is offline
Junior Member
 
Join Date: Mar 2008
Location: Australia
Posts: 9
Nudge is on a distinguished road
Find Trend based on last 2 bars

Hi all,

I'm just learning MQL and would like to know the easiest way to find out if a trend is going long or short based on the last 2 bars.

For example, if the close price is 1.2345 for Close[2] and the close price is 1.2350 for Close[1], and the current Close price is 1.2360 for Close[0].

Would I do something like

if(Close[2] < Close[1] && Close[1] < Close[0]) {

}

and do the same for a down trend but reversed

Or is there a more professional way to do it.

Thanks for your help
Nudge
Reply With Quote