Coding a reference to a Vertically Shifted MA

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

    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
    Nicolas
    Keymaster
    Master

    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.

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 Nicolas
9 years, 7 months ago.

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