How to start with MQL5 - page 24

 
Ahmad861 :

I have tried to ask this on another article but it seems that no one was able to answer it. I will be using 2 bollinger bands. 2.5 and 1.0 deviations, i will check if the close of the first candle is above the 2.5 bollinger band and i have set a loop going from 5 to 50. This loop will check if any of the closes from close[5] to close[5] is above the 2.5 bollinger band. The part im having a hard time trying to put are these 2 conditions

1. All the candles between close[1] and candle loop 5-50 must be above a certain bollinger band deviation.

2. Atleast one candle should be below a certain level

I'll give an example with a picture below

You can see here close[1] is above 2.5 bollinger band and running through the candle loop we see that close[23] closes above 2.5 band. The blue bollinger band is a 1.0 deviation and as you can see in the picture all the candles from close[1] to close[23] are above lower 1.0 band and atleast one candle closes below 1.0 upper band

Please help with this

I would start this project with an indicator - I don't really like standard iBands, so I suggest using iBands smoothed with a period of 3 - 

Bollinger Bands SMA:

Slightly smooth the iBands indicator (Bollinger Bands, Bands). IBands indicator smoothed with period 3:

Bollinger Bands SMA

Fig. 1. Bollinger Bands

Comparison of regular and smoothed indicators:

Bollinger Bands SMA

Fig. 2. Bollinger Bands SMA


Bollinger Bands SMA
Bollinger Bands SMA
  • www.mql5.com
Индикатор iBands (Bollinger Bands, Bands) сглаженный периодом '3'
 
Vladimir Karputov:

I would start this project with an indicator - I don't really like standard iBands, so I suggest using iBands smoothed with a period of 3 - 

Bollinger Bands SMA:

Slightly smooth the iBands indicator (Bollinger Bands, Bands). IBands indicator smoothed with period 3:


Fig. 1. Bollinger Bands

Comparison of regular and smoothed indicators:


Fig. 2. Bollinger Bands SMA


I don't really have a problem with the bollinger bands indicator, I really want to code the chart pattern I showed, where the candles come down to a certain level

 
Ahmad861 :

I don't really have a problem with the bollinger bands indicator, I really want to code the chart pattern I showed, where the candles come down to a certain level

Your drawing is not complete - there is no [5]

 
Ahmad861 :

I have tried to ask this on another article but it seems that no one was able to answer it. I will be using 2 bollinger bands. 2.5 and 1.0 deviations, i will check if the close of the first candle is above the 2.5 bollinger band and i have set a loop going from 5 to 50. This loop will check if any of the closes from close[5] to close[5] is above the 2.5 bollinger band. The part im having a hard time trying to put are these 2 conditions

1. All the candles between close[1] and candle loop 5-50 must be above a certain bollinger band deviation.

2. Atleast one candle should be below a certain level

I'll give an example with a picture below

You can see here close[1] is above 2.5 bollinger band and running through the candle loop we see that close[23] closes above 2.5 band. The blue bollinger band is a 1.0 deviation and as you can see in the picture all the candles from close[1] to close[23] are above lower 1.0 band and atleast one candle closes below 1.0 upper band

Please help with this

You need:

introduce two variables datetime (' previous intersection ' and ' current intersection '). It remains to request data from the indicator between these dates and compare their values.

 

Hi Vladimir

Is it possible to create Vertical Line in custom indicator when buy or sell signal received?

 
TBS:

Hi Vladimir

Is it possible to create Vertical Line in custom indicator when buy or sell signal received?

Should the line be drawn on the main chart window or in a subwindow?
 
Vladimir Karputov:
Should the line be drawn on the main chart window or in a subwindow?

In main window,

Like this


 
TBS :

In main window,

Like this


An example of drawing is in the MACD code Intersection Main and Signal

MACD Intersection Main and Signal.png

Fig. 1. MACD Intersection Main and Signal

(see the input parameter 'VLines: Line's continuation down' - a vertical line is drawn in the main window, but depending on 'VLines: Line's continuation down' it can automatically continue through all sub-windows).

MACD Intersection Main and Signal
MACD Intersection Main and Signal
  • www.mql5.com
Отображение индикатора iMACD (Moving Average Convergence/Divergence, MACD) и вертикальных линий в месте пересечения линии 'Main' и 'Signal'
 
Vladimir Karputov:

An example of drawing is in the MACD code Intersection Main and Signal


Fig. 1. MACD Intersection Main and Signal

(see the input parameter 'VLines: Line's continuation down' - a vertical line is drawn in the main window, but depending on 'VLines: Line's continuation down' it can automatically continue through all sub-windows).

Yes exactly and I find my solutions

Thanks Vladimir

 

Hey Vladimir, you have been helping me create my EA from the very beginning and asking for nothing in return and i want to thank you from the bottom of my heart. There is this one last thing i need help with, I trade multi timeframes, M5, M15, M30, H1. Im currently running the multi timeframes on a loop, what i need is that if i have a setup in M5, i want to know that the M15 has also formed a new candle, in other words open of M5 should be equal to open of M15. I've tried a lot on how to go about this but now i need professional help