ProRealTime Screeners

As promised here is one of the stock screeners that I have created. What I have done to make it easier to test and debug is to create a new indicator first. Below are the steps to create an indicator using proRealTime. I have assumed you have logged in and have pro real time up and running.




Step one:
Load any chart and click the indicator/Backtest button.


 Step two:
Click the new indicator button



 Step Three:
Once the Indicator creation form has loaded


You can then copy and paste the code below into the "Progrmming of inciator" box as above.
You do not need the top and bottom lines below with the code starts here & code ends here in them.You need to copy all the code that is between these two lines and paste it in.

All the lines that start REM are comments that I have added. The will be coloured grey in the proRealTime form. Read through these as they explain what each line of code does.

------------CODE STARTS HERE---------------REMOVE THIS LINE--------------------------

REM get ADX & Directional values for a 14 period
ADXValue = ADX[14]
DIMinusValue = DIminus[14]
DIplusValue = DIPlus[14]

REM get the simple moving averages for the 20, 50 & 200 period
MA1 = average[20](close)
MA2 = average[50](close)
MA3 = average[200](close)

REM if the ADX value is greater than 25 then the stock is trending
REM I have used 25 rather than 30. This way I can possibly catch the trend earlier.
REM It's a little more risky but I think it's worh it
if ADXValue >= 25 then
    REM if the DI- is greater than the DI+ then its a down trend so set ADXtrenddriection to -1
    if DIMinusValue > DIPlusValue then
        ADXtrendDirection = -1
    else
        REM if the DI+ is gretare than the DI- then its and uptrend so set ADXtrendDIrection to 1
        if DIPlusValue > DIMinusVAlue then
            ADXtrendDirection = 1
        else
            REM if DI+ = DI- (rare but could happen) then no trend is in place so set ADXTrendDirection to 0
            ADXtrendDirection = 0
        endif
    endif
else
    REM if the ADX value is less than 25 then no trend is in place
    ADXtrendDirection = 0
endif


REM if 200MA greater than 50MA & 50MA greater than 20MA then we can assume there is a down trend in action
REM NB this is not stricktly correct as the MA should also be decreasing. This could possibly be added as an extra check here
REM but will have to wait until another time for now
if MA3 > MA2 and MA2 > MA1 then
    REM down trend so set MAtrendDirection to -1
    MAtrendDirection = -1
else
    REM if 20MA greater than 50MA & 50MA greater than 200MA then we can assume there is a up trend in action
    if MA1 > MA2 And MA2 > MA3 then
        REM up trend so set MAtrend direction to 1
        MAtrendDirection = 1
    else
        REM no trend in place soe set MATrendDirection to 0
        MAtrendDirection = 0
    endif
endif

REM if the MA indicate an uptrend or the ADX indicates an uptrend then then set the trend direction to 1
REM NB this could be changed to require both of these to be true to qualify for an uptrend. It really just depends on your preference
if MAtrendDirection = 1 or ADXtrendDirection = 1 then
    trendDirection = 1
else
    REM is the MA indicate a down trend or the ADX indicates a down trend then set the trend direction to -1
    if MAtrendDirection = -1 or MAtrendDirection = -1 then
        trendDirection = -1
    else
        REM if no up or down trend the set the trend direction to 0
        trendDirection = 0
    endif
endif

REM return the trend direction
REM -1 = down trend
REM 1 = up trend
REM 0 = no trend
return trendDirection

------------CODE ENDS HERE---------------REMOVE THIS LINE--------------------------


Step 4:

You need to give your new indiactor a name, I've just called mine upTrend/DownTrend and then click the validate program button.


If it has all worked correctly you should see your indicator added to your chart.


You should also see the following form after creating the indicator. You can just click the close button as nothing needs to be changed.


If you take a look at the indicator on your chart you should see it indicating the uptrends and down trends of the price action. Reminder: 1 = uptrend, 0 = no trend and -1 = down trend

So we now have an indicator which shows if a stock is trending or not.
Now we need to write another indicator to find our potential setups for the day.

So repeat steps one and two above to create a new indicator.

I have called this next indicator Setups

The code for the indicator is below


------------CODE STARTS HERE---------------REMOVE THIS LINE--------------------------
REM set indicator1 to be the value from our UpTrend/DownTrend indicator
indicator1 = CALL "UPTrend/DownTrend"(close)

REM get the close price for today
val1 = close
REM get the close price for yesterday
val2 = close[1]
REM get the close price for two days ago
val3 = close[2]
REM get the close price for three days ago
val4 = close[3]

REM if our indicator signals an uptrend
if indicator1 = 1 then
    REM if todays close is less than yesterdays close
    REM and yestdays close is less than the close of two days ago
    REm and the close of two days ago is less than the close of three days ago
    REM therefore the close has pulled back for atleast three days
    if val1 < val2 and val2 < val3 and val3 < val4 then
        REM set signal to 1 to indicate a possible set up to go long on an uptrend
        signal = 1
    else
        REM set signal to 0 indicating no setup has occurred
        signal = 0
    endif
else
    REM if our indicator signals a down trend
    if indicator1 = -1 then
        REM if todays close is greater than yesterdays close
        REM and yestdays close is greater than the close of two days ago
        REM and the close of two days ago is greater than the close of three days ago
        REM therefore the close has rallied for atleast three days
        if val1 > val2 and val2 > val3 and val3 > val4 then
            REM set signal to -1 to indicate possible setup to go short on a down trend
            signal = -1
        else
            REM set signal to 0 indicating no setup has occurred
            signal = 0
        endif
    else
        REM set signal to 0 indicating no setup has occurred
        signal = 0
    endif
endif

REM signal = 1 possible long trade
REM signal = -1 possible short trade
REM signal = 0 no trade setup present
return signal
------------CODE ENDS HERE---------------REMOVE THIS LINE--------------------------

Finish creating the indicator as before.

So now we have two new indicators. They will probably both be displayed on your chart. You can leave them on there for now but once we have created our screener you can remove them from the chart.

So next we create our screener.

Step one:

Load the proScreener list


Once the list has loaded click the set ProScreener button


Then click the New ProScreener button


Once the form has loaded copy and paste the code below into the code box.


------------CODE STARTS HERE---------------REMOVE THIS LINE--------------------------
indicator1 = CALL Setups
c1 = (indicator1 = -1.0)



SCREENER[c1] ((close/DClose(1)-1)*100 AS "% Chg yesterday")
------------CODE ENDS HERE---------------REMOVE THIS LINE--------------------------

One thing to note here is where I have CALL setups in the code this will need to be set to what ever you call your screener.

The code above is for spotting potential setups for a down trend. The code for finding potential up trend setups is below.

------------CODE STARTS HERE---------------REMOVE THIS LINE--------------------------
indicator1 = CALL Setups
c1 = (indicator1 = 1.0)



SCREENER[c1] ((close/DClose(1)-1)*100 AS "% Chg yesterday")

------------CODE ENDS HERE---------------REMOVE THIS LINE--------------------------


In the Selection of list section on the right hand side you need to select which list you want to run your screener on. I always select the uk 300 but theres no reason you couldn't use it for any of the others.


So I think that's about everything. Once you have pasted the code into the screener click validate program and it should find any potential setups for that day.

Once you have done all this I would reccomend you click save so you don't lose all your hard work if proRealTime crashes on you.


If you have any problems with these just let me know and I'll do my best to help you with them.
Obviously the values for ADX & MA are not set in stone and feel free to change and experiment with them. If you do make changes and find you are having some success with them then please let me know and I will add a note here to indicate some other values that people can try.

Don't take my posting here as a trade recommendation. The information contained within this blog is for educational purposes only and should not be taken as advice of any kind. The author of this blog will not accept any responsibily for any loss made by anyone acting or refraining to act as a result of reading material contained within this blog.

Reading list