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