Thread: How to code?
View Single Post
  #955 (permalink)  
Old 05-23-2008, 02:24 AM
omelette omelette is offline
Senior Member
 
Join Date: Jan 2006
Posts: 1,117
omelette is on a distinguished road
Quote:
Originally Posted by wolfe View Post
Hello everyone,

This is a stupid coding question, and I know I've seen it somewhere before, but I need help.

I'm coding a custom indicator, and all I want it to do is read the current bid price at ONLY THE BEGINNING of a NEW bar. I can't just use Open[0] because every time a new tick comes in it will keep returning the open value for the current bar. I want the value to be returned only once, until a new bar is formed.

I know I'm missing something quite simple here, but am having a bit of trouble figuring it out. Could someone help me?

Thanks,

-wolfe
Just store the current bar time (Time[0]) - when this value changes, you have a new bar, so get your price, store new value and repeat...
Reply With Quote