Modified SHARPE index portfolio strategy

Modified SHARPE index portfolio strategy

This simple strategy is a LONG only. It enters the market when the modified SHARPE index crosses  definitely above 1 (I used 1 to cut false signals but 0 could work just fine) and exits in one of the following cases:

1. price crosses below SMA256

2. when, at a trimester check, SHARPE index is not anymore above 1

3. after one year of investment

It works best with 20-30 stocks portfolios, so this strategy should be launched on a selection of stocks.

Blue skies!!

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Nicolas • 09/19/2017 #

    Hi Gabri, thanks a lot for this code and for all the others you already shared with us 🙂
    I think there would be an error in line 31? about the indicator and its limit, if you want to test if the indicator is under the limit for the last 5 periods, the code should be: summation[5](idx < lim)=5
    But I may be wrong?

  2. gabri • 09/19/2017 #

    line 31 is making sure that, on the trimester check, if the summation is below the limit the stock is sold. The way is written works for me. Thanks for keeping en eye on my work!!

  3. Gertrade • 09/19/2017 #

    Hi Gabri, below code buy sell optimized with money management on DAX 4H. Thank’s.
    // Code principal : mio – sharpe DAX 4h
    // Definizione dei parametri del codice
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate

    // Money Management
    Equity = 500+(StrategyProfit*3)
    Risk = 0.1
    n = Max(1,Equity*Risk/51/PipValue)

    // ————
    Losses = positionperf(38)>0
    Wins = positionperf(38)limh
    c4=close crosses under sma1
    c5=longonmarket and (barindex-tradeindex)>8 and (barindex-tradeindex)<52

    IF c3 or c4 or (c5 and (summation[5](idx)p
    c7=close crosses over sma2
    c8=shortonmarket and (barindex-tradeindex)>8 and (barindex-tradeindex)limb)) then
    EXITSHORT AT market

    // Stops et objectifs

  4. gabri • 09/19/2017 #

    Thanks a lot!!

  5. dani85pc • 09/19/2017 #

    ciao gabri, puoi spiegarmi in italiano di cosa si tratta???

  6. gabri • 09/19/2017 #


    questo e’ un sistema di investimento (non trading) o buy and hold come qualcuno lo chiama. Entri lungo quando l’indice di Sharpe supera il valore di 1 (ma va bene anche 0 – trovo che uno lavori meglio come filtro) e tieni il titolo per un anno. Ho aggiunto anche altre due possibili uscite. La prima e’ quando il valore del titolo scende sotto la SMA254 (media mobile semplice a 254 periodi) e la seconda e’ quando il titolo dopo tre mesi non e’ piu’ sopra il valore 1 dell’indice di Sharpe. In realta’ questa sarebbe una strategia da seguire usando solo l’analisi finanziaria ma ho cercato di adattare (per quel poco che e’ possibile) il sistema anche per coloro che preferiscono l’analisi tecnica.


  7. dani85pc • 09/19/2017 #

    pensavo fosse un trading system
    non hai niente del genere??

  8. gabri • 09/19/2017 #

    La differenza tra trading e investing rimane nel tempo di hold. Meno di tre mesi (per qualcuno 6 mesi) e diventa trade, piu’ di tre mesi (per qualcuno 6) e’ investing. Un indicatore fornisce solo segnali e niente piu’.

  9. AlexF • 09/19/2017 #

    Hi Gertrde,
    your code gives error at line 24

    Wins = positionperf(38)limh

    is it correct?

  10. simoneb • 09/19/2017 #

    ciao Gabri, potresti il modo più efficace per selezionare il paniere di 20-30 titoli su cui applicare la strategia? grazie

  11. gabri • 09/19/2017 #

    Simoneb, puoi creare uno screener che cerchi i titoli con un modified sharpe index inferiore a zero (o a uno) e poi manualmente scegli quelli che hanno un trend a salire.

  12. gabri • 09/19/2017 #

    Dimenticavo, i titoli che performano meglio sono quelli che crossano la linea dello zero (o dell’uno se vuoi essere sicuro) ma che arrivano da un price to book (P/B) basso. Io seleziono quasi tutti i miei titoli usando il P/B e il P/E e poi, tra quelli che ho filtrato in questo modo, applico le mie strategie.

Register or


avatar avatar avatar avatar avatar avatar
Related users ' posts
KAMJKAZE thanks, really interesting!
2c95 thanks, why do U prefer average than lowest ? to close under average does'nt mean another...
Ciurno981 il suffit de changer le nombre de contrats à acheter
Ciurno981 Does anyone have the data at 200,000 units, why would I like to see over 5 years?
Ludwig Bonjour Merci pour le code, je souhaite intégrer un break even et mette en place un réinves...
odin i use it on daily Chart only. i use it on stock market for long only startegies. i´m no fan ...
noisette Hi Odin, Thank you for the code. I made sone test with M1 timeframe and results have to be ...
Onega Sorry, a quick question I cannot see on forum please ?...Using ProScreener, how can we get t...
osupero posiciones largas por ahora
ALZ Hi JohnSher, Nice but not the same result Do you have the last itf of it ? Good result i...
dertopen HI Wwhy you said avoiding bear market? Don't you think that we can use this code for short...
maurizio dove si trova lo screener?
macdopa Thanks...
Eric If you have a high percentage winners and the trades are closed with take profit the spread ...
Casenova I Agree with you JaunJ, and Yes Eric, what you say makes sense too. Optimizing the Stop Loss...
ET Thanks for the system Casenova. In determining the high of the past 4 bars, is there a reaso...
Milochenta Hello, I downloaded your strategy and I can not get it to have signals. I work with the fre...
gabri Hi, I am not sure the reason you have this problem. I am not familiar with the free version ...
pixx ciao gabri scusa una domanda mi ptresti spiegare il codice perfavore??
jens_kittner Since 2018 this strategy leads to bankruptcy)))))))
Jan Wind You do not HAVE to run it
Brisvegas As an exersize in writing code its fine but as a tool to make money not so much . If you hap...
JanWd Dear Gabri, could you explain why you have used "RitMensNoRiskTitle" ? In the formula [ ...
JanWd add it as a default variable, to be found on top if you make the indicator Kind regards, Jan
gabri JanWD, in the original sharpe formula (made for portfolios) this is the return for a no-ris...