Can someone explain the difference...

 

Hi,

Can someone please explain the difference between the following:

if(Close[1] == Open[1])

and

if (iClose(NULL,0,1) == iOpen(NULL,0,1))

Where would I use iClose(NULL,0,1) instead ofClose[1]and visa versa?

I'm having some real difficulty in learning the nuances with this language and would be grateful if someone can enlighten me.

Thanks in advance.

 

iClose and iOpen are extensions of their array counterparts and allow you to select a different currency pair and different time frame. The array functions only operate on the currency pair on which your EA or indicator are placed.

Hope that helps.

Lux

PS: For more information and usage examples be sure to check the MetaEditor help file. It's your BEST friend!

 
Limstylz:
Hi,

Can someone please explain the difference between the following:

if(Close[1] == Open[1])

and

if (iClose(NULL,0,1) == iOpen(NULL,0,1))

Where would I use iClose(NULL,0,1) instead ofClose[1]and visa versa?

I'm having some real difficulty in learning the nuances with this language and would be grateful if someone can enlighten me.

Thanks in advance.

Close and Open are arrays that contain the price elements of the i bar of the current pair in the current timeframe (chart window)

iClose() and iOpen() are functions that retreives the price element of the stated sysbol, in the given time frame with the shift requested, These function can retreive any price elements but the sysbol must be listed in the market watch window and a history file that goes back to cover the bars or shift back. you can use either formate for the current sysbol and current time frame, so the two examples you gave should return the same answer, but iClose(GBPUSD, 15, 2 )would return the close of the Cable two bars back not counting the current bar on a 15 minute chart, again the cable must be actively listed in the market watch window and you must have a history file that contains the close two bars back , now iClose(GBPUSD, 15, 0 ) will return the current bars value of the last known bid price of the Pound US even if the bar has not closed yet.

Keit

 

Thanks Gentlemen

Thanks guys.

I tried looking in the help file but could not find a definitive answer. I don't think the help file was written with novices in mind.

To reiterate, if I am coding with global values, I should use Close and if I need to be more specific or to concern the current bars current state I use iClose?

This is just opening up a can of worms for me. Perhaps I should give up and stick to manual trading...

Reason: