Hello,
I am writing an EA but I am beginner in MQL4. Please suggest me how could I identify a DOWN TREND or an UP TREND of moving average in my EA programmatically?
Please advise me as I have not so familiar with MQL4.
By the cross of MA.
Have a look at the following links:
- https://www.mql5.com/en/code/8463
- https://www.mql5.com/en/code/7438
- https://www.mql5.com/en/search#!keyword=MA%20cross&module=mql5_module_codebase
- www.mql5.com
By the cross of MA.
Have a look at the following links:
- https://www.mql5.com/en/code/8463
- https://www.mql5.com/en/code/7438
- https://www.mql5.com/en/search#!keyword=MA%20cross&module=mql5_module_codebase
I am not using cross of MA.
Actually I am trying to used Heiken Ashi & Moving Average for my EA. First I want to know about the Trend of MA. So I would like to know how could I get this identify that currently MA is in up or down trend or it is moving in horizontal direction.
Please review attach image in that image MA line is moving horizontal almost straight not is up direction not in down direction how could identify in mql4 up, down and this trend that image is showing?
I exactly want know in EA that weather it is a up trend or down trend. I am beginner please let me know.
Thank you in advance.
Heiken Ashi == Moving average.
So if you want the trend direction then it's:
if(Moving_average_bar_0 > Moving_average_bar_1) { // Direction = Long; } else if(Moving_average_bar_0 < Moving_average_bar_1) { // Direction = Short; }
You mean to say like this:
//MA double H4EMA = iMA(_Symbol, PERIOD_H4, 10, 0, MODE_EMA, PRICE_CLOSE, 0); //Heiken Ashi double HALow = iCustom(NULL,0, "Heiken Ashi", color1, color2, color3, color4, HALOW, 0); double HAHigh = iCustom(NULL,0, "Heiken Ashi", color1, color2, color3, color4, HAHIGH, 0); double HAOpen = iCustom(NULL,0, "Heiken Ashi", color1, color2, color3, color4, HAOPEN, 0); double HAClose = iCustom(NULL,0, "Heiken Ashi", color1, color2, color3, color4, HACLOSE, 0); if(H4EMA > HAClose) { // Direction = Long; // THIS MEANS UP TREND????? } else if(H4EMA < HAClose) { // Direction = Short; // THIS MEAN DOWN TREND???? }
Did understand you correctly? Please verify.
thanks in advance.
No i did not mean that.
Heiken ashi is a visualization technique to 'cheat' your eyes.
There is no use in trying to automate it as a strategy it will be similar to a moving average:
if(Moving_average_bar_0 > Moving_average_bar_1) { // Direction = Long; } else if(Moving_average_bar_0 < Moving_average_bar_1) { // Direction = Short; }
If the last bar is above the previous last bar your direction is long.
If the last bar is below the previous last bar, your direction is short.
You only need one moving average for that, and no Heken Ashi.
Hello,
I am writing an EA but I am beginner in MQL4. Please suggest me how could I identify a DOWN TREND or an UP TREND of moving average in my EA programmatically?
Please advise me as I have not so familiar with MQL4.
How about Moving Average angle? I don't know much about it, though.
You can get the slope from a trendline or moving average. Delta price / delta time. Changing the axes scales changes the apparent angle, the slope is constant. Angle is meaningless.
An angle requires distance divided by distance; a unitless number. A chart has price/time. What is the angle of going 30 miles in 45 minutes? Meaningless!
You can get the slope from a trendline or moving average. Delta price / delta time. Changing the axes scales changes the apparent angle, the slope is constant. Angle is meaningless.
I found you posted a nice code that is very helpful to OP here (Slope of a moving average) :
https://www.mql5.com/en/forum/152085
OP should check it :)
- 2014.06.23
- www.mql5.com
No i did not mean that.
Heiken ashi is a visualization technique to 'cheat' your eyes.
There is no use in trying to automate it as a strategy it will be similar to a moving average:
If the last bar is above the previous last bar your direction is long.
If the last bar is below the previous last bar, your direction is short.
You only need one moving average for that, and no Heken Ashi.
I love the colors on your Heikin Ashi example chart, haha.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I am writing an EA but I am beginner in MQL4. Please suggest me how could I identify a DOWN TREND or an UP TREND of moving average in my EA programmatically?
Please advise me as I have not so familiar with MQL4.