Hi,
the latest stable version in which I can insert my MM to make backtest is the V 5.0 for both dax and us100 ? Thank you
PaulParticipant
Master
Yes 5.0 is the latest. If it’s stable enough you only find out in live trading.
ok thanks,
but in order to to make my money management work that I need to change?
/ [pc] position criteria (also set a limit to the number of trades a day) (set all high for no impact)
// is influenced by which reset criteria is used
if resetcounter then
pclong = countoflongshares < 2 and longtradecounter < 100 and tradecounter < 3
pcshort = countofshortshares < 2 and shorttradecounter < 100 and tradecounter < 3
else
pclong = countoflongshares < 1 and longtradecounter < 100 and tradecounter < 100
pcshort = countofshortshares < 1 and shorttradecounter < 100 and tradecounter < 100
endif
// has influence on Money Management
PaulParticipant
Master
no changes perhaps? I would use resetcounter=0 and test
@Paul
I insert my MM and set resetcounter=0 and my MM don’t run. The same problem with the version 5.0 on dax. The version 4.2 on dax run very well on my MM. Can you solve the problema. Attach v 5.0 of US100 with my MM. (the same problem in v. 5.0 on dax). Tanks
PaulParticipant
Master
one to many lotti entry in the code! That don’t work.
I’ve changed few settings to adapt the strategie with 1 minute timeframe.
Can anyone show me the backtest with premium PRT? (spread:1, timeframe:1min, market:dax)
Thank you
//-------------------------------------------------------------------------
// Code principal : DAX, 1min, Vectorial V4.2
//-------------------------------------------------------------------------
// ROBOT VECTORIAL DAX v4.2p
// M5
// SPREAD = 1
// by BALMORA 74 - APRIL 2019
DEFPARAM CumulateOrders = false
DEFPARAM Preloadbars = 50000
once enablesl = 1 // stoploss
once enablept = 0 // profit target
once enablets = 1 // trailing stop
// when set display to 1, uncomment graphonprice to have affect visually (comment out graphonprice for trading)
once displaysl = 1 // stop loss
once displaypt = 1 // profit target
once displayts = 1 // trailing stop
once usetimecriteria = 1 // [1] included extra timeschedules not to trade
once holiday = 1 // [1] prevent trading on a german public holiday
once positionweekend = 1 // [1]=keep weekend position then ignore times below
once fridaylastentry = 174500
once fridayclosetime = 225500 // close on last candle on friday to prevent gaps over weekend
sl = 1.5 // % stoploss
pt = 2 // % profit target
// reset at start
if intradaybarindex= 0 then
tradeday = 1
endif
if (not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket))) then
longtradecounter= 0
shorttradecounter = 0
tradecounter=0
endif
// [pc] position criteria (also set a limit to the number of trades a day) (or set high for no impact)
// tradecounter means taking x trades a day max (long / short combined)
// with moneymanagement; set all to 100 to have no effect on moneymanagement
// without moneymangement; i.e. max 1 trade a day set all values to 1
pclong = countoflongshares < 3 and longtradecounter < 10 and tradecounter < 5
pcshort= countofshortshares < 3 and shorttradecounter < 10 and tradecounter < 5
// Money Management
Lotti = 1
// Money Management End
// used for sl/pt/ (not used for ts)
underlaying=100
// not to be optimized !
// underlaying security / index / forex
// profittargets and stoploss have to match the lines
// 0.01 forex [i.e. gbpusd=0.01]
// 1.00 securities [i.e. aapl=1 ;
// 100.00 indexes [i.e. dax=100]
// 100=xauusd
// 100=cl us crude
if holiday then
// prevent trading first week in a new year
if year=2015 and month=1 and day<=4 then
tradeday = 0
elsif year=2016 and month=1 and day<=3 then
tradeday = 0
elsif year=2017 and month=1 and day<=8 then
tradeday = 0
elsif year=2018 and month=1 and day<=7 then
tradeday = 0
elsif year=2019 and month=1 and day<=6 then
tradeday = 0
// prevent trading yearly common holiday's
elsif month=12 and day=25 then // Christmas Day
tradeday = 0
elsif month=12 and day=26 then // Christmas Day
tradeday = 0
// prevent trading on a public holiday in germany; market can be open
elsif year=2019 and month=4 and day=19 then // holiday in germany; Good Friday
tradeday = 0
elsif year=2018 and month=3 and day=30 then // holiday in germany; Good Friday
tradeday = 0
elsif year=2017 and month=4 and day=14 then // holiday in germany; Good Friday
tradeday = 0
elsif year=2019 and month=4 and day=22 then // holiday in germany; Easter Monday
tradeday = 0
elsif year=2018 and month=4 and day=2 then // holiday in germany; Easter Monday
tradeday = 0
elsif year=2017 and month=4 and day=17 then // holiday in germany; Easter Monday
tradeday = 0
elsif month=5 and day=1 then // holiday in germany; Labour Day
tradeday = 0
elsif year=2019 and month=5 and day=30 then // holiday in germany; Ascension Day
tradeday = 0
elsif year=2018 and month=5 and day=10 then // holiday in germany; Ascension Day
tradeday = 0
elsif year=2017 and month=5 and day=25 then // holiday in germany; Ascension Day
tradeday = 0
elsif year=2019 and month=6 and day=10 then // holiday in germany; Whit Monday
tradeday = 0
elsif year=2018 and month=6 and day=21 then // holiday in germany; Whit Monday
tradeday = 0
elsif year=2017 and month=6 and day=5 then // holiday in germany; Whit Monday
tradeday = 0
elsif month=10 and day=3 then // holiday in germany; Unity Day
tradeday = 0
//
else
tradeday = 1
endif
endif
//TRADING TIME
tradetime = time >= 095500 and time < 174500
//tradetime = time >= 160000 and time < 214500
if usetimecriteria then
notradetime=(time>=113000 AND time<120000) OR (time>=133000 and time<160000)
//notradetime = 0
notradetime=not notradetime
else
notradetime=tradetime
endif
//STRATEGY
ONCE PeriodeA = 10
ONCE nbChandelierA= 15
ONCE PeriodeB = 20
ONCE nbChandelierB= 35
ONCE lag = 0.5
MMA = Exponentialaverage[PeriodeA](close)
ADJASUROPPO = (MMA-MMA[nbchandelierA]*pipsize) / nbChandelierA
ANGLE = (ATAN(ADJASUROPPO))
MMB = Exponentialaverage[PeriodeB](close)
pente = (MMB-MMB[nbchandelierB]*pipsize) / nbchandelierB
trigger = Exponentialaverage[PeriodeB+lag](pente)
//BUY CONDITIONS
CondBuy1 = ANGLE >= 30
CondBuy2 = (pente > trigger) AND (pente < 0)
CondBuy3 = average[100](close) > average[100](close)[1]
CONDBUY = CondBuy1 and CondBuy2 and CondBuy3
//SHORT CONDITIONS
CondSell1 = ANGLE <= - 30
CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1)
CondSell3 = average[10](close) < average[10](close)[1]
CONDSELL = CondSell1 and CondSell2 and CondSell3
//POSITION LONGUE
if tradetime then
IF positionweekend and TRADEDAY THEN
IF pclong and CONDBUY and notradetime THEN
buy lotti contract at market
longtradecounter=longtradecounter + 1
tradecounter=tradecounter+1
ENDIF
//POSITION COURTE
IF pcshort and CONDSELL and notradetime THEN
Sellshort lotti contract at market
shorttradecounter=shorttradecounter + 1
tradecounter=tradecounter+1
ENDIF
elsif positionweekend=0 and TRADEDAY THEN
if currentdayofweek<=4 or (currentdayofweek=5 and time<fridaylastentry) then
IF pclong and CONDBUY and notradetime THEN
buy lotti contract at market
longtradecounter=longtradecounter + 1
tradecounter=tradecounter+1
ENDIF
//POSITION COURTE
IF pcshort and CONDSELL and notradetime THEN
Sellshort lotti contract at market
shorttradecounter=shorttradecounter + 1
tradecounter=tradecounter+1
ENDIF
endif
endif
endif
//TRAILING STOP
ONCE trailingstoplong = 4 // Trailing Stop Atr Relative Distance
ONCE trailingstopshort = 4 // Trailing Stop Atr Relative Distance
ONCE atrtrailingperiod = 14 // Atr parameter Value
ONCE minstop = 0 // Minimum Trailing Stop Distance
//----------------------------------------------
atrtrail = AverageTrueRange[atrtrailingperiod]((close/10)*pipsize)/1000
trailingstartl = round(atrtrail*trailingstoplong)
trailingstartS = round(atrtrail*trailingstopshort)
if enablets = 1 THEN
TGL =trailingstartl
TGS=trailingstarts
if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
MAXPRICE = 0
MINPRICE = close
PREZZOUSCITA = 0
ENDIF
if longonmarket then
MAXPRICE = MAX(MAXPRICE,close)
if MAXPRICE-tradeprice(1)>=TGL*pointsize then
if MAXPRICE-tradeprice(1)>=MINSTOP then
PREZZOUSCITA = MAXPRICE-TGL*pointsize
ELSE
PREZZOUSCITA = MAXPRICE - MINSTOP*pointsize
ENDIF
ENDIF
ENDIF
if shortonmarket then
MINPRICE = MIN(MINPRICE,close)
if tradeprice(1)-MINPRICE>=TGS*pointsize then
if tradeprice(1)-MINPRICE>=MINSTOP then
PREZZOUSCITA = MINPRICE+TGS*pointsize
ELSE
PREZZOUSCITA = MINPRICE + MINSTOP*pointsize
ENDIF
ENDIF
ENDIF
if onmarket and PREZZOUSCITA>0 then
EXITSHORT AT PREZZOUSCITA STOP
SELL AT PREZZOUSCITA STOP
ENDIF
if displayts then
//graphonprice PREZZOUSCITA coloured(0,0,255,255) as "trailingstop"
endif
ENDIF
// set stoploss
if enablesl then
if not onmarket then
sloss=0
elsif longonmarket then
sloss=tradeprice(1)-((tradeprice(1)*sl)/underlaying)*pointsize
elsif shortonmarket then
sloss=tradeprice(1)+((tradeprice(1)*sl)/underlaying)*pointsize
endif
SET STOP %LOSS sl
if displaysl then
//graphonprice sloss coloured(255,0,0,255) as "stoploss"
sloss=sloss
endif
endif
// to display profittarget
if enablept then
if not onmarket then
ptarget=0
elsif longonmarket then
ptarget=tradeprice(1)+((tradeprice(1)*pt)/underlaying)*pointsize
elsif shortonmarket then
ptarget=tradeprice(1)-((tradeprice(1)*pt)/underlaying)*pointsize
endif
SET TARGET %PROFIT pt
if displaypt then
//graphonprice ptarget coloured(121,141,35,255) as "profittarget"
ptarget=ptarget
endif
endif
// close position on friday
if positionweekend=0 then
if onmarket then
if currentdayofweek=5 and time=fridayclosetime then
sell at market
exitshort at market
endif
endif
endif
//pp=(positionperf*100)
//graph pp
PaulParticipant
Master
results with your code copy&paste; spread 1
left 200k, right 100k backtest
I found that for this strategy (5min) it’s better to use a different trailingstop, like the one used in dayopen straddle.
hi everybody
This morning, started “Vetorial DAX V5.0” upon my live account.
parameters :
once tradeschedule = 0 //[0]=full; [1]=morning; [2]=lunch; [3]=afternoon
once resetcounter = 1 //[0]=default; [1]=experiment (both connected by position criteria)
once enablesl = 1 // stoploss
once enablept = 0 // profit target
once enablets = 1 // trailing stop
once enablebb = 0 // bollingerband exit (add bb as indicator to have it visually) (all can be combined)
// when set display to 1, uncomment graphonprice to have affect visually (comment out graphonprice for trading)
once displaysl = 0 // stop loss
once displaypt = 0 // profit target
once displayts = 0 // trailing stop
once usetimecriteria = 1 // [1] included extra timeschedules not to trade
once holiday = 1 // [1] prevent trading on a german public holiday
once positionweekend = 1 // [1]=keep weekend position then ignore time below
once fridayclosetime = 225500 // close on last candle on friday to prevent gaps over weekend
once fridaylastentry = 174500
once closeonweekendprofit = 1 // close position in profit before weekend (to lower risk of gaps against position)
once closeonholidayprofit = 0 // close position in profit on a holiday
sl = 2 // % stoploss
pt = 1 // % profit target
positionsize=0.5
I’ll let you know about performance, about each week.
regards
vince
positionsize=0.5 ?
minimum is 1 contact on algos?
@StefanB
With IG markets and CFD Allemagne 30 the minimum position size is 0.5 (see the screenshot below).
Strange, Auto trading(algo?)
When I try to take less than 1 contract on DAX 30, PRT it does not work.
Manual trading works with 0.5 contract but not auto.
Hmm
With IG the minimum of contract is different in Demo and Real. For DAX its 0.5 real, 1 demo.
In real I dont have any problem with 0.5 contract with PRT on DAX.
auto trading does work with position size = 0.5 (DAX 30, at least)