I do not get it.
Please, could we include this code in the first Vectorial?
// ROBOT VECTORIAL DAX
// M5
// SPREAD 1.5
// by BALMORA 74 - FEBRUARY 2019
DEFPARAM CumulateOrders = false
DEFPARAM Preloadbars = 50000
//VARIABLES
CtimeA = time >= 080000 and time <= 220000
CtimeB = time >= 080000 and time <= 220000
ONCE BarLong = 950 //EXIT ZOMBIE TRADE LONG
ONCE BarShort = 650 //EXIT ZOMBIE TRADE SHORT
// TAILLE DES POSITIONS
ONCE PositionSizeLong = 1
ONCE PositionSizeShort = 2
//STRATEGIE
//VECTEUR = CALCUL DE L'ANGLE
ONCE PeriodeA = 10
ONCE nbChandelierA= 15
MMA = Exponentialaverage[PeriodeA](close)
ADJASUROPPO = (MMA-MMA[nbchandelierA]*pipsize) / nbChandelierA
ANGLE = (ATAN(ADJASUROPPO)) //FONCTION ARC TANGENTE
CondBuy1 = ANGLE >= 45
CondSell1 = ANGLE <= - 37
//VECTEUR = CALCUL DE LA PENTE ET SA MOYENNE MOBILE
ONCE PeriodeB = 20
ONCE nbChandelierB= 35
lag = 5
MMB = Exponentialaverage[PeriodeB](close)
pente = (MMB-MMB[nbchandelierB]*pipsize) / nbchandelierB
trigger = Exponentialaverage[PeriodeB+lag](pente)
CondBuy2 = (pente > trigger) AND (pente < 0)
CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1)
//ENTREES EN POSITION
CONDBUY = CondBuy1 and CondBuy2 and CTimeA
CONDSELL = CondSell1 and CondSell2 and CtimeB
//POSITION LONGUE
IF CONDBUY THEN
buy PositionSizeLong contract at market
SET TARGET %PROFIT 4.25
ENDIF
//POSITION COURTE
IF CONDSELL THEN
Sellshort PositionSizeShort contract at market
SET TARGET %PROFIT 1.25
ENDIF
//VARIABLES STOP SUIVEUR
ONCE trailingStopType = 1 // Trailing Stop - 0 OFF, 1 ON
ONCE trailingstoplong = 7.5 // Trailing Stop Atr Relative Distance
ONCE trailingstopshort = 4 // Trailing Stop Atr Relative Distance
ONCE atrtrailingperiod = 25 // Atr parameter Value
ONCE minstop = 0 // Minimum Trailing Stop Distance
// TRAILINGSTOP
//----------------------------------------------
atrtrail = AverageTrueRange[atrtrailingperiod]((close/10)*pipsize)/1000
trailingstartl = round(atrtrail*trailingstoplong)
trailingstartS = round(atrtrail*trailingstopshort)
if trailingStopType = 1 THEN
TGL =trailingstartl
TGS=trailingstarts
if not onmarket 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
ENDIF
//EXIT ZOMBIE TRADE
IF POSITIONPERF<0 THEN
IF shortOnMarket AND BARINDEX-TRADEINDEX(1)>= barshort THEN
EXITSHORT AT MARKET
ENDIF
ENDIF
IF POSITIONPERF<0 THEN
IF LongOnMarket AND BARINDEX-TRADEINDEX(1)>= barlong THEN
SELL AT MARKET
ENDIF
ENDIF
Also, I think Vectorial would be interesting.
Simulating trades in strategies like that vectorial version that exits mid candle with trailing stops as well is a whole new nightmare of coding… and the benefit will likely be very small to negative.
I have more interesting fish to fry right now! 🙂
Ok Vonasi.
My system is not Vectorial.
My system only uses a closure:
SET STOP% LOSS 1.5
You just have to include this closure in Vectorial, and later include your code to calculate the real operations and the simulated operations under this circumstance.
Hi Vonasi,
Thanks for your work
I’m not sure to understand.
What is the objective of this, since with simulated trades the gains are less important with quite the same win/loss ratio ?
Thanks
Minor risk, minor drawdown, minor time on market.
What is the objective of this
The objective is to stop Fran55 from keep asking for it! I have pointed out several times that it is not a path worth following!
LOL Thanks @Vonasi
@Fran55
“Minor risk, minor drawdown, minor time on market.”
The more gain you have, generally the more Max DD you have. Not a real problem
And less time Ok but less gain too