Cross over condition

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #249023 quote
    sgrechsgrech
    Participant
    Junior

    In the event of a stochastc going below a certain level eg 20, I need to check whether this is first such occurence since the 20ma crossed the 80ma from below.

     

    Many thanks.

    #249032 quote
    sgrechsgrech
    Participant
    Junior

    Is anyone able to help please?

    #249034 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Hi! here you have.

    sma80=average[80](close)
    sma20=average[20](close)
    
    stok=Stochastic[14,3](close)
    
    
    if sma20>sma80 then
       cross=cross+(stok crosses under 20)
    else
       cross=0
    endif
    
    SCREENER[cross=1 and cross<>cross[1]]
    

    You can change cross=1 for cross=3 if you want the third cross.

    robertogozzi thanked this post
    #249041 quote
    sgrechsgrech
    Participant
    Junior

    Thanks Ivan, I have complete a quick test and don’t think it is quite correct.

    As you can see in the attached image the cross over occurs at point 1, in this case I am only interested in the first occassion following the crossover that stoch is below 20.  Don’t wish to be notified of subsequent instances where stoch crosses below 20 (ie point 3/4)

    Capture-2.jpg Capture-2.jpg
    #249053 quote
    JSJS
    Participant
    Master

    Try this one…

    SMA20=Average[20](Close)
    SMA80=Average[80](Close)
    Stoch=Stochastic[14,3](Close)
    
    SMABars=BarsSince(SMA20 crosses over SMA80)
    SMABars=Max(SMABars,1)
    Signal=Summation[SMABars](Stoch crosses under 20)=1
    
    Screener[Signal](Stoch as "Stoch")
    robertogozzi and sgrech thanked this post
Viewing 5 posts - 1 through 5 (of 5 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

Cross over condition


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
sgrech @sgrech Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by JSJS
1 year, 1 month ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 07/22/2025
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...