GaelParticipant
Average
Salve,
volevo chiedervi la realizzazione di queste due idee in trading system:
1)
- Buy alla comparsa di un segnale SAR sotto le candele
- Sell alla comparsa di un segnale SAR sopra le candele
- Trailling stop sul segnale SAR, e va a spostarsi alla comparsa del nuovo segnale.
2)
Il secondo trading system è simile al primo, solo che chiude il sistema al raggiungimento del 12 segnale SAR consecutivo. Nel caso i segnali SAR dovessero essere inferiori a 12, il sistema chiude al segnale SAR inverso.
Grazie mille in anticipo
1 / questo sistema è molto semplice da creare con la creazione assistita, hai provato prima? Ad ogni modo, ecco qualcosa con cui puoi giocare:
defparam cumulateorders=false
isar = SAR[0.02,0.02,0.2]
if not longonmarket and close crosses over isar then
buy at market
sell at isar stop
endif
if not shortonmarket and close crosses under isar then
sellshort at market
exitshort at isar stop
endif
if longonmarket then
sell at isar stop
endif
if shortonmarket then
exitshort at isar stop
endif
2 / quel sistema taglia gli ordini quando ISAR è 12 volte consecutive dello stesso colore:
defparam cumulateorders=false
isar = SAR[0.02,0.02,0.2]
if not longonmarket and close crosses over isar then
buy at market
endif
if not shortonmarket and close crosses under isar then
sellshort at market
endif
bcount = summation[12](close>isar)=12
if bcount and longonmarket then
sell at market
endif
scount = summation[12](close<isar)=12
if scount and shortonmarket then
exitshort at market
endif
GaelParticipant
Average
Ho provato prima, ma sono ancora un principiante e volevo avere conferma, comunque grazie mille.
Buona giornata
GaelParticipant
Average
Scusa il disturbo, ma non riesco a metterlo in .itf
Basta creare una nuova strategia e inserire il codice lì, è facile 🙂
GaelParticipant
Average
Mi da la riga 1,6,7,9 con il punto esclamativo se faccio: indicatori –> nuovo –> incolla
Li devi copiare in una strategia non in un indicatore.
Eccoli
Ciao Gael
Visto che sei alle prime armi per aiutarti ti ho creato delle piccole aggiunte che ti verranno utili con il proseguo della tua esperienza che farai nella programmazione.
Ti ho aggiunto Target dinamico (con Atr ) e stop loss in percentuale e numero massimo di barre (oltre il sistema esce dalla posizione).
Il tutto è stato distinto se sono operazioni Long o Short.
Ciao
Buona Fortuna
defparam cumulateorders=false
isarlong = SAR[0.04,0.04,0.6]
isarShort = SAR[0.07,0.07,0.1]
if not longonmarket and close crosses over isarlong then
buy at market
sell at isarlong stop
set target profit 10* averagetruerange[5](close)
set Stop %loss 1.8
endif
if longonmarket then
sell at isarlong stop
endif
if not shortonmarket and close crosses under isarshort then
sellshort at market
exitshort at isarshort stop
set target profit 8* averagetruerange[12](close)
set Stop %loss 1.2
endif
if shortonmarket then
exitshort at isarshort stop
endif
// NUMERO BARRE OTTIMALI
ONCE maxCandlesLongWithProfit = 17 // profitto long
ONCE maxCandlesShortWithProfit = 10 // profitto short
ONCE maxCandlesLongWithoutProfit = 12 // Limite long
ONCE maxCandlesShortWithoutProfit = 9 // Limite short
posProfit = (((close - positionprice) * pointvalue) * countofposition) / pipsize
numberCandles = (BarIndex - TradeIndex)
m1 = posProfit > 0 AND numberCandles >= maxCandlesLongWithProfit
m2 = posProfit > 0 AND numberCandles >= maxCandlesShortWithProfit
m3 = posProfit < 0 AND numberCandles >= maxCandlesLongWithoutProfit
m4 = posProfit < 0 AND numberCandles >= maxCandlesShortWithoutProfit
IF LONGONMARKET AND (m1 OR m3) THEN
SELL AT MARKET
ENDIF
IF SHORTONMARKET AND (m2 OR m4) THEN
EXITSHORT AT MARKET
ENDIF
Questi sono i risultati con Dax 2 ore
GaelParticipant
Average
Grazie mille, sembra veramente molto interessante