Stock screener Sharp Value

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #81140 quote
    AbzAbz
    Participant
    Veteran

    Hello

    attached is a stock screener posted by Gabri. I am monitoring 25 stocks with this screener and want to know the sharp value on certain historical dates is it a easy way modify this screener code to get that ? or do i need to use it as a indicatior then i need to check it on every stock and a list view in screener windows is much more appreciated.

     

     

    periodo=254
    RitMensNoRiskTitle=0
    a=log(close/close[1])
    b=summation[periodo](a)
    s=sqrt(254)*std[periodo](a)
    
    //computation of modified Sharpe index
    sharpe=(b-RitMensNoRiskTitle/100)/(s*s)
    #81141 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Screeners cannot scan past data, so you’ll have to use it as an indicator, changing dates as they suit you best (not tested):

    periodo=254
    RitMensNoRiskTitle=0
    IF date >= 20150101 AND date <= 20150331 THEN     //dates Jan.1st, 2015 - march 31st,2015
       a=log(close/close[1])
       b=summation[periodo](a)
       s=sqrt(254)*std[periodo](a)
       //computation of modified Sharpe index
       sharpe=(b-RitMensNoRiskTitle/100)/(s*s)
    else
       sharpe=0
    return Sharpe
    #81165 quote
    NicolasNicolas
    Keymaster
    Legend

    Do you want to get the ‘sharpe’ values of a very specific date or just the one from X bars ago from now (today)?

    #81180 quote
    AbzAbz
    Participant
    Veteran

    X bars woud also work for me .

    #81194 quote
    NicolasNicolas
    Keymaster
    Legend

    Ok, so let’s introduce a X setting and screen Sharpe variable within this offset in the past:

    periodo=254
    X = 10
    
    periodo=periodo-X
    RitMensNoRiskTitle=0
    a=log(close/close[1])
    b=summation[periodo](a)
    s=sqrt(254)*std[periodo](a)
    
    //computation of modified Sharpe index
    sharpe=(b-RitMensNoRiskTitle/100)/(s*s)
    
    screener (sharpe[x])
    #81240 quote
    AbzAbz
    Participant
    Veteran

    i tested i out on 35 bars and screener says 7.44 in value and indicator says 10.96 any idea on why it is different?

    #81253 quote
    NicolasNicolas
    Keymaster
    Legend

    Because original code used 254 bars of history for the calculation (data limit for ProScreener), I changed the way it is calculated by the subtracting the desired lookback of 254.

    Just found that I made an error too:

    periodo=254
    X = 10
    
    periodo=periodo-X
    RitMensNoRiskTitle=0
    a=log(close/close[1])
    b=summation[periodo](a)
    s=sqrt(periodo)*std[periodo](a)
    
    //computation of modified Sharpe index
    sharpe=(b-RitMensNoRiskTitle/100)/(s*s)
    
    screener (sharpe[x])
    Abz thanked this post
    #97590 quote
    AbzAbz
    Participant
    Veteran

    Hello

     

    is it possible to write the sharpe value on every 7 candlestick? it will be easy to read the value for each instrument

Viewing 8 posts - 1 through 8 (of 8 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

Stock screener Sharp Value


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Abz @abbas_sadiq Participant
Summary

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

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 09/23/2018
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...