MOVING AVRAGE AS SUPPORT SCREENER

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #210572 quote
    ALBERT77
    Participant
    New

    Sometimes moving averages can act as support and resistance. I am trying to write a screener that price just crossed over a moving average that acted as a resistance in the last 100 candles.

    C1= ExponentialAverage[I](close)
    C2=CLOSE CROSSES OVER C1
    C3=summation[100]((CLOSE-C1)>0)=1
    C4=summation[100]((C1-CLOSE)< (0.005*CLOSE))=2
    FOR I= 20 TO 50 DO
    IF ( C2 AND C3 AND C4) THEN
    PERIOD=I
    ENDIF
    NEXT
    SCREENER(PERIOD AS "PERIOD")
    
     
    
    #210589 quote
    Nicolas
    Keymaster
    Master

    I haven’t look at your conditions, but in your loop, you should refer to your condition at the time of I:

    C1= ExponentialAverage[I](close)
    C2=CLOSE CROSSES OVER C1
    C3=summation[100]((CLOSE-C1)>0)=1
    C4=summation[100]((C1-CLOSE)< (0.005*CLOSE))=2
    FOR I= 20 TO 50 DO
     IF ( C2[I] AND C3[I] AND C4[I]) THEN
      PERIOD=I
     ENDIF
    NEXT
    SCREENER(PERIOD AS "PERIOD")
    ALBERT77 thanked this post
    #210592 quote
    Nicolas
    Keymaster
    Master

    I think the code should be like this, considering you are looking for an EMA between periods 20 to 50 that act as a resistance:

    FOR I= 20 TO 50 DO
     C1= ExponentialAverage[I](close)
     C2=CLOSE CROSSES OVER C1
     C3=summation[100]((CLOSE-C1)>0)=1
     C4=summation[100]((C1-CLOSE)< (0.005*CLOSE))=2
     IF ( C2 AND C3 AND C4) THEN
      PERIOD=I
     ENDIF
    NEXT
    SCREENER(PERIOD AS "PERIOD")

    The results will always be the longest period found, because the loop will go to the end.

    ALBERT77 thanked this post
    #210613 quote
    ALBERT77
    Participant
    New

    Results are not correct.

    for example ,  it screens CVS as a result with ema50 as answer, but last price is not crossing above ema50, in last candles there are other candles above ema50 while we want all below ema50 with one very close to it (with exception of last crossing candle)

    CVS-1.png CVS-1.png
    #210666 quote
    Nicolas
    Keymaster
    Master

    Ok, let’s restart from scratch, what do you mean with:

    that acted as a resistance in the last 100 candles

    Please?

    #210692 quote
    ALBERT77
    Participant
    New

    For example on the following stock (BBAI) EMA 54 acted as a resistance twice in the past similar to resistance lines , now in the pullback it is very close to it again and there is possibility to bounce back again. I am trying to write a screener to examine a range of moving averages for every stock and find any moving average that acted like this example.

    BBAI.jpg BBAI.jpg
    #210694 quote
    ALBERT77
    Participant
    New

    I forgot to say that in screener formula that i post, it tries to find moving when price finally crosses over moving. Later i will modify it to find them when price pullback to moving.

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

MOVING AVRAGE AS SUPPORT SCREENER


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
ALBERT77 @albert77 Participant
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by ALBERT77
3 years ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 02/27/2023
Status: Active
Attachments: 2 files
Logo Logo
Loading...