Coding a reference to a Vertically Shifted MA

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10197 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    ProRealTime provides vertically shifted Moving Averages. They can be useful to build channels.

    Can anyone show me how to reference the price touching one of them (say a 20-period SMA shifted + 0.25% and another one shifted -0.25%)?

    Thank you.

    MM-vertically-shifted.jpg MM-vertically-shifted.jpg
    #10202 quote
    NicolasNicolas
    Keymaster
    Legend

    There are no built-in instructions to reference “envelopes” indicator, you have to recode it yourself. Just coded this version with your settings:

    // parameters
    p = 20
    dev = 0.25 //deviation in percent
    
    ma = average[p](close)
    devhi = ma+((dev/100)*ma)
    devlo = ma-((dev/100)*ma)
    
    RETURN devhi as "deviation high", devlo as "deviation low"

    Hope it works ok for your needs.

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

Coding a reference to a Vertically Shifted MA


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/04/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...