Download MetaTrader 5
To add comments, please log in or register
Do you need a programmer? Make an order to let the developer find you!
yousefselim
17
yousefselim 2015.07.02 02:50 
Iam trying to use iOpen to retrieve the open of the candle that just closed.... Any Help???
JD4
1101
JD4 2015.07.02 04:18  
Did you take a close look at the documentation?  Just asking, because I haven't.  I have no idea if it is there or not, but it should be one of the places you look.
Keith Watford
Moderator
7870
Keith Watford 2015.07.02 05:08  
Use iOpen with the timeframe and shift at 1
JD4
1101
JD4 2015.07.02 05:21  
I don't yet have any experience coding with MQL, wish I had a better answer for you.  I used to know Java coding, but even that has been quite a while.  I have no ideas what would be a good point to start at for this.
PomeGranate
553
PomeGranate 2015.07.02 07:48  
GumRai:
Use iOpen with the timeframe and shift at 1

Example how to do it:

yesterbar_open=iOpen(NULL,PERIOD_CURRENT,1);

 

Always helpful: Alphabetic Index of MQL4 Functions (600+)

 

JD4:
I don't yet have any experience coding with MQL, wish I had a better answer for you.  I used to know Java coding, but even that has been quite a while.  I have no ideas what would be a good point to start at for this.

I don't mean to be rude, but what is the point in such post after the answer has been given? 

yousefselim
17
yousefselim 2015.07.02 15:27  

 I tried That ...but some thing Wrong Happens .... When i put the timeframe to be 30 an shift 1 it gives the candle before it

 void getSignal(int period)
      {

      if (period!=0)
      { 

      Alert("OPEN FOR TIME FRAME **_ ",period," _** IS ",iOpen(Symbol(),period,0)," Close FOR TIME FRAME ",period," IS "+iClose(Symbol(),period,0));

 
    
      }
whroeder1
13593
whroeder1 2015.07.02 15:47  
yousefselim: I tried That ...but some thing Wrong Happens .... When i put the timeframe to be 30 an shift 1 it gives the candle before it
That is what shift 1 means, the previous candle, not the current candle; that is what you asked for:
yousefselim: Iam trying to use iOpen to retrieve the open of the candle that just closed.
Ovo Cz
2954
Ovo Cz 2015.07.02 17:59  
yousefselim:

 I tried That ...but some thing Wrong Happens .... When i put the timeframe to be 30 an shift 1 it gives the candle before it

 

It happens, if you do not have the other timeframe open. Usually on the second tick the iOpen call is correct. If you need the value within the first tick, open an additional (blank) chart for the desired period in the background, then the iOpen is always correct.
yousefselim
17
yousefselim 2015.07.05 18:30  
Ovo:
It happens, if you do not have the other timeframe open. Usually on the second tick the iOpen call is correct. If you need the value within the first tick, open an additional (blank) chart for the desired period in the background, then the iOpen is always correct.

 when i put the timeframe 30 shift 0 it get the value from the candle that just closed

but when i put the timeframe 15 shift1 it get the value from the candle that just closed ON chart 15

but when i put the timeframe 60 shift 1 it get the value from the candle no.14 ????

IS that what you are talking about???

THANKS

/
To add comments, please log in or register