First value in chart

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #15668 quote
    Spekulanten
    Participant
    Average

    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

    #15680 quote
    Tom
    Participant
    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.

    #15681 quote
    Spekulanten
    Participant
    Average

    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
    #15683 quote
    Tom
    Participant
    New

    I am glad I could help.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

First value in chart


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Tom
9 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/28/2016
Status: Active
Attachments: No files
Logo Logo
Loading...