How to code a change of the "ribbon"

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #97962 quote
    AlgoAlexAlgoAlex
    Participant
    Master

    Given a number of moving averages with different periods, I would like to code the first moment when they are arranged by order, for example:

    ma1=Average[1]
    ma2=Average[2]
    ma3=Average[3]
    ma4=Average[4]
    
    ma1>ma2>ma3>ma4

    and that only candle to use as an entry signal.

    Hope I have been clear.

     

    Thanks anybody

     

    Alex

    #97964 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    ma1=Average[1]
    ma2=Average[2]
    ma3=Average[3]
    ma4=Average[4]
    x = ma1 > ma2 AND ma2 > ma3 AND ma3 > ma4
    return x

    So.

    • x > x[1]    will tell you the first bar when they are in order
    • x < x[1]    will tell you the first bar when they are no more in order
    • x <> x[1] will tell you whenever there’s been a change from order to disorder and viceversa
    AlgoAlex thanked this post
    #97967 quote
    AlgoAlexAlgoAlex
    Participant
    Master

    So.

    • x > x[1] will tell you the first bar when they are in order
    • x < x[1] will tell you the first bar when they are no more in order
    • x <> x[1] will tell you whenever there’s been a change from order to disorder and viceversa

    So, if I would code an entry, it would be like:

    slope=x-x[1]
    
    if slope crosses over 0 then
    buy at market

    Am I right?

    #97982 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Yes, sure.

    You may also add GRAPH to your code to watch desired values as they change candle after candle.

Viewing 4 posts - 1 through 4 (of 4 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 code a change of the "ribbon"


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
AlgoAlex @alexf Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
7 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/08/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...