Thread: MQL4 Learning
View Single Post
  #333 (permalink)  
Old 03-19-2008, 07:45 PM
Devil2000 Devil2000 is offline
Senior Member
 
Join Date: Dec 2005
Location: In front of my trading desk
Posts: 345
Devil2000 is on a distinguished road
Quote:
Originally Posted by Nudge View Post
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
What do you mean by "professional way"?
Every coder has a different logic and different way to code their ideas.
And the simpler is better! I think your code is quiet simple, I don't know how to make it simpler.
__________________
Need a professional MQL4 programmer? PM me
Reply With Quote