Hello
I want to make an indicator based on two SMA, period 5 and 20, that shows an alert when all of these conditions are met:
-MA 5 has to cross over MA 20.
-Candle has to close AND cross over MA 5.
-Both MAs has to point to direction of closed candle (only enough, not straight up or straight down. if MA value of that candle is bigger than MA value before that candle means it points!)
These conditions should be calculated on the last closed candle, not the last one that is open.
The MAs don't need to be visible.
I found an indicator and made several adjustments. Now I need some help please. It's attached below.
Thank you!
Many questions. Draw a picture in the MetaTrader 5 terminal (a prerequisite - the background of the chart should be white).
Many questions. Draw a picture in the MetaTrader 5 terminal (a prerequisite - the background of the chart should be white).
Many questions, yes :)
What I need to know is this: How can I get MA-value from close-price of previous candlestick?
Why do I need to draw a picture?
Many questions, yes :)
What I need to know is this: How can I get MA-value from close-price of previous candlestick?
Why do I need to draw a picture?
You should get an iMA indicator handle (indicate that the price type is PRICE_CLOSE). It remains to get prices for the previous bar).
An example of working with iMA here: iMA
But I still recommend drawing a picture. Your first post contains many questions.

- www.mql5.com
Thank you Vladimir. I don't know much about MQL programming so I have only more question and then I think I can make it work: how can I get the MA-value of a specific bar? for example the 3rd bar.
You did not specify: Do you want to get from which program? (From the indicator or from the adviser)? If from the indicator - see the help above.
Perhaps this indicator is suitable for you: Two iMA Crossing Arrow

- www.mql5.com

- 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 want to make an indicator based on two SMA, period 5 and 20, that shows an alert when all of these conditions are met:
-MA 5 has to cross over MA 20.
-Candle has to close AND cross over MA 5.
-Both MAs has to point to direction of closed candle (only enough, not straight up or straight down. if MA value of that candle is bigger than MA value before that candle means it points!)
These conditions should be calculated on the last closed candle, not the last one that is open.
The MAs don't need to be visible.
I found an indicator and made several adjustments. Now I need some help please. It's attached below.
Thank you!