gabri

Modified SHARPE index portfolio strategy

Category: Strategies By: gabri Created: September 19, 2017, 7:22 AM
September 19, 2017, 7:22 AM
Strategies
12 Comments
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!!

// Definizione dei parametri del codice
DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
//n=1
//p=254
// Condizioni per entrare su posizioni long
idx, ignored = CALL "Mio - indice di Sharpe PRT"[254]
sma254=average[254](close)

lim=n*5*1.1
c1=summation[5](idx)>lim
c11=close>sma254
IF c1 and c11 THEN
 BUY 10000 CASH AT market
ENDIF

c3=longonmarket and (barindex-tradeindex)>p
c4=close crosses under sma254
c5=longonmarket and (barindex-tradeindex)>66 and (barindex-tradeindex)<71
c6=longonmarket and (barindex-tradeindex)>130 and (barindex-tradeindex)<135
c7=longonmarket and (barindex-tradeindex)>196 and (barindex-tradeindex)<201


IF c3 then
 SELL AT market
ENDIF

if c4 then
 sell at market
 //sell at low*0.99 stop
endif
if (c5 or c6 or c7) and (summation[5](idx)<lim) then
 sell at market
endif

Download
Filename: mio-sharpe-PRT-AT.itf
Downloads: 327
gabri
gabri Master
This author is like an anonymous function, present but not directly identifiable. More details on this code architect as soon as they exit 'incognito' mode.
Author’s Profile

Comments

gabri
9 years ago
#

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.

gabri
9 years ago
#

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.

simoneb
9 years ago
#

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

AlexF
9 years ago
#

Hi Gertrde, your code gives error at line 24 Wins = positionperf(38)limh is it correct?

gabri
9 years ago
#

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'.

dani85pc
9 years ago
#

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

gabri
9 years ago
#

Dani, 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. Gabriele

dani85pc
9 years ago
#

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

gabri
9 years ago
#

Thanks a lot!!

Gertrade
9 years ago
#

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 c11=close>sma1 c2=summation[4](idx)<limb c21=closep 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 ENDIF // Stops et objectifs SET STOP %LOSS sl SET TARGET %PROFIT tp

gabri
9 years ago
#

Nicolas, 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!!

Nicolas
9 years ago
#

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?

ProRealCode ProRealCode
Loading...