How to program a new screener?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #236442 quote
    cahlucas
    Participant
    New

    Hi all,

    I would like to create a screener that selects stocks between the most recent support and resistance levels, such that the price is still somewhat away from the point at which the price changes direction. So the share price is between the most recent top and bottom in the chart. The attachment shows what I mean. No use is made of MAs or the like. The screener should work in both a bull and a bear market, although this can also be split into two Screeners. Furthermore, the Screener(s) must work with both a daily and an hourly time frame. Problem is that I don’t know how to program that in Proscreener. Can anyone give me some good ideas?

    Part-of-chart.png Part-of-chart.png
    #236445 quote
    robertogozzi
    Moderator
    Master

    This is the indicator showing Support and Resistance levels:

    DEFPARAM CalculateOnLastBars = 1000
    PivotBAR     = 2                      //2  bars AFTER  pivot
    LookBack     = 4                      //4  bars BEFORE pivot
    BarLookBack  = PivotBAR + 1
    IF low[PivotBAR] < lowest[LookBack](low)[BarLookBack] THEN
       IF low[PivotBAR] = lowest[BarLookBack](low) THEN
          MySupport     = BarIndex - PivotBAR
          SupportPrice  = low[PivotBAR]
       ENDIF
    ENDIF
    IF high[PivotBAR] > highest[LookBack](high)[BarLookBack] THEN
       IF high[PivotBAR]  = highest[BarLookBack](high) THEN
          MyResistance    = BarIndex - PivotBAR
          ResistancePrice = high[PivotBAR]
       ENDIF
    ENDIF
    DRAWSEGMENT(MyResistance,ResistancePrice,BarIndex,ResistancePrice) COLOURED(255,0,0,255)
    DRAWSEGMENT(MySupport,SupportPrice,BarIndex,SupportPrice)          COLOURED(0,128,0,255)
    RETURN

    and this is the screener to scan the market:

    PivotBAR     = 2                      //2  bars AFTER  pivot
    LookBack     = 4                      //4  bars BEFORE pivot
    BarLookBack  = PivotBAR + 1
    IF low[PivotBAR] < lowest[LookBack](low)[BarLookBack] THEN
       IF low[PivotBAR] = lowest[BarLookBack](low) THEN
          MySupport     = BarIndex - PivotBAR
       ENDIF
    ENDIF
    IF high[PivotBAR] > highest[LookBack](high)[BarLookBack] THEN
       IF high[PivotBAR]  = highest[BarLookBack](high) THEN
          MyResistance    = BarIndex - PivotBAR
       ENDIF
    ENDIF
    Cond = (low >= MySupport) AND (high <= MyResistance)
    SCREENER[Cond AND (high <> low)]

    you can use it on any timeframe of your choice. You can make duplicates of it and run it simulaneously (provided this is supported by your platform) on different TFs.

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

How to program a new screener?


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
cahlucas @cahlucas Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
1 year, 6 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 08/17/2024
Status: Active
Attachments: 2 files
Logo Logo
Loading...