21 day EMA break indicator

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #172607 quote
    Alfy
    Participant
    Average

    Good morning guys, im trying to create an indicator which shows when the low of the day on which the close was below the 21 day exponential moving average is broken. Ive created the code for when the low is broken on the day after the close under the moving average but was hoping someone could help me with the code for when for example the low of that day is not broken for a few days or so. Any help is much appreciated.

    a=exponentialaverage [21]
    if close [1] crosses under a and low<LOW[1] THEN
    b=1
    else
    b=0
    endif
    return B coloured (255,0,0)
    #172609 quote
    robertogozzi
    Moderator
    Master

    Try this:

    a=exponentialaverage[21]
    if close[1] crosses under a1[1] and low<LOW[1] THEN
       b=1
    else
       b=0
    endif
    return B coloured(255,0,0)
    Alfy thanked this post
    #172611 quote
    robertogozzi
    Moderator
    Master

    That was for a break just after the crossover.
    This is for a break no matter when after the crossover (an opposite crossover cancels prior signal):

    ONCE a = 0
    IF a = 0 THEN
       a = close CROSSES UNDER exponentialaverage[21]
       c = low
    ENDIF
    IF close CROSSES OVER exponentialaverage[21] THEN
       a = 0
       c = 0
    ENDIF
    b = 0
    if a and low < c THEN
       b=1
    endif
    return B coloured(255,0,0)
    #172617 quote
    Alfy
    Participant
    Average

    Wonderful, thanks so much

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

21 day EMA break indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Alfy @alfy Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/28/2021
Status: Active
Attachments: No files
Logo Logo
Loading...