Simple 3-test breakout

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #120006 quote
    adam felsmanadam felsman
    Participant
    New

    Hello Everyone,  my coding level is terrible but I’ve manage to get my main strategy working for proscreener.  I am wondering if anyone has successfully coded a 3-test of a horizontal line (support/resistance) scanner , part of my second strategy??  I can’t see anything in the library and would love some assistance.

     

    thanks,

    adam

    Capture.png Capture.png
    #120019 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    First you have to determine the resistance (support is just the other way round).

    To do this you must choose a preferred period, say 100 bars:

    [scode]

    Resistance = highest[100](close)

    [/scode]

    now you count the number of times price (high) has hit that resistance:

    [scode]

    x = summation[100](high >= Resistance) >= 3

    [/scode]
    x will be true when Resistance has been hit at least 3 times or more.

    (not tested)

    #120022 quote
    adam felsmanadam felsman
    Participant
    New

    Thank you, I’ll give it a try tomorrow night.

    #120063 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I tested it and it seems not to work correctly. This should do, instead:

    p          = 100
    Resistance = highest[p](close)
    Count      = 0
    FOR i = (p - 1) DOWNTO 0
       IF high[i] >= Resistance THEN
          Count = Count + 1
       ENDIF
    NEXT
    SCREENER[Count >= 3](Count AS "Hits")

    and this is the indicator:

    DEFPARAM DrawOnLastBarOnly = true
    p          = 100
    Resistance = highest[p](close)
    Count      = 0
    FOR i = (p - 1) DOWNTO 0
       IF high[i] >= Resistance THEN
          Count = Count + 1
       ENDIF
    NEXT
    IF Count >= 3 THEN
       DRAWSEGMENT(BarIndex - (p - 1),Resistance,BarIndex,Resistance)
    ENDIF
    RETURN
    x-9.jpg x-9.jpg
    #120071 quote
    VonasiVonasi
    Moderator
    Master

    I have this indicator that I wrote a while back that might be of interest. It calculates a level mid way through the upper and lower shadow and then checks back through p bars to see how many other shadows crossed the same level. It draws extending lines at these levels if ‘tests’ quantity of shadow crosses are detected until a new level is found to have been tested.

    I might submit it to the library as I’d forgotten that I’d coded it!

    defparam calculateonlastbars = 1000
    
    p = 200
    tests = 3
    
    if barindex >=tests then
    
    level = (high + max(open,close))/2
    
    count = 1
    draw = 0
    for a = 1 to p
    if close[a] > level then
    break
    endif
    if high[a] >= level and max(close[a],open[a]) <= level then
    count = count + 1
    if count = tests then
    startindex = barindex-a
    draw = 1
    break
    endif
    endif
    next
    
    if draw = 1 then
    drawsegment(startindex,level,barindex,level) coloured(0,128,0)
    lastlevel = level
    else
    drawsegment(barindex-1,lastlevel,barindex,lastlevel) coloured(0,128,0)
    endif
    
    level2 = (low + min(open,close))/2
    
    count = 1
    draw2 = 0
    for a = 1 to p
    if close[a] < level2 then
    break
    endif
    if low[a] <= level2 and min(close[a],open[a]) >= level2 then
    count = count + 1
    if count = tests then
    startindex2 = barindex-a
    draw2 = 1
    break
    endif
    endif
    next
    
    if draw2 = 1 then
    drawsegment(startindex2,level2,barindex,level2) coloured(128,0,0)
    lastlevel2 = level2
    else
    drawsegment(barindex-1,lastlevel2,barindex,lastlevel2) coloured(128,0,0)
    endif
    endif
    
    return
    
    Screenshot_1-2.png Screenshot_1-2.png
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

Simple 3-test breakout


ProScreener: Market Scanners & Detection

New Reply
Author
Summary

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

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 02/20/2020
Status: Active
Attachments: 3 files
ProRealCode ProRealCode
Loading...