ProRealCode - Trading & Coding with ProRealTime™
// ROBOT VECTORIAL DAX V.3
// M5
// SPREAD 1.5
// by BALMORA 74 - FEBRUARY 2019 /// winnie version 10/04/12019
DEFPARAM CumulateOrders = false
DEFPARAM Preloadbars = 50000
//VARIABLES
CtimeA = time >= 080000 and time <= 180000
CtimeB = time >= 080000 and time <= 180000
ONCE BarLong = 950 //EXIT ZOMBIE TRADE LONG
ONCE BarShort = 650 //EXIT ZOMBIE TRADE SHORT
MoneyManagement = 2
//MoneyManagement = Set to 0 for level stakes. Set to 1 for increasing stake size as profits increase and decreasing stake size as profits decrease. Set to 2 for increasing stake size as profits increase with stake size never being decreased.
RiskManagement = 1
//RiskManagement = 0 = risk management off and 1 = risk management on. I do not recommend using this it can blow up your account very easily!
Capital = 10000
MinBetSize = 1
//MinBetSize = The minimum bet size allowed for the instrument.
RiskLevel = 10
//RiskLevel =A factor that changes how fast position size increases as profit increases. Only relevant if Risk Management is turned on.
Equity = Capital + StrategyProfit
IF MoneyManagement = 1 THEN
PositionSize = Max(MinBetSize, Equity * (MinBetSize/Capital))
ENDIF
IF MoneyManagement = 2 THEN
PositionSize = Max(LastSize, Equity * (MinBetSize/Capital))
LastSize = PositionSize
ENDIF
IF MoneyManagement <> 1 and MoneyManagement <> 2 THEN
PositionSize = MinBetSize
ENDIF
IF RiskManagement THEN
IF Equity > Capital THEN
RiskMultiple = ((Equity/Capital) / RiskLevel)
PositionSize = PositionSize * (1 + RiskMultiple)
ENDIF
ENDIF
PositionSize = Round(PositionSize)
// TAILLE DES POSITIONS
PositionSizeLong = 1 * positionsize
PositionSizeShort = 1 * positionsize
//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 >= 20
CondSell1 = ANGLE <= - 24
//VECTEUR = CALCUL DE LA PENTE ET SA MOYENNE MOBILE
ONCE PeriodeB = 20
ONCE nbChandelierB= 35
lag = 1.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 STOP %LOSS 2
ENDIF
//POSITION COURTE
IF CONDSELL THEN
Sellshort PositionSizeShort contract at market
SET STOP %LOSS 2
ENDIF
//VARIABLES STOP SUIVEUR
ONCE trailingStopType = 1 // Trailing Stop - 0 OFF, 1 ON
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
// 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
// ROBOT VECTORIAL DAX v2
// M5
// SPREAD = 1
// by BALMORA 74 - APRIL 2019
DEFPARAM CumulateOrders = false
DEFPARAM Preloadbars = 50000
//TRADING TIME
CtimeA = time >= 080000 and time <= 180000
CtimeB = time >= 080000 and time <= 180000
//POSITION SIZE
PositionSize = 1
//STRATEGY
ONCE PeriodeA = 10
ONCE nbChandelierA= 15
ONCE PeriodeB = 20
ONCE nbChandelierB= 35
ONCE lag = 1.5
MMA = Exponentialaverage[PeriodeA](close)
ADJASUROPPO = (MMA-MMA[nbchandelierA]*pipsize) / nbChandelierA
ANGLE = (ATAN(ADJASUROPPO))
CondBuy1 = ANGLE >= 35
CondSell1 = ANGLE <= - 40
MMB = Exponentialaverage[PeriodeB](close)
pente = (MMB-MMB[nbchandelierB]*pipsize) / nbchandelierB
trigger = Exponentialaverage[PeriodeB+lag](pente)
//BUY CONDITIONS
CondBuy1 = ANGLE >= 35
CondBuy2 = (pente > trigger) AND (pente < 0)
CondBuy3 = average[100](close) > average[100](close)[1]
CONDBUY = CondBuy1 and CondBuy2 and CondBuy3 and CTimeA
//SHORT CONDITIONS
CondSell1 = ANGLE <= - 40
CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1)
CondSell3 = average[20](close) < average[20](close)[1]
CONDSELL = CondSell1 and CondSell2 and CondSell3 and CtimeB
//POSITION LONGUE
IF CONDBUY THEN
buy PositionSize contract at market
SET STOP %LOSS 2
ENDIF
//POSITION COURTE
IF CONDSELL THEN
Sellshort PositionSize contract at market
SET STOP %LOSS 2
ENDIF
//TRAILING STOP
ONCE trailingStopType = 1 // Trailing Stop - 0 OFF, 1 ON
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
// 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
// ROBOT VECTORIAL DAX v2
// M5
// SPREAD = 1
// by BALMORA 74 - APRIL 2019
DEFPARAM CumulateOrders = false
DEFPARAM Preloadbars = 50000
//TRADING TIME
CtimeA = time >= 080000 and time <= 180000
CtimeB = time >= 080000 and time <= 180000
//POSITION SIZE
PositionSize = 1
//STRATEGY
ONCE PeriodeA = 10
ONCE nbChandelierA= 15
ONCE PeriodeB = 20
ONCE nbChandelierB= 35
ONCE lag = 1.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 >= 35
CondBuy2 = (pente > trigger) AND (pente < 0)
CondBuy3 = average[100](close) > average[100](close)[1]
CONDBUY = CondBuy1 and CondBuy2 and CondBuy3 and CTimeA
//SHORT CONDITIONS
CondSell1 = ANGLE <= - 40
CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1)
CondSell3 = average[20](close) < average[20](close)[1]
CONDSELL = CondSell1 and CondSell2 and CondSell3 and CtimeB
//POSITION LONGUE
IF CONDBUY THEN
buy PositionSize contract at market
SET STOP %LOSS 2
ENDIF
//POSITION COURTE
IF CONDSELL THEN
Sellshort PositionSize contract at market
SET STOP %LOSS 2
ENDIF
//TRAILING STOP
ONCE trailingStopType = 1 // Trailing Stop - 0 OFF, 1 ON
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
// 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
I currently have 5 algo live on dax.
Unfortunately, they have gone bad at the same time and it is expensive.
I am going to run them on demo now instead.I currently have 5 algo live on dax. Unfortunately, they have gone bad at the same time and it is expensive. I am going to run them on demo now instead.I would suggest always running any strategies in a lengthy live forward test in demo to confirm that they are not curve fitted. Yes it is a bit boring and not as exciting as going live but your patience will save you from losing an awful lot of money in the long run. I have strategies that have had on test for a year or more now. They are very profitable but the draw down was bigger than in the in sample test and would have sucked my real account dry if I had just gone live with them. Patience pays!
I tested your code on nasdaq.
changed sl and tp and time.
// ROBOT VECTORIAL DAX v2
// M5
// SPREAD = 1
// by BALMORA 74 - APRIL 2019
DEFPARAM CumulateOrders = false
DEFPARAM Preloadbars = 50000
//TRADING TIME
CtimeA = time >= 150000 and time <= 220000
CtimeB = time >= 150000 and time <= 220000
//POSITION SIZE
PositionSize = 1
//STRATEGY
ONCE PeriodeA = 10
ONCE nbChandelierA= 15
ONCE PeriodeB = 20
ONCE nbChandelierB= 35
ONCE lag = 1.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 >= 35
CondBuy2 = (pente > trigger) AND (pente < 0)
CondBuy3 = average[100](close) > average[100](close)[1]
CONDBUY = CondBuy1 and CondBuy2 and CondBuy3 and CTimeA
//SHORT CONDITIONS
CondSell1 = ANGLE <= - 40
CondSell2 = (pente CROSSES UNDER trigger) AND (pente > -1)
CondSell3 = average[20](close) < average[20](close)[1]
CONDSELL = CondSell1 and CondSell2 and CondSell3 and CtimeB
//POSITION LONGUE
IF CONDBUY THEN
buy PositionSize contract at market
SET STOP %LOSS 2
ENDIF
//POSITION COURTE
IF CONDSELL THEN
Sellshort PositionSize contract at market
SET STOP %LOSS 2
ENDIF
//TRAILING STOP
ONCE trailingStopType = 1 // Trailing Stop - 0 OFF, 1 ON
ONCE trailingstoplong = 8 // Trailing Stop Atr Relative Distance
ONCE trailingstopshort = 5 // Trailing Stop Atr Relative Distance
ONCE atrtrailingperiod = 30 // 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
I tested your code on nasdaq.Not my code!
Not my code!Not even your name! 🙂 Couldn’t resist sorry … as you said Vonasi trading can be lonely and I do enjoy a laugh even if it me making myself laugh!
Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.
Discussing the strategy VECTORIAL DAX (M5)
This topic contains 1,263 replies,
has 125 voices, and was last updated by VinzentVega
1 year, 7 months ago.
| Forum: | ProOrder: Automated Strategies & Backtesting |
| Language: | English |
| Started: | 02/24/2019 |
| Status: | Active |
| Attachments: | 470 files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.