SMA up/down in X minutes

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #168659 quote
    OMXet
    Participant
    Junior

    Hi

    Another question to you faboulous programmers ;>)

    I want a buy/sell signal when my SMA moves under certain conditions

    // Conditions to enter long positions
    indicator1 = Average[30](close)
    
    c1 = indicator1 moves up X % in Y minutes
    
    // Conditions to enter short positions
    indicator1 = Average[3](close)
    
    c2 = indicator1 moves down X % in Y minutes
    #168679 quote
    robertogozzi
    Moderator
    Master

    Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.

    Thank you 🙂

    #168690 quote
    robertogozzi
    Moderator
    Master

    There you go:

    Timeframe(1 minute,UpdateOnClose)
    Y   = 100            //100 minutes
    X   = 0.5            //0.5%
    ind = Average[30](close)
    PC  = (((ind * 100 / ind[Y]) - 100))
    UP  = PC >= X
    DN  = PC <= -X
    RETURN UP AS "Bullish",-DN AS "Bearish",0 as "0"
    x-2.jpg x-2.jpg
    #168718 quote
    OMXet
    Participant
    Junior

    Roberto

     

    Molte grazie a te è perfetto

     

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

SMA up/down in X minutes


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
OMXet @omxet Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/03/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...