I was hoping someone could help me with this. I can't figure it out for the life of me. I am using IOG=True and I want to calculate the close on the last tick not the close on the last bar. Ultimately what I want to do is buy on a downtick and sell on an uptick.
Thank You in advance for any help.
Tony
Close On Prior Tick
Re: Close On Prior Tick
I was hoping someone could help me with this. I can't figure it out for the life of me. I am using IOG=True and I want to calculate the close on the last tick not the close on the last bar. Ultimately what I want to do is buy on a downtick and sell on an uptick.
Thank You in advance for any help.
Tony
Code: Select all
Var: PriorClose(0),CurrentClose(0);
PriorTick = CurrentClose;
CurrentClose = C;
Re: Close On Prior Tick
I'm not having luck with that. Here's what I wrote
IntraBarPersist PriorClose ( 0 ),
IntraBarPersist Current Close ( 0 ),
PriorClose = CurrentClose;
CurrentClose = C;
// you had written PriorTick = CurrentClose and I assume you meant PriorClose not PriorTick. PriorTick is not a reserved word that I can see so essentially this is simply saying PriorClose = C which if I am mistaken is not calculating the prior tick but rather the current close.
IntraBarPersist PriorClose ( 0 ),
IntraBarPersist Current Close ( 0 ),
PriorClose = CurrentClose;
CurrentClose = C;
// you had written PriorTick = CurrentClose and I assume you meant PriorClose not PriorTick. PriorTick is not a reserved word that I can see so essentially this is simply saying PriorClose = C which if I am mistaken is not calculating the prior tick but rather the current close.
- Smoky
- Posts: 518
- Joined: 03 Dec 2010
- Location: Thailand
- Has thanked: 99 times
- Been thanked: 121 times
Re: Close On Prior Tick
with IOG=true, last tick is always last close.I am mistaken is not calculating the prior tick but rather the current close.
to do your job :
IntraBarPersist PriorClose ( 0 );
// start of your code working with PriorClose
//end of your code
//last line
PriorClose = C;
Re: Close On Prior Tick
tony,I'm not having luck with that. Here's what I wrote
IntraBarPersist PriorClose ( 0 ),
IntraBarPersist Current Close ( 0 ),
PriorClose = CurrentClose;
CurrentClose = C;
// you had written PriorTick = CurrentClose and I assume you meant PriorClose not PriorTick. PriorTick is not a reserved word that I can see so essentially this is simply saying PriorClose = C which if I am mistaken is not calculating the prior tick but rather the current close.
Your code is correct I typed in hurry, if you add print statement at bottom of your code you will observe that it works so does smoky’s suggestion.
Re: Close On Prior Tick
Thank you Smoky and Super (and Andrew from a prior email). Conceptually it was not making sense to me, but now I understand how it works. The help is much appreciated.
Tony
Tony