I share this simple strategy with the forum. i put spread 9 against the spread of 7 at 2 am. has been running on the demo for months with positive results. if you come up with something to improve it, contact me. Thank you
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
Defparam cumulateorders = false DEFPARAM PreLoadBars = 100000000 n = 0.50 PERIODO= TIME=020000 if longonmarket then sell at CLOSE-(CLOSE*0.010) STOP //0.012 ENDIF IF SHORTONMARKET THEN EXITSHORT AT CLOSE+(CLOSE*0.0081) STOP //0.0077 ENDIF // STOP LOSS & TAKE PROFIT (%) SL = 0.815 //0.85 TP = 7 //7 //MARGINE = 300 // LONGS & SHORTS : every day except Fridays // entre StartTime et EndTime if PERIODO and dayOfWeek <> 5 AND CLOSE[4]<OPEN[4] AND abs(CLOSE[4]-OPEN[4])>10 then //12 buy n shares at CLOSE+(CLOSE*0.000001) limit //0.000003 endif if PERIODO and dayOfWeek <> 5 AND CLOSE[4]>OPEN[4] AND abs(CLOSE[4]-OPEN[4])>10.50 then SELLSHORT n shares AT CLOSE+(CLOSE*0.00003) limit //0.00003 endif // Stop Loss & Take Profit set stop %loss SL set target %profit TP // Exit Time |
Share this
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 :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
very interesting. I run it in demo. Didi you already run it in real mode?
Ciao si, lo lanciato sul reale ma non da molto tempo. ti farò sapere…
Hello, indeed very good backtest!
Could you tell me what is the approximate amount of overnight charges for 0.5 lot on japan 225 1$? given the amount of the spread, the costs can reduce this excellent performance.
thanks for sharing
Hello adconsulting is there any optimization of the strategy? It looks good till now…
Ciao, ho fatto dei miglioramenti. Allego nuovo codice
Defparam cumulateorders = true
DEFPARAM PreLoadBars = 10000
TradingDaylong = (dayofweek=1 and (time=020000 or time=040000 or time=060000 or time=100000 or time=130000 or time=080000 or time=120000 or time=160000 or time=190000 or time=070000 or time=090000 or time=220000 )) or (dayofweek=2 and (time=100000 )) or (dayofweek=3 and (time=100000 or time=050000 or time=170000 )) or (dayofweek=4 and (time=020000 or time=040000 or time=080000 or time=130000 )) or (dayofweek=5 and (time=100000 or time=040000))
//TradingDaylong = (dayofweek=5 and time=130000)
TradingDayshort = (dayofweek=1 and (time=010000 or time=090000 )) or (dayofweek=2 and ( time=090000 or time=100000 or time=170000 or time=020000 or time=120000 or time=180000 )) or (dayofweek=3 and (time=030000 or time=190000 or time=170000 or time=200000 )) or (dayofweek=4 and ( time=020000 or time=060000 or time=040000 or time=030000 or time=200000 ))
lotnumberlong = 0.70
lotnumbershort = 0.50
if longonmarket then
sell at low-(CLOSE*0.005) STOP //0.012
ENDIF
IF SHORTONMARKET THEN
EXITSHORT AT close+(CLOSE*0.0081) STOP //0.0077
ENDIF
// STOP LOSS & TAKE PROFIT (%)
SLL = 0.95
TPL = 4.50
SLS = 1.20
TPS = 6.40
// LONGS & SHORTS : every day except Fridays
// entre StartTime et EndTime
if TradingDaylong AND CLOSE[4]<OPEN[4] AND abs(CLOSE[4]-OPEN[4])>9 and countoflongshares<=1 and abs(close-open)>close*0.0009 and abs(close-open)<close*0.01 and c4 and c5 and Stochasticd[14,3,5](close)>7 and rsi[16]> 20 and countofshortshares<=lotnumberlong*2.15 and c7 AND C9 then
buy lotnumberlong shares at high+(CLOSE*0.000004) stop//0.000003
set stop %loss SLL
set target %profit TPL
endif
if TradingDayshort AND CLOSE[4]>OPEN[4] AND abs(CLOSE[4]-OPEN[4])>10.50 and countofshortshares<=lotnumbershort*4 and c3 and rsi[16]<83 and close<(high+low)/2 and rsi[16]<70 and Williams[14](close)<-10 and c8 then
SELLSHORT lotnumbershort shares at low-(CLOSE*0.00005) stop//0.00003
set stop %loss SLS
set target %profit TPS
endif
// Stop Loss & Take Profit
if longonmarket and abs(close-open)>close*0.0098 then
sell at market
endif
if shortonmarket and abs(close-open)>close*0.0086 then
exitshort at market
endif
timeframe(daily)
c3 = abs(close-open)<720
c5=rsi[16]>30 and rsi[16]<85 and Williams[14](close)>-82
c6 = Williams[14](close)<-20
c4 = abs(close-open)<800// Close on Monday is below 34-Tg-SMA (daily-TF)
TIMEFRAME(default)
timeframe(4H)
C7=RSI[16]>30 and Cycle(close)<26
c8=RSI[16]<80 and Williams[5](close)>-95
uscitalong=low-(close*0.02)
uscitashort=high+250
TIMEFRAME(default)
timeframe(2H)
C9=RSI[21]>28
TIMEFRAME(default)
d1= close- close[1]>240
d2= close-close[2]>280
d3= close-close[3]>350
if longonmarket and d1 or d2 or d3 then
sell at market
endif
if longonmarket then
sell at uscitalong stop
endif
Ottimo! provo a fare simulazioni e se sono in grado commento…
Ti dico una cosa di prima impressione: vedo si utilizzano entrate multiple inserendo “Defparam cumulateorders = true” … potrebbe essere gradito per una questione di gestione del conto da impegnare, limitare le entrate a un numero definito 2 o 3 massimo. Comunque migliorerebbero il PF dal codice iniziale.
è un po’ più complicato fare il codice però. io ce l’ho impostato in altri sistemi potrei provarci, ma non garantisco che ci riesca 😉
Ciao adconsulting, del nuovo codice di japan 225 cash 1 h, sto provando il nuovo codice da quando lo hai postato, solamente limitandolo ad 1 posizione presa. Va molto bene complimenti (ancora non ho capito con quale criterio funziona mio limite). Non hai altri codici simili su altri strumenti?
Vedi se ti interessa quello che ho postato io su strategie, è weekly, ma vedi come utilizzo più posizioni.
ciao, adesso scarico il tuo codice. Prova quello che ti incollo di seguito. funziona su eur/usd 30 minuti. fammi sapere cosa ne pensi. sta girando da un po’ ed i risultati sono positivi
DEFPARAM CumulateOrders = false
DEFPARAM PreloadBars = 10000
//////////////////////////////////////////////////////////////////
//// Opti
//////////////////////////////////////////////////////////////////
longtrigger = 12
shorttrigger = 62
maperiod = 112
maPeriod1 = 18 // Moving Average Period 100
maType1 = 2 // Moving Average function
stoplossmulti = 8
possizelong = 3
possizeshort =3
TradingDayLong = (dayofweek=1 and (time=050000 or time=100000 or time=190000 or time=020000 or time=010000 or time=050000 or time=190000 or time=170000 or time=073000 or time=180000 or time=200000 or time=123000 or time=080000 or time=140000 or time=070000 or time=153000 or time=183000 or time=220000 or time=003000 or time=030000 or time=210000 or time=033000 or time=043000 )) or (dayofweek=2 and (time=170000 or time=033000 or time=113000 or time=153000 or time=073000 or time=070000 or time=030000 or time=020000 or time=043000 or time=213000 or time=103000 or time=230000 or time=013000 or time=003000 or time=170000 or time=233000 or time=120000 or time=183000 or time=000000 or time=130000 or time=200000 )) or (dayofweek=3 and (time=003000 or time=010000 or time=020000 or time=060000 or time=063000 or time=073000 or time=093000 or time=100000 or time=103000 or time=110000 or time=113000 or time=130000 or time=143000 or time=150000 or time=153000 or time=160000 or time=163000 or time=180000 or time=200000 or time=203000 or time=213000 or time=220000 or time=030000 or time=190000)) or (dayofweek=4 and (time=003000 or time=013000 or time=040000 or time=063000 or time=070000 or time=080000 or time=083000 or time=090000 or time=100000 or time=110000 or time=113000 or time=123000 or time=130000 or time=140000 or time=160000 or time=163000 or time=170000 or time=173000 or time=183000 or time=190000 or time=200000 or time=210000)) or (dayofweek=5 and (time=010000 or time=060000 or time=063000 or time=090000 or time=100000 or time=103000 or time=150000 or time=173000 or time=190000 or time=193000 or time=200000))
//TradingDayLONG= dayofweek=5 and time=203000
//TradingDayshort= dayofweek=4 and time=100000
TradingDayshort = ((dayofweek=1 and (time=160000 or time=163000 )) or (dayofweek=5 and (time=073000 )) or (dayofweek=2 and (time=003000 or time=020000 and time=030000 or time=040000 or time=043000 or time=050000 or time=060000 or time=070000 and time=083000 or time=093000 or time=100000 or time=103000 or time=113000 or time=123000 and time=130000 or time=133000 or time=140000 or time=143000 or time=150000 or time=173000 or time=180000 or time=183000 or time=193000 or time=213000 ))) or (dayofweek=4 and (time=070000 or time=093000 and time=040000 or time=033000 or time=170000 or time=130000 or time=080000 and time=180000 or time=053000 or time=020000 or time=023000))
//////////////////////////////////////////////////////////////////
//// Indicators
//////////////////////////////////////////////////////////////////
IBS = (Close – Low) / (High – Low) * 100
ma = average[maperiod](close)
ma1 = average[maPeriod1, maType1](customClose)
slope1 = ma1 – ma1[1]
//////////////////////////////////////////////////////////////////
//// Entry conditions
//////////////////////////////////////////////////////////////////
b1 = not longonmarket // only open 1 position
b1 = b1 and close < Dhigh(1) // close below yesterday's high
b1 = b1 and IBS ma // close over moving average
b1 = b1 and slope1 > 0 // ma slope is positive
s1 = not shortonmarket // only open 1 position
s1 = s1 and close > Dlow(1) // close above yesterday’s low
s1 = s1 and IBS > shorttrigger // Internal bar strength below trigger value
s1 = s1 and close < ma // close over moving average
s1 = s1 and slope1 Dhigh(1) // close above yesterday’s high
es1 = close 8
timeframe(default)
timeframe(daily)
d1= abs (high-low)<250*PIPSIZE and abs (high[1]-low[1])<250*PIPSIZE and abs (high[2]-low[2])=25
ds=rsi[14]=47
rr2=rsi[14]<56 and rsi[3]<59
timeframe (default)
non mi ha incollato il codice completo. ci riporovo
//// Sport Gold (E1 Contract) Spread 0.5
//////////////////////////////////////////////////////////////////
DEFPARAM CumulateOrders = false
DEFPARAM PreloadBars = 10000
//////////////////////////////////////////////////////////////////
//// Opti
//////////////////////////////////////////////////////////////////
longtrigger = 12
shorttrigger = 62
maperiod = 112
maPeriod1 = 18 // Moving Average Period 100
maType1 = 2 // Moving Average function
stoplossmulti = 8
possizelong = 3
possizeshort =3
TradingDayLong = (dayofweek=1 and (time=050000 or time=100000 or time=190000 or time=020000 or time=010000 or time=050000 or time=190000 or time=170000 or time=073000 or time=180000 or time=200000 or time=123000 or time=080000 or time=140000 or time=070000 or time=153000 or time=183000 or time=220000 or time=003000 or time=030000 or time=210000 or time=033000 or time=043000 )) or (dayofweek=2 and (time=170000 or time=033000 or time=113000 or time=153000 or time=073000 or time=070000 or time=030000 or time=020000 or time=043000 or time=213000 or time=103000 or time=230000 or time=013000 or time=003000 or time=170000 or time=233000 or time=120000 or time=183000 or time=000000 or time=130000 or time=200000 )) or (dayofweek=3 and (time=003000 or time=010000 or time=020000 or time=060000 or time=063000 or time=073000 or time=093000 or time=100000 or time=103000 or time=110000 or time=113000 or time=130000 or time=143000 or time=150000 or time=153000 or time=160000 or time=163000 or time=180000 or time=200000 or time=203000 or time=213000 or time=220000 or time=030000 or time=190000)) or (dayofweek=4 and (time=003000 or time=013000 or time=040000 or time=063000 or time=070000 or time=080000 or time=083000 or time=090000 or time=100000 or time=110000 or time=113000 or time=123000 or time=130000 or time=140000 or time=160000 or time=163000 or time=170000 or time=173000 or time=183000 or time=190000 or time=200000 or time=210000)) or (dayofweek=5 and (time=010000 or time=060000 or time=063000 or time=090000 or time=100000 or time=103000 or time=150000 or time=173000 or time=190000 or time=193000 or time=200000))
//TradingDayLONG= dayofweek=5 and time=203000
//TradingDayshort= dayofweek=4 and time=100000
TradingDayshort = ((dayofweek=1 and (time=160000 or time=163000 )) or (dayofweek=5 and (time=073000 )) or (dayofweek=2 and (time=003000 or time=020000 and time=030000 or time=040000 or time=043000 or time=050000 or time=060000 or time=070000 and time=083000 or time=093000 or time=100000 or time=103000 or time=113000 or time=123000 and time=130000 or time=133000 or time=140000 or time=143000 or time=150000 or time=173000 or time=180000 or time=183000 or time=193000 or time=213000 ))) or (dayofweek=4 and (time=070000 or time=093000 and time=040000 or time=033000 or time=170000 or time=130000 or time=080000 and time=180000 or time=053000 or time=020000 or time=023000))
//////////////////////////////////////////////////////////////////
//// Indicators
//////////////////////////////////////////////////////////////////
IBS = (Close – Low) / (High – Low) * 100
ma = average[maperiod](close)
ma1 = average[maPeriod1, maType1](customClose)
slope1 = ma1 – ma1[1]
//////////////////////////////////////////////////////////////////
//// Entry conditions
//////////////////////////////////////////////////////////////////
b1 = not longonmarket // only open 1 position
b1 = b1 and close < Dhigh(1) // close below yesterday’s high
b1 = b1 and IBS < longtrigger // Internal bar strength below trigger value
b1 = b1 and close > ma // close over moving average
b1 = b1 and slope1 > 0 // ma slope is positive
s1 = not shortonmarket // only open 1 position
s1 = s1 and close > Dlow(1) // close above yesterday’s low
s1 = s1 and IBS > shorttrigger // Internal bar strength below trigger value
s1 = s1 and close < ma // close over moving average
s1 = s1 and slope1 < 0 // ma slope is negative
//////////////////////////////////////////////////////////////////
//// Exit conditions Short
//////////////////////////////////////////////////////////////////
el1 = close > Dhigh(1) // close above yesterday’s high
es1 = close < Dlow(1) // close below yesterday’s low
//////////////////////////////////////////////////////////////////
//// Execution
//////////////////////////////////////////////////////////////////
timeframe(weekly)
w=rsi[3]>8
timeframe(default)
timeframe(daily)
d1= abs (high-low)<250*PIPSIZE and abs (high[1]-low[1])<250*PIPSIZE and abs (high[2]-low[2])<250*PIPSIZE
DL=rsi[14]>=25
ds=rsi[14]<56
timeframe(default)
timeframe(4H)
r1=rsi[14]>=47
rr2=rsi[14]<56 and rsi[3]<59
timeframe (default)
timeframe(2H)
duel=Stochasticd[14,3,5](close)>20
dues=Stochasticd[5,3,5](close)>18
timeframe (default)
if b1 and tradingdayLong and rsi[14]>=52 and r1 and abs(close-open)>2*PIPSIZE and d1 and not shortonmarket and dl and duel and Williams[14](close)<-3 then
buy possizelong contract at market
set stop %loss 0.98
set target %profit 1.75
endif
if s1 and tradingdayshort and abs(close-open)<50*pipsize and abs(close-open)>4*PIPSIZE and rr2 and d1 and not longonmarket and rsi[5]<55 and Stochasticd[14,3,5](close)<60 and Williams[14](close)>-98 and ds and dues then
sellshort possizeshort contract at market
set stop %loss 0.98
set target %profit 1.75
endif
if el1 then
sell at market
endif
if es1 then
exitshort at market
endif
//////////////////////////////////////////////////////////////////
//// Stop loss
//////////////////////////////////////////////////////////////////
if shortonmarket and abs (close-open)>(close*0.011) then
exitshort at market
endif
if shortonmarket then
exitshort at high+close*0.0059 stop
endif
if longonmarket then
sell at low-close*0.0074 stop
endif
IF NOT ONMARKET THEN
TrailingStart = 60 //60 trailing will start @trailinstart points profit
TrailingStep = 40 //30 trailing step to move the “stoploss”
Distance = 7 //7 pips Distance from caurrent price (if required by the broker)
PointsToKeep = 0 //0 pips to be gained when breakeven is set
//reset the stoploss value
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-TradePrice(1)>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
newSL = TradePrice(1)+TrailingStep*PipSize+PointsToKeep*PipSize
ENDIF
//next moves
IF newSL>0 AND close-newSL>=TrailingStep*PipSize THEN
newSL = newSL+TrailingStep*PipSize
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND TradePrice(1)-close>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
newSL = TradePrice(1)-TrailingStep*PipSize+PointsToKeep*PipSize
ENDIF
//next moves
IF newSL>0 AND newSL-close>=TrailingStep*PipSize THEN
newSL = newSL-TrailingStep*PipSize
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
IF LongOnMarket THEN
IF (close + Distance) > newSL THEN
SELL AT newSL STOP
ELSIF (close – Distance) < newSL THEN
SELL AT newSL LIMIT
ELSE
SELL AT Market
ENDIF
ELSIF ShortOnmarket THEN
IF (close + Distance) < newSL THEN
EXITSHORT AT newSL STOP
ELSIF (close – Distance) > newSL THEN
EXITSHORT AT newSL LIMIT
ELSE
EXITSHORT AT Market
ENDIF
ENDIF
ENDIF
//*********************************************************************************
Grazie! ho visto l’ultimo codice e gira correttamente. Lo intendo su eurusd e 30min spred 1p. Risultato storico di ultimi 100000 periodi ottimo (anche troppo!!!) …. Fatico a capire bene come funziona il codice (miei limiti) ….. comunque le perplessità che avrei sono che su altri cross non ha performance paragonabili, è proprio solo per come si è comportato eurusd gli ultimi anni. Non è che è “overfittato” per eurusd? … continuerà ancora?
Vedo che se metto
possizelong = 1
possizeshort = 1
non cambia niente, se non la size… con size 1 posso provare anche un giro in reale… vediamo
Sto facendo girare il sistema sul JAPAN …. very good performance last 2 weeks, congratulations.
PROVA IL CODICE CHE TI ALLEGO. GIRA SU JAPAN BARRE A 3 ORE. SPREAD 9. GIRA MOLTO BENE
Defparam cumulateorders = false
DEFPARAM PreLoadBars = 10000
TradingDaylong = (dayofweek=1 and (time=040000 or time=190000 or time=100000 or time=160000 or time=070000 )) or (dayofweek=2 and (time=100000 or time=190000 or time=220000)) or (dayofweek=3 and ( time=040000 )) or (dayofweek=4 and (time=040000 or time=160000)) or (dayofweek=5 and ( time=040000 or time=070000 or time=160000))
//TradingDaylong = Dayofweek>=1 and dayofweek<=5
TradingDayshort =(dayofweek=1 and (time=030000 or time=040000 )) or (dayofweek=2 and time=050000 ) or (dayofweek=3 and (time=010000 or time=130000 or time=200000 or time=210000 )) or (dayofweek=4 and ( time=030000 or time=210000 ))
// TAILLE DES POSITIONS
nlong = 0.50
nshort = 0
USCITALONG = TIME = 130000
USCITASHORT = TIME = 210000
// STOP LOSS & TAKE PROFIT (%)
SLL = 1.15
TPL = 3.50
SLS = 2.25
TPS = 2.50
//MARGINE = 300
IF USCITALONG and uscita THEN
SELL AT market
ENDIF
IF USCITASHORT THEN
EXITSHORT AT MARKET
ENDIF
timeframe(weekly)
dd3= Williams[2](close)>-84 and rsi[14]>15
timeframe(default)
timeframe(daily)
d1=rsi[18]>35 and Williams[3](close)>-84 and abs(high-low)<close*0.055 and abs(high[1]-low[1])<close*0.055 and abs(close-open)<close*0.055 and close>(high+low)/2
uscita=abs(close-open)>60 and rsi[14]<68
timeframe(default)
timeframe(6h)
dd1=Stochasticd[5,3,5](close)>20 and close>(high+low)/2
r1=Williams[14](close)>-84 and close>(high+low)/2 AND CLOSE>OPEN
uscita1=Stochasticd[5,3,5](close)<60
timeframe(default)
timeframe(3h)
dd2=abs(close-open)<close*0.035
us2=low-200
timeframe(default)
if TradingDaylong and close>open AND ABS(CLOSE-OPEN)>26 AND ABS(CLOSE[1]-OPEN[1])>8 and Williams[14](close)>-84 and r1 and d1 and RSI[3](close)>48 and dd1 and dd2 and dd3 and abs(highest[20](close)-lowest[20](open))>60 AND CLOSE>(high+low)/2 then
buy nlong shares at high+40 stop
set stop %loss SLL
set target %profit TPL
endif
if TradingDayshort AND CLOSE<OPEN AND ABS(CLOSE-OPEN)>28 then
SELLSHORT nshort shares AT HIGH+38 STOP
set stop %loss SLS
set target %profit TPS
endif
// Stop Loss & Take Profit
//****************************************************
if longonmarket and close<open and abs (close-open)> 130 or abs (close-open)> 250 then
sell at market
endif
IF NOT ONMARKET THEN
TrailingStart = 90//83 trailing will start @trailinstart points profit
TrailingStep = 55 //50 trailing step to move the “stoploss”
Distance = 7 //7 pips Distance from caurrent price (if required by the broker)
PointsToKeep = 0 //0 pips to be gained when breakeven is set
//reset the stoploss value
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-TradePrice(1)>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
newSL = TradePrice(1)+TrailingStep*PipSize+PointsToKeep*PipSize
ENDIF
//next moves
IF newSL>0 AND close-newSL>=TrailingStep*PipSize THEN
newSL = newSL+TrailingStep*PipSize
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND TradePrice(1)-close>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
newSL = TradePrice(1)-TrailingStep*PipSize+PointsToKeep*PipSize
ENDIF
//next moves
IF newSL>0 AND newSL-close>=TrailingStep*PipSize THEN
newSL = newSL-TrailingStep*PipSize
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
IF LongOnMarket THEN
IF (close + Distance) > newSL THEN
SELL AT newSL STOP
ELSIF (close – Distance) < newSL THEN
SELL AT newSL LIMIT
ELSE
SELL AT Market
ENDIF
ELSIF ShortOnmarket THEN
IF (close + Distance) < newSL THEN
EXITSHORT AT newSL STOP
ELSIF (close – Distance) > newSL THEN
EXITSHORT AT newSL LIMIT
ELSE
EXITSHORT AT Market
ENDIF
ENDIF
ENDIF
//*********************************************************************************
Ciao ADConsulting, ho fatto il backtest …. notevole, PF 2 e dd molto basso, bel sistema. Vedo è solo Long e gli ultimi 10 anni il Japan225 è stato long… non vorrei che se inverte il sistema va in crisi.
La posizione short come mai è disattivata? non è possibile settare in maniera diversa una versione per lo short? ci provo….
sul time frame 3 h lo short non mi dava buoni risultati. se il mercato scende il programma sta cmq fermo. ha gli indicatori dei time frame superiori che lo bloccano. ciao
Hello, thanks for the strategy. Very interesting indeed. I’m wonderin could someone please provide in plain English why this type of strategy would work on this Japan225 market? I understand how the strategy works but I don’t understand why it works
I had the same thought when I looked at this strategy when it was first published almost two years ago. The original code has held up okay but it has gone a bit sideways in 2023. If you’re looking at the latest revision of the code above on the 3 hour time frame then that looks too overfit to me, there are too many rules and variables which seem to negatively impact performance if I modify them.
Ciao adconsulting e buon 2024! Nel 2023 il japan su 1h è andato molto bene, complimenti, viene mantenuto tale o ci sono modifiche?
buongiorno e Buon Anno anche a te. non ho fatto modifiche. prova il programma che ti copio di seguito su wall street 1 ora. ha size variabile in base alle performance. il long parte a 0.65 e lo short a 1. poi le size variano in base ai risultati. mi sta girando sul conto reale e funziona molto bene
. se ti vendono in mente miglioramenti scrivimi. ciao e grazie
Defparam cumulateorders = false
DEFPARAM PreLoadBars = 10000
TradingDaylong = (dayofweek=1 and (time=020000 or time=040000 or time=050000 or time=100000 or time=120000 or time=130000 or time=160000 or time=170000 or time=180000)) or (dayofweek=2 and (time=040000 or time=060000 or time=160000 or time=170000 or time=220000)) or (dayofweek=3 and (time=170000 or time=200000)) or (dayofweek=4 and (time=010000 or time=020000 or time=050000 or time=170000)) or (dayofweek=5 and (time=010000 or time=080000 or time=090000 or time=200000))
//TradingDaylong = Dayofweek=5 and time=210000
ONCE Capital = 800
once lotnumberlong=0.65
ONCE MinLotsLONG = 0.65
once lotnumbershort=1
ONCE MinLotsSHORT = 1
moltiplicatoresize = (StrategyProfit/capital)+1
IF StrategyProfit StrategyProfit[1] THEN
lotnumberlong = min(max(0.20, (MinLotsLONG*moltiplicatoresize)),MinLotsLONG*18)
//LotNumber = 1
ENDIF
IF StrategyProfit StrategyProfit[1] THEN
LotNumberSHORT = min(max(0.31, (MinLotsSHORT*moltiplicatoresize)),MinLotsSHORT*18)
//LotNumber = 1
ENDIF
USCITALONG = TIME = 220000
// STOP LOSS & TAKE PROFIT (%)
SLL = 0.85
TPL = 3
IF USCITALONG and uscita and dayofweek1 THEN
SELL AT MARKET
ENDIF
timeframe(weekly)
w= Williams[2](close)>-84
timeframe(default)
timeframe(daily)
d1=rsi[18]>35 and Williams[3](close)>-84 and abs(high-low)<close*0.055 and abs(high[1]-low[1])<close*0.055 and abs(close-open)(high+low)/2 and abs(highest[12]-lowest[12])>180 and Stochasticd[5,3,5](close)>25
uscita=abs(close-open)>60 and rsi[14]-82 and close>(high+low)/2 and close>open and rsi[5]>37
uscita1=Stochasticd[5,3,5](close)22 and close>(high+low)/2
timeframe(default)
timeframe(2h)
dd2=abs(close-open)24
us2=low-150
timeframe(default)
if TradingDaylong and Williams[14](close)>-84 and r1 and d1 and RSI[3](close)>54 and dd1 and dd2 and Williams[14](close)28 and RSI[12](close)(high+low)/2 AND ABS(CLOSE-OPEN)>25 AND ABS(CLOSE[1]-OPEN[1])>8 and Williams[5](close)>-60 and close>14000*pipsize and w then
buy lotnumberlong shares at high+10 stop
set stop %loss SLL
set target %profit TPL
endif
if longonmarket and close 90 or abs (close-open)> 250 then
sell at market
endif
TradingDayshort = (dayofweek=1 and (time=000000 or time=030000 or time=040000 or time=050000 or time=090000 or time=110000 or time=140000 or time=100000)) or (dayofweek=2 and (time=020000 or time=040000 or time=160000 or time=170000 or time=210000)) or (dayofweek=3 and (time=080000 or time=130000 or time=140000 or time=160000 or time=200000 or time=210000)) or (dayofweek=4 and (time=000000 or time=030000 or time=040000 or time=090000 or time=200000 or time=210000)) or (dayofweek=5 and (time=010000 or time=050000 or time=140000 or time=160000 or time=190000 or time=210000 or time=220000 or time=170000))
//TradingDayshort = dayofweek=5 and time =220000
TIMEFRAME(daily)
c3s = close<ExponentialAverage[18](close)
TIMEFRAME(default)
USCITASHORT = TIME = 220000
SLS = 0.75
TPS =3
//MARGINE = 300
IF USCITASHORT THEN
EXITSHORT AT MARKET
ENDIF
timeframe(daily)
dls= close<ExponentialAverage[16](close) and rsi[14]<53
timeframe(default)
timeframe(6h)
Z6s= rsi[16]<55
timeframe(default)
timeframe(2h)
d3s=abs (high-low)<close*0.0085 and Williams[14](close)<Williams[14](close)[1]
timeframe(default)
timeframe(4h)
d1s= close<ExponentialAverage[2](close) and Stochasticd[5,3,5](close)<80 and Williams[3](close)<-58
d2s=Stochastic[14,3](close)<81
timeframe(default)
if TradingDayshort AND closeclose*0.0022 and ABS(CLOSE-OPEN)=< close*0.0085 and rsi[14]<70 and d1s and d2s and d3s and rsi[4]<42 and Stochasticd[3,3,5](close)-94 and rsi[3]>3 and close6 and close>16000*pipsize and dls and z6s then
SELLSHORT lotnumberSHORT shares AT close-28 stop
set stop %loss SLS
set target %profit TPS
endif
// Stop Loss & Take Profit
//****************************************************
if shortonmarket then
exitshort at high+close*0.00125 stop
endif
if shortonmarket and ABS(CLOSE-OPEN)>= close*0.0085 or rsi[14]>70 then
exitshort at market
endif
IF NOT ONMARKET THEN
TrailingStart = 85//83 trailing will start @trailinstart points profit
TrailingStep = 52 //50 trailing step to move the “stoploss”
Distance = 7 //7 pips Distance from caurrent price (if required by the broker)
PointsToKeep = 0 //0 pips to be gained when breakeven is set
//reset the stoploss value
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-TradePrice(1)>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
newSL = TradePrice(1)+TrailingStep*PipSize+PointsToKeep*PipSize
ENDIF
//next moves
IF newSL>0 AND close-newSL>=TrailingStep*PipSize THEN
newSL = newSL+TrailingStep*PipSize
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND TradePrice(1)-close>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
newSL = TradePrice(1)-TrailingStep*PipSize+PointsToKeep*PipSize
ENDIF
//next moves
IF newSL>0 AND newSL-close>=TrailingStep*PipSize THEN
newSL = newSL-TrailingStep*PipSize
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
IF LongOnMarket THEN
IF (close + Distance) > newSL THEN
SELL AT newSL STOP
ELSIF (close – Distance) < newSL THEN
SELL AT newSL LIMIT
ELSE
SELL AT Market
ENDIF
ELSIF ShortOnmarket THEN
IF (close + Distance) newSL THEN
EXITSHORT AT newSL LIMIT
ELSE
EXITSHORT AT Market
ENDIF
ENDIF
ENDIF
//*********************************************************************************
Buongiorno ADconsulting, è interessante il wall street 1 ora, ma ci sono degli errori di copia/incolla, non riesco a farlo girare, provo ad indicarli se puoi correggerli:
………….
IF StrategyProfit StrategyProfit[1] THEN ////////////////////// manca un segno ???
lotnumberlong = min(max(0.20, (MinLotsLONG*moltiplicatoresize)),MinLotsLONG*18)
//LotNumber = 1
ENDIF
IF StrategyProfit StrategyProfit[1] THEN ////////////////////// manca un segno ???
……………
……………
timeframe(daily)
d1=rsi[18]>35 and Williams[3](close)>-84 and abs(high-low)<close*0.055 and abs(high[1]-low[1])180 and Stochasticd[5,3,5](close)>25 //////////// manca un segno nella parte “abs(close-open)(high+low)/2 ”
………………
ONCE Capital = 800
once lotnumberlong=0.65
ONCE MinLotsLONG = 0.65
once lotnumbershort=1
ONCE MinLotsSHORT = 1
moltiplicatoresize = (StrategyProfit/capital)+1
IF StrategyProfit StrategyProfit[1] THEN
lotnumberlong = min(max(0.20, (MinLotsLONG*moltiplicatoresize)),MinLotsLONG*18)
//LotNumber = 1
ENDIF
IF StrategyProfit StrategyProfit[1] THEN
LotNumberSHORT = min(max(0.31, (MinLotsSHORT*moltiplicatoresize)),MinLotsSHORT*18)
//LotNumber = 1
ENDIF
d1=rsi[18]>35 and Williams[3](close)>-84 and abs(high-low)<close*0.055 and abs(high[1]-low[1])<close*0.055 and abs(close-open)(high+low)/2 and abs(highest[12]-lowest[12])>180 and Stochasticd[5,3,5](close)>25
prova a vedere se gira adesso
il segno è quello del diverso……………………………
non so perchè ma non me lo fa scrivere. metti il segno minore da quello seguito da quello maggiore… praticamente se il guadagno del programma dopo l’ultima chiusura è diverso da quello della chiusura precedente
Ciao ad! ho provato, ma ora mi esplodono altri errori, sono tutte causa del copia incolla del tuo codice originario, pare che manchino gran parte dei “<", inoltre ci sono altre cose strane che poi non riesco a capire: "…….and d1s and d2s and d3s and rsi[4]3 and close6”
Comunque senza fretta, quando riesci. Tu usi il pulsante “Add PRT code” oppure fai ctrlC-ctrlV ? se no potresti anche fare un altro post e allegare il codice come .itf …..:)))
Defparam cumulateorders = false
DEFPARAM PreLoadBars = 10000
TradingDaylong = (dayofweek=1 and (time=020000 or time=040000 or time=050000 or time=100000 or time=120000 or time=130000 or time=160000 or time=170000 or time=180000)) or (dayofweek=2 and (time=040000 or time=060000 or time=160000 or time=170000 or time=220000)) or (dayofweek=3 and (time=170000 or time=200000)) or (dayofweek=4 and (time=010000 or time=020000 or time=050000 or time=170000)) or (dayofweek=5 and (time=010000 or time=080000 or time=090000 or time=200000))
//TradingDaylong = Dayofweek=5 and time=210000
ONCE Capital = 800
once lotnumberlong=0.65
ONCE MinLotsLONG = 0.65
once lotnumbershort=1
ONCE MinLotsSHORT = 1
moltiplicatoresize = (StrategyProfit/capital)+1
IF StrategyProfit <> StrategyProfit[1] THEN
lotnumberlong = min(max(0.20, (MinLotsLONG*moltiplicatoresize)),MinLotsLONG*18)
//LotNumber = 1
ENDIF
IF StrategyProfit <> StrategyProfit[1] THEN
LotNumberSHORT = min(max(0.31, (MinLotsSHORT*moltiplicatoresize)),MinLotsSHORT*18)
//LotNumber = 1
ENDIF
USCITALONG = TIME = 220000
// STOP LOSS & TAKE PROFIT (%)
SLL = 0.85
TPL = 3
IF USCITALONG and uscita and dayofweek<>1 THEN
SELL AT MARKET
ENDIF
timeframe(weekly)
w= Williams[2](close)>-84
timeframe(default)
timeframe(daily)
d1=rsi[18]>35 and Williams[3](close)>-84 and abs(high-low)<close*0.055 and abs(high[1]-low[1])<close*0.055 and abs(close-open)<close*0.05 and close>(high+low)/2 and abs(highest[12]-lowest[12])>180 and Stochasticd[5,3,5](close)>25
uscita=abs(close-open)>60 and rsi[14]<75
timeframe(default)
timeframe(4h)
r1=Williams[14](close)>-82 and close>(high+low)/2 and close>open and rsi[5]>37
uscita1=Stochasticd[5,3,5](close)<60
timeframe(default)
timeframe(6h)
dd1=Stochasticd[5,3,5](close)>22 and close>(high+low)/2
timeframe(default)
timeframe(2h)
dd2=abs(close-open)<close*0.03 and Stochasticd[5,3,5](close)>24
us2=low-150
timeframe(default)
if TradingDaylong and Williams[14](close)>-84 and r1 and d1 and RSI[3](close)>54 and dd1 and dd2 and Williams[14](close)<-4 and rsi[14]>28 and RSI[12](close)<95 and close>(high+low)/2 AND ABS(CLOSE-OPEN)>25 AND ABS(CLOSE[1]-OPEN[1])>8 and Williams[5](close)>-60 and close>14000*pipsize and w then
buy lotnumberlong shares at high+10 stop
set stop %loss SLL
set target %profit TPL
endif
if longonmarket and close<open and abs (close-open)> 90 or abs (close-open)> 250 then
sell at market
endif
TradingDayshort = (dayofweek=1 and (time=000000 or time=030000 or time=040000 or time=050000 or time=090000 or time=110000 or time=140000 or time=100000)) or (dayofweek=2 and (time=020000 or time=040000 or time=160000 or time=170000 or time=210000)) or (dayofweek=3 and (time=080000 or time=130000 or time=140000 or time=160000 or time=200000 or time=210000)) or (dayofweek=4 and (time=000000 or time=030000 or time=040000 or time=090000 or time=200000 or time=210000)) or (dayofweek=5 and (time=010000 or time=050000 or time=140000 or time=160000 or time=190000 or time=210000 or time=220000 or time=170000))
//TradingDayshort = dayofweek=5 and time =220000
TIMEFRAME(daily)
c3s = close<ExponentialAverage[18](close)
TIMEFRAME(default)
USCITASHORT = TIME = 220000
SLS = 0.75
TPS =3
//MARGINE = 300
IF USCITASHORT THEN
EXITSHORT AT MARKET
ENDIF
timeframe(daily)
dls= close<ExponentialAverage[16](close) and rsi[14]<53
timeframe(default)
timeframe(6h)
Z6s= rsi[16]<55
timeframe(default)
timeframe(2h)
d3s=abs (high-low)<close*0.0085 and Williams[14](close)<Williams[14](close)[1]
timeframe(default)
timeframe(4h)
d1s= close<ExponentialAverage[2](close) and Stochasticd[5,3,5](close)<80 and Williams[3](close)<-58
d2s=Stochastic[14,3](close)<81
timeframe(default)
if TradingDayshort AND close<open and ABS(CLOSE-OPEN)>close*0.0022 and ABS(CLOSE-OPEN)=< close*0.0085 and rsi[14]<70 and d1s and d2s and d3s and rsi[4]<42 and Stochasticd[3,3,5](close)<67 and c3s and Williams[2](close)>-94 and rsi[3]>3 and close<ExponentialAverage[21](close) and ABS(CLOSE[1]-OPEN[1])>6 and close>16000*pipsize and dls and z6s then
SELLSHORT lotnumberSHORT shares AT close-28 stop
set stop %loss SLS
set target %profit TPS
endif
// Stop Loss & Take Profit
//****************************************************
if shortonmarket then
exitshort at high+close*0.00125 stop
endif
if shortonmarket and ABS(CLOSE-OPEN)>= close*0.0085 or rsi[14]>70 then
exitshort at market
endif
IF NOT ONMARKET THEN
TrailingStart = 85//83 trailing will start @trailinstart points profit
TrailingStep = 52 //50 trailing step to move the “stoploss”
Distance = 7 //7 pips Distance from caurrent price (if required by the broker)
PointsToKeep = 0 //0 pips to be gained when breakeven is set
//reset the stoploss value
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-TradePrice(1)>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
newSL = TradePrice(1)+TrailingStep*PipSize+PointsToKeep*PipSize
ENDIF
//next moves
IF newSL>0 AND close-newSL>=TrailingStep*PipSize THEN
newSL = newSL+TrailingStep*PipSize
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND TradePrice(1)-close>=(TrailingStart*PipSize+PointsToKeep*PipSize) THEN
newSL = TradePrice(1)-TrailingStep*PipSize+PointsToKeep*PipSize
ENDIF
//next moves
IF newSL>0 AND newSL-close>=TrailingStep*PipSize THEN
newSL = newSL-TrailingStep*PipSize
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
IF LongOnMarket THEN
IF (close + Distance) > newSL THEN
SELL AT newSL STOP
ELSIF (close – Distance) < newSL THEN
SELL AT newSL LIMIT
ELSE
SELL AT Market
ENDIF
ELSIF ShortOnmarket THEN
IF (close + Distance) < newSL THEN
EXITSHORT AT newSL STOP
ELSIF (close – Distance) > newSL THEN
EXITSHORT AT newSL LIMIT
ELSE
EXITSHORT AT Market
ENDIF
ENDIF
ENDIF
//*********************************************************************************
Ora è tutto ok e gira correttamente!!! Grazie, mi sembra veramente notevole a prima simulazione…. metto la size fissa, non in proporzione al capitale per capirci e lo faccio girare un po’.
Per ora stavo provando il sistema sul Japan-1h, nonostante mi sono messo la size fissa senza cumulare le posizioni che lo penalizza un po’ (Defparam cumulateorders = false) devo dire va moto bene, ha retto anche gli ultimi periodi di mercato.
Hi @adconsulting,
Thanks a lot for these contributions.
I am currently running live 2 of your systems.
Do you mind if I create a thread in the english forum of course citing this thread and your name as I am convinced that
> you are delivering high value content
> it woud be easier to immediatly visualize the backtests
> and I have a couple of questions to understand better how you built this system for my own education.
Are you at ease in english or is it complicated for you ?;-)
But of course you can create this thread yourself ^^
Please let me know
Chris
Ciao @adconsulting, stavo rifacendo un check dei tuoi sistemi, quello su eurusd-30 min… onon capisco se è un problema delle mie simulazioni, ma fa una performance strabiliante fino a giugno/2023 dove inizia prendere dei loss…. hai revisioni di questo?