Help adjust this indicator

 

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!

Files:
 
marketcycle17 :

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).

 
Vladimir Karputov:

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?

 
marketcycle17 :

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.

Documentation on MQL5: Technical Indicators / iMA
Documentation on MQL5: Technical Indicators / iMA
  • www.mql5.com
//|                                                     Demo_iMA.mq5 | //|                        Copyright 2011, MetaQuotes Software Corp. | //|                                              https://www.mql5.com | "The method of creation of the handle is set through the 'type' parameter (function type...
 
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.
 
marketcycle17 :
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

Two iMA Crossing Arrow

Two iMA Crossing Arrow
Two iMA Crossing Arrow
  • www.mql5.com
Индикатор на базе стиля рисования DRAW_COLOR_ARROW. Содержит два индикаторных буфера: '0' - буфер значков (если в этом буфере значение отличное от '0.0' - значит это сигнал '1' - буфер цвета значков (может принимать значение '0.0' или '1.0', имеет смысл проверять только если в буфере '0' есть сигнал) Индикатор ищет пересечение двух iMA...
 
Your advice was helpful about the iMA, now I made my customized indicator. However the one you posted is good, I might use it too. Thank you for your help!
Reason: