Hi,
I want to return the first value of an indicator displayed on the chart. How can i do this?
So i want, the first value from an indicator displayed. Probably something with barindex, and ONCE? But can’t figure it out how..
Thanks in advance
TomParticipant
New
Well, I don’t understand it yet, could you explain it to me a bit more detailed. You want the FIRST VALUE of your indicator displayed over the complete chart?
What indicator is that? Because … for example, a 20 moving average needs 20 previous bars to get calculated, and the last bar displays this
20 MA. As far as I understand you, in this case scenario, you want, after the first 20 candles a stop and have the one time calculated value of this indicator displayed over the complete chart?
To stick with the 20 MA example, I would write it this way:
(Barchart starts to count with 0 on the left candle of your monitor )
if barchart = 20 then
variable = Average[20](Close)
end
return variable
If I am wrong, please, correct me.
Hi Tom, thanks for reply and your help.
I solved it! With this i get the first value displayed, cheers.
if barindex = 0 then
x = indicatorx
endif
return x