How to get value of an indicator for a past period?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #205220 quote
    Vla
    Participant
    New

    Hello,

    Could you please explain how to code the value of a past date (X periods back) of an indicator ? The idea is to use it for comparison of this past value with the current value of this same indicator.

    Thank you

    #205225 quote
    robertogozzi
    Moderator
    Master

    This will compare a current average with that of N periods ago:

    N       = 50    //lookback periods
    Sma20   = average[20,0](close)
    PastAvg = Sma20[N]
    RETURN Sma20 AS "Current average",PastAvg AS "Past Average"
    Vla thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

How to get value of an indicator for a past period?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Vla @vla Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
3 years, 2 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/03/2022
Status: Active
Attachments: No files
Logo Logo
Loading...