invert Screener code

Viewing 15 posts - 1 through 15 (of 36 total)
  • Author
    Posts
  • #225492 quote
    sam00075
    Participant
    New

    Hello the community,

    is there a way to invert this screener, so we get the Bearish Breakouts instead of the Bullish ?

    https://www.prorealcode.com/prorealtime-market-screeners/screener-break-out-with-high-volume/

    Thanks in advance.

    #225500 quote
    JS
    Participant
    Senior

    Hi @sam00075

    Here’s the screener for the “Bearish BreakOut”…

    // today variation
    tdVar = (Open - Close) / Close * 100
    
    // Var condition
    avgVar = 0
    for i = 1 to 10 do
    if (close[i] > open[i]) then
    avgVar = avgVar + (close[i] - open[i]) / open[i]
    else
    avgVar = avgVar + (open[i] - close[i]) / close[i]
    endif
    next
    avgVar = avgVar / 10 * 100
    
    c1 = tdVar > avgVar
    
    // Lowest break condition
    minValue = Lowest[10](Low)[1]
    c2 = minvalue < Open and Close < minvalue
    
    // Volume condition
    avgVol = average[20](volume)
    sum = 0
    for i=0 to 20
    if (volume[i] < avgVol*10) then
    sum = sum + volume[i]
    else
    sum = sum + avgVol
    endif
    next
    
    avgVol = sum / 21
    c3 = avgVol > 1000
    
    // Breakout Var%
    breakoutVar = (close - minvalue)/close*100
    
    // Screener
    SCREENER[c1 and c2 and c3](breakoutVar as "Breakout Var%")
    sam00075 thanked this post
    #225652 quote
    sam00075
    Participant
    New
    Awesome ! A big Thank you.
    JS thanked this post
    #227869 quote
    sam00075
    Participant
    New
    Hello @JS , thanks again for the last code, works like a charm. I need your help for another one if you have time : I’d like to add some criterias to the  screener “Break out with high volume” https://www.prorealcode.com/prorealtime-market-screeners/screener-break-out-with-high-volume/ 1- The price candle spreads the Bollinger band to the upside. 2- The MACD baseline is touched, and broken to the upside. 3- The volume is bigger than the last candle (tho i guess it’s already the case in the actual code ?) I joined a picture as an example for the configuration i’m looking for. Thank you in advance.
    criteres.jpg criteres.jpg
    #227871 quote
    JS
    Participant
    Senior

    Hi Sam,

    How many periods do you want to use for the Bollinger Band and how much standard deviation?

    The BollingerUp[period](Close) uses 2 standard deviations I think…

    For the MACD, use the line: MACDLine[12,26,9](Close) or MACD[12,26,9](Close)?

    The volume larger than the last candle is not yet specific in the code but is no more than: C5=Volume>Volume[1]

    sam00075 thanked this post
    #227872 quote
    JS
    Participant
    Senior

    Forget the stupid question about the MACD… (I’m not very familiar with MACD)

    Do you mean this:

    C4=MACD[12,26,9](Close) CrossesOver MACDLine[12,26,9](Close)

    sam00075 thanked this post
    #227874 quote
    sam00075
    Participant
    New
    Hi @JS , thanks for the quick reply. – i don’t know what the technical term is for the MACD : What i meant is Cross the Horizontal line, in direction of the upside, i think the Horizontal line value is 0,00 – for the bollinger band standard deviation, and periods, i have no idea, if you can please do what you think is best, we’ll ajust if needed. – for the volume, let’s test the without adding this part, just keeping what’s in the original code, we’ll see if it’s needed after testing the code.
    #227875 quote
    JS
    Participant
    Senior
    Hi Sam, Hereby the screener with the extra conditions:
    // today variation
    tdVar = (close[0] - open[0]) / open[0] * 100
    
    // Var condition
    avgVar = 0
    for i = 1 to 10 do
    if (close[i] > open[i]) then
    avgVar = avgVar + (close[i] - open[i]) / open[i]
    else
    avgVar = avgVar + (open[i] - close[i]) / close[i]
    endif
    next
    avgVar = avgVar / 10 * 100
    
    c1 = tdVar > avgVar
    
    // highest break condition
    maxValue = highest[10](high)[1]
    c2 = maxvalue < close and open < maxvalue
    
    // Volume condition
    avgVol = average[20](volume)
    sum = 0
    for i=0 to 20
    if (volume[i] < avgVol*10) then
    sum = sum + volume[i]
    else
    sum = sum + avgVol
    endif
    next
    
    avgVol = sum / 21
    c3 = avgVol > 1000
    
    // Breakout Var%
    breakoutVar = (close - maxvalue)/close*100
    
    // Extra Conditions
    c4=Close Crosses Over BollingerUP //The price candle spreads the Bollinger band to the upside.
    
    c5=MACD[12,26,9](Close) Crosses Over 0 //The MACD baseline is touched, and broken to the upside.
    
    //c6=Volume>Volume[1] //The volume is bigger than the last candle
    
    // Screener
    SCREENER[c1 and c2 and c3 and c4 and c5](breakoutVar as "Breakout Var%")
    sam00075 thanked this post
    Breakout-with-big-volumes-PLUS.itf
    #227877 quote
    sam00075
    Participant
    New
    Awesome ! You even included the .ift – For the Bollinger it seems good. – For the MACD it shows some results that are far from the Horizontal Baseline, like the joined picture. Do you know the reason ?
    Untitled-2.jpg Untitled-2.jpg
    #227879 quote
    JS
    Participant
    Senior
    What I see in your screenshot is that the MACD is correct, it goes from red to green in the last bar… It’s about the zero line, MACD crosses the zero line upwards…
    sam00075 thanked this post
    #227880 quote
    sam00075
    Participant
    New
    Sorry i didn’t know how to express it better, please see the joined picture i drawed the line in Black, this is the one i want to be crossed.
    Untitled-2-1.jpg Untitled-2-1.jpg
    #227882 quote
    JS
    Participant
    Senior
    For me that is the zero line…you see the crossing (from red to green) in the last bar…
    sam00075 thanked this post
    #227883 quote
    JS
    Participant
    Senior
    You only have to look at the last bar, the screener looks for stocks that now meet the conditions and when you call up the graph of the stock it is always about the last bar (where all conditions are true)…
    #227884 quote
    sam00075
    Participant
    New
    Yes screeners are for the last bar, Agree. The picture was just as an example, what i would like is the detection when the Black line is crossed.
    #227885 quote
    JS
    Participant
    Senior
    We’re talking past each other… 🙂 How do you call that black line… what function does it have in the MACD?
    sam00075 thanked this post
Viewing 15 posts - 1 through 15 (of 36 total)
  • You must be logged in to reply to this topic.

invert Screener code


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
sam00075 @sam00075 Participant
Summary

This topic contains 35 replies,
has 2 voices, and was last updated by sam00075
2 years ago.

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