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

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

    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 robertogozzirobertogozzi
3 years, 10 months ago.

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