Awesome Oscillator Crossover

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #222394 quote
    OllieB
    Participant
    Junior

    Hi All,

    I am trying to code a screener which returns an awesome oscillator crossover.  This means the Ao goes from below 0 to above 0, or from above 0 to below 0.

    The screener code is attached.  However, it is not behaving as expected.  For some of the values returned the chart (with an indictor coded up in the same way) does show to AO going from negative to positive, but in other cases i get stocks returned where the AO has been positive for some time.  I have (tried) to attach a screenshot which shows this.  The top section is price (which can be ignored) but the lower section shows the AO and its been negative for approx 30 time periods (weeks in this case).

    Can anyone shed any clues as to this strange behaviour please?  The stock given as an example of unexpected behaviour is FBIO.

    Many thanks.

    // sample screener code
    TIMEFRAME(WEEKLY)
    
    // Awesome oscillator has crossed the 0 line
    AO    = (Average[AO1](MedianPrice) - Average[AO2](MedianPrice))
    cAOup = ((AO[1] < 0) AND (AO > 0))
    cAOdn = ((AO[1] > 0) AND (AO < 0))
    
    // Set vals for screener
    if (cAOup) then
      c1WB = 1
    elsif (cAOdn) then
      c1WB = -1
    endif
    
    SCREENER [cAOup OR cAOdn](c1WB as "WB")
    AO1.jpg AO1.jpg
    #222397 quote
    JS
    Participant
    Veteran

    Hi Ollie,

    Why unexpected behavior?

    You determine the distance between two averages and in the case of FBIO there is a huge downtrend going on, so the “fast” average remains below the “slow” average…

    This can take a very long time indeed…

    #222410 quote
    OllieB
    Participant
    Junior
    Hi JS, Thanks for taking the time to reply. Unexpected as what i’m looking for is, in a downtrend, the AO to be under the zero line for the current time period but the previous time period the AO is above the zero line.  I am looking for the AO to cross from positive to negative. This stock shows current and previous period both below the zero line. Thanks,
    #222411 quote
    JS
    Participant
    Veteran

    Hi,

    Do you mean something like that…?

    Scherm­afbeelding-2023-10-13-om-23.00.08.png Scherm­afbeelding-2023-10-13-om-23.00.08.png
    #222423 quote
    OllieB
    Participant
    Junior
    Hi, Sort of. I don’t think i was clear in my first post.  The FBIO stock shows up as a result of a screener.  I have used the same code from the screener to code the indicator.  This shows that the indicator has not crossed down in the last period, its been down for ages, and therefore should not be appearing in the screener as a recent crossdown. Your chart, with new indicator, shows the point at which the AO crossed down?  If so, then that could work, yes!  That could be coded for a screener and only return stocks which are crossing up/down. Thanks.
    #222425 quote
    JS
    Participant
    Veteran

    Hi Ollie,

    I see what you mean now…

    What values do you use for AO1 and AO2…?

    #222426 quote
    OllieB
    Participant
    Junior
    Thanks. I -read my initial post and it wasn’t very clear.  Seemed perfectly clear at the initial time of writing!  🙂 I am using 2 and 33, slightly arbitrary but those were the values for that screenshot. Appreciate your help!
    #222427 quote
    JS
    Participant
    Veteran

    Hi @OllieB

    I’ve tweaked your screener a bit and at least I can’t get FBIO as a result anymore…

    Results from screeners are sometimes inexplicable (you’re not alone) but I think it could be due to several factors…

    1. Bad / polluted data
    2. Rounding in penny stocks
    3. Dividend adjustments
    TIMEFRAME(Weekly)
     
    // Awesome oscillator has crossed the 0 line
    Avg20=Average[20](Close)
    Avg10=Average[10](Close)
    C1=Avg10 Crosses Over Avg20
    C2=Avg10 Crosses Under Avg20
    //cAOup = ((AO[1] < 0) AND (AO > 0))
    //cAOdn = ((AO[1] > 0) AND (AO < 0))
     
    // Set vals for screener
    if C1 then
    c1WB = 1
    elsif C2 then
    c1WB = -1
    endif
     
    SCREENER [C1 or C2](c1WB as "WB")
    
    Scherm­afbeelding-2023-10-14-om-11.42.50.png Scherm­afbeelding-2023-10-14-om-11.42.50.png
    #222454 quote
    OllieB
    Participant
    Junior
    Hi, Thanks for the changes.  I’ve made some modifications to the screener to match the above, apart from changing “close” on the Average to “Median” to better reflect the Awesome oscillator.  I also plotted 2 MAs on the chart to help see where the cross overs are happening. 48 of the 50 stocks returned from the screener looked good, i could see they matched the criteria.  However, 2 did not!!  I guess I’ll have to live with the 4% margin of error. You can see that in the screenshot, the MAs have not crossed, nor is the indicator showing a crossover, yet its returned in the screener!! Thanks.
    AO2.jpg AO2.jpg
    #222457 quote
    robertogozzi
    Moderator
    Master
    Try this one:
    TIMEFRAME(Weekly)
    // Awesome oscillator has crossed the 0 line
    Avg20=Average[20](Close)
    Avg10=Average[10](Close)
    C1=Avg10 Crosses Over Avg20
    C2=Avg10 Crosses Under Avg20
    //cAOup = ((AO[1] < 0) AND (AO > 0))
    //cAOdn = ((AO[1] > 0) AND (AO < 0))
    c1WB = 0
    // Set vals for screener
    if C1 then
    c1WB = 1
    elsif C2 then
    c1WB = -1
    endif
    SCREENER [c1WB AND range <> 0](c1WB as "WB")
    #222458 quote
    JS
    Participant
    Veteran

    Hi Ollie,

    That’s right, there are always a few results that don’t meet the criteria… it remains strange.

    Otherwise, looks fine…

    #222460 quote
    OllieB
    Participant
    Junior
    A big thanks for all your help. Until next time….
    JS and robertogozzi thanked this post
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.

Awesome Oscillator Crossover


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
OllieB @ollieb Participant
Summary

This topic contains 11 replies,
has 3 voices, and was last updated by OllieB
2 years, 5 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 10/13/2023
Status: Active
Attachments: 4 files
Logo Logo
Loading...