Ive written an EA that paints a Bar Red directly on the chart, then uses that bar to make comparisons and calculations.
Im having trouble keeping track of the bar. Seems bars are NOT objects that i can search for by color, therefore I must track the Bar by Number.
Which number should I use???
The predefined variable Bars changes on every new bar, and so does the offset of the Red Bar. How can i keep track of its current ordinal location?
Im thinking of storing the value of (Bars - offset) of the Red Bar at the time it was painted. Then on every new bar, I can subtract that stored number
from Bars and get the current offset. Is this a reliable way to handle this? Im worried that the predefined Bars variable could change in unexpected
ways and cause errors.
The other options is to create an arrow at the Red Bar. How would I then get the location of the arrow? I dont see that as an attrubute of Objects List.
Hi, Can you please share the code you used to paint the bar directly on the chart ?
regards
Sat
Ive written an EA that paints a Bar Red directly on the chart, then uses that bar to make comparisons and calculations.
Im having trouble keeping track of the bar. Seems bars are NOT objects that i can search for by color, therefore I must track the Bar by Number.
Which number should I use???
The predefined variable Bars changes on every new bar, and so does the offset of the Red Bar. How can i keep track of its current ordinal location?
Im thinking of storing the value of (Bars - offset) of the Red Bar at the time it was painted. Then on every new bar, I can subtract that stored number
from Bars and get the current offset. Is this a reliable way to handle this? Im worried that the predefined Bars variable could change in unexpected
ways and cause errors.
The other options is to create an arrow at the Red Bar. How would I then get the location of the arrow? I dont see that as an attrubute of Objects List.
Hi, Can you please share the code you used to paint the bar directly on the chart ?
regards
Sat
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Ive written an EA that paints a Bar Red directly on the chart, then uses that bar to make comparisons and calculations.
Im having trouble keeping track of the bar. Seems bars are NOT objects that i can search for by color, therefore I must track the Bar by Number.
Which number should I use???
The predefined variable Bars changes on every new bar, and so does the offset of the Red Bar. How can i keep track of its current ordinal location?
Im thinking of storing the value of (Bars - offset) of the Red Bar at the time it was painted. Then on every new bar, I can subtract that stored number
from Bars and get the current offset. Is this a reliable way to handle this? Im worried that the predefined Bars variable could change in unexpected
ways and cause errors.
The other options is to create an arrow at the Red Bar. How would I then get the location of the arrow? I dont see that as an attrubute of Objects List.