AbzParticipant
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)
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
Do you want to get the ‘sharpe’ values of a very specific date or just the one from X bars ago from now (today)?
AbzParticipant
Veteran
X bars woud also work for me .
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])
AbzParticipant
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?
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])
AbzParticipant
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