iClose, Is it the last bar or this.

Post Reply
falsedave
Trader
Posts: 53
Joined: Sun Aug 26, 2012 5:00 pm

iClose, Is it the last bar or this.

Post by falsedave »

I know this is probably gonna sound like a really stupid question but when using iClose to trigger a trade that is over an MA. Would it be shifted one ? as a shift of 0 would be this bar, which hasnt yet closed. But since iClose would then be useless with a shift of 0 has it not already been done for us by Empty4.

I hope this makes some sort of sense.
Image
Image
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: iClose, Is it the last bar or this.

Post by gaheitman »

falsedave wrote:I know this is probably gonna sound like a really stupid question but when using iClose to trigger a trade that is over an MA. Would it be shifted one ? as a shift of 0 would be this bar, which hasnt yet closed. But since iClose would then be useless with a shift of 0 has it not already been done for us by Empty4.

I hope this makes some sort of sense.
Using Close or iClose for bar 0 gives you the current price (or the price at the last tick). It's perfectly valid to use it, just don't think of it as the close. I've never tested it, but iClose(...,0) should be the same as MarketInfo(....,MODE_BID).

George
falsedave
Trader
Posts: 53
Joined: Sun Aug 26, 2012 5:00 pm

Re: iClose, Is it the last bar or this.

Post by falsedave »

Ah ha. Gotcha.

Thankyou very much.
Image
Image
Post Reply

Return to “Coders Hangout”