Download MetaTrader 5

How to create a indicator buffer which will show the gap between previous candles close and current candles open price?

To add comments, please log in or register
shararath2004
35
shararath2004  
i am a newbie to mql4, so please need some help now, as i said above, How to create a indicator buffer which will draw a chart of the gap between previous candles close and current candles open price?
Keith Watford
Moderator
10644
Keith Watford  
int index;

Buffer[index] = Open[index] - Close[index+1] ;
Obviously, you would have to create a loop using index
James Hodges
3954
James Hodges  
Hmm I'm not exactly sure what you mean by this... there should be no gap. The current candle should open where the price was when the previous candle closed.. unless you are talking about the gap that can form over the weekend?
shararath2004
35
shararath2004  
GumRai:
Obviously, you would have to create a loop using index

i dont know how to create a indicator or expert, i dont know what is loop,

There is no other easy way?
Close[1]-Open[0] why this does not work?

if you can and if its easy for you, can you please create a simple indicator for me?

shararath2004
35
shararath2004  
Jimdandy:
Hmm I'm not exactly sure what you mean by this... there should be no gap. The current candle should open where the price was when the previous candle closed.. unless you are talking about the gap that can form over the weekend?

In one minute chart most of the candles open with a smaller gap between its previous candles close, very smaller gaps
Keith Watford
Moderator
10644
Keith Watford  
shararath2004:
i am a newbie to mql4, so please need some help now, as i said above, How to create a indicator buffer which will draw a chart of the gap between previous candles close and current candles open price?

GumRai:
Obviously, you would have to create a loop using index
int index;

Buffer[index] = Open[index] - Close[index+1] ;

shararath2004:


There is no other easy way?
Close[1]-Open[0] why this does not work?

Because you asked about an indicator buffer and the buffer would only contain values for realtime, if you use [1] and [0], not relative to each bar on the chart.

Also Close[1]-Open[0] means that if the open of the new bar is higher than the close of the previous bar, the result will be negative - is that what you want?

Tjipke de Vries
6374
Tjipke de Vries  
shararath2004:

i dont know how to create a indicator or expert, i dont know what is loop,

There is no other easy way?
Close[1]-Open[0] why this does not work?

if you can and if its easy for you, can you please create a simple indicator for me?


Better way for you, if you wanna get this indicator

Is start learning or use a section like https://www.mql5.com/en/job

whroeder1
15724
whroeder1  
Jimdandy:
Hmm I'm not exactly sure what you mean by this... there should be no gap. The current candle should open where the price was when the previous candle closed.. unless you are talking about the gap that can form over the weekend?
The close was the last tick in the previous period. The open is the next tick after the previous period. They will almost NEVER be equal. Equal means no tick.
shararath2004
35
shararath2004  
GumRai:


Because you asked about an indicator buffer and the buffer would only contain values for realtime, if you use [1] and [0], not relative to each bar on the chart.

Also Close[1]-Open[0] means that if the open of the new bar is higher than the close of the previous bar, the result will be negative - is that what you want?


yeah, i understood now why Close[1]-Open[0] does not work, thank you so much for explaining this, and yes i just need a indicator which will show the gap either in negative or in positive,

and can you tell me how i can modify custom MACD indicator which is inbuilt in MT4 to make this indicator?

can you please help me to create this indicator?

To add comments, please log in or register