intraday DAX strategy 5min mini1€ spread 1
Forums › ProRealTime English forum › ProOrder support › intraday DAX strategy 5min mini1€ spread 1
- This topic has 502 replies, 34 voices, and was last updated 4 years ago by Asteriks.
-
-
01/25/2017 at 10:38 AM #22393
Hi all. I’ve had a serious problem this morning with the previous version of the code. It sold at 08:05 as it should have and I got stopped out (again as it should have). The problem seems to be when I was stopped out the order was partially executed. I’ve had this problem with other systems I have been working on. When there is a partial executed order, the amount that is partially executed is either bought or sold again. I hope I’m making sense. See the screen shot attached. You can see the order tickets:
08:05:02: executed -5 Dax (@ 11,679.0)
08:05:16: SL : partially executed +4 Dax (@ 11,683.50)
08:05:16: SL : fully executed +1 Dax (@11,684.00)
08:05:18: executed +4 Dax (@11,684.00)
Result is that I have a naked long 4 position (shame as I would have made good money).
Can anyone help with this problem? Has anyone seen it before? The version of the code I’m using is below. Thanks everyone123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657// Definition of parametersDEFPARAM CumulateOrders = false // No accumulation of orders// Position is closed at 4:30 p.m., local market time (London).DEFPARAM FlatAfter =162900Once ordersize=1// Start time (calculation at end of 080000 bar)StartTime = 080500// Only 1 position per dayEndTime = 080600// Max orders & risk multiplier//Margin = 60//Lottfree = 0//orderSize = max(1,1+ROUND((strategyprofit-lottfree)/Margin))//ordersize=min(18,ordersize)If Ordersize > 11 THENOrdersize = 11Endifn=1// Conditions for analysisIf Time >= StartTime and time <= EndTime THENIf not onmarket thenc1 = open < close-2*pointsizec2= open > close-1*pointsizeIF PositionPerf(1) < 0 THENOrderSize = OrderSize/2ELSIF PositionPerf(1)> 0 THENOrderSize =OrderSize+2EndifOrdersize=max(Ordersize,1)// Conditions to enter positionsIF c1 THENbuy Ordersize*n contract AT close+2 stopendifIF c2 THENsellshort Ordersize*n contract AT close-1 stopEndifEndifEndif//Stops & targetSET STOP ploss 4 //5 3SET TARGET pPROFIT 10 //10 1201/25/2017 at 11:04 AM #2239801/25/2017 at 11:20 AM #2240001/25/2017 at 11:37 AM #22407Hello jonjon, in your code the problem I see is that the minimum stop loss is 5, at least in my broker. By the way, the error that you say in the backtest the same day of June can be due to that as maximum can do 500 checks tick by tick by backtest. Try to put the backtest from May 1, 2014 until you get to see if t leaves the problem on the same day.
01/25/2017 at 11:53 AM #22412@Raul and @arcane. Thanks for the replies. I’m not signed up to IG. I realise that I will have minimum SLs to work with (these do seem to change by country). As / when I trade through IG then I will have to change the code accordingly. I may be wrong however at the moment my SL level being 4 instead of 5 (or 6) should not explain the error??
I’ve logged it with PRT as well and I’ll let you know what they say.
01/25/2017 at 4:24 PM #22445Hi,
Today in the first bar has happened again the other day, live has opened later due to the first time pull, in the backtest has opened when due and the first bar has been winning, live has opened later and has lost. It is necessary to prove it well, to see if this is common entry because the price changes very fast.
01/25/2017 at 4:53 PM #22452@Roul
Today all trade in loss..total day -25….I’m out for business travel and what is the difference between real and backtest today ? Thanks
01/25/2017 at 5:27 PM #22459with risk manager, Every 1000 euro of profits, adds a contract.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657// Definición de los parámetros del códigoDEFPARAM CumulateOrders = false // Acumulación de posiciones desactivadaDEFPARAM FlatAfter =173000HoraEntradaLimite = 093000HoraInicio = 090000capital=10000+strategyprofitn=capital/1000if n>100 thenn=100endifif n<10 thenn=10endifif dayofweek=1 then //Mondaydaytrading=1endifif dayofweek=2 then // Tuesdaydaytrading=1endifif dayofweek=3 then // Wednesdaydaytrading=1endifif dayofweek=4 then //Thursdaydaytrading=1endifif dayofweek=5 then // Fridaydaytrading=0endifif Time >= HoraInicio and time <= HoraEntradaLimite and daytrading= 1 thenc1 = open < close-2if not onmarket thenIF c1 THENbuy n contract AT close + 2 stopendifc2= open > close-1IF c2 THENsellshort n contract AT close - 1 stopendifendifendifSET STOP ptrailing 501/25/2017 at 6:08 PM #22462For the strategy, I advise another martingale.
When the program is losing, you increase the position.
This famous martingale is the work of Alembert, French mathematician of the eighteenth century.
In case of loss, the position is increased by one unit, and in case of gain, it is reduced by one unit.12IF PositionPerf(1) < 0 THENOrderSize = OrderSize+2The gain is better.
01/25/2017 at 7:23 PM #22472In my race towards madness I decided to re-edit the code.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364// Definición de los parámetros del códigoDEFPARAM CumulateOrders = false // Acumulación de posiciones desactivadaDEFPARAM FlatAfter =173000capital=strategyprofit+10000n=capital/1000if n>100 thenn=100endifif n<10 thenn=10endifHoraEntradaLimite = 090600HoraInicio = 090500HoraEntradaLimite1 = 091600HoraInicio1 = 091500HoraEntradaLimite2 = 093100HoraInicio2 = 093000if dayofweek=1 then //Mondaydaytrading=1endifif dayofweek=2 then // Tuesdaydaytrading=1endifif dayofweek=3 then // Wednesdaydaytrading=1endifif dayofweek=4 then //Thursdaydaytrading=1endifif dayofweek=5 then // Frifaydaytrading=1endifif Time >= HoraInicio and time <= HoraEntradaLimite and daytrading= 1 or Time >= HoraInicio1 and time <= HoraEntradaLimite1 and daytrading= 1 or Time >= HoraInicio2 and time <= HoraEntradaLimite2 and daytrading= 1 thenc1 = open < close-2if not onmarket thenIF c1 THENbuy n contract AT close+2 stopendifc2= open > close-1IF c2 THENsellshort n contract AT close-1 stopendifendifendifSET STOP ptrailing 55 users thanked author for this post.
01/25/2017 at 7:35 PM #22476Hi, just a thought.. If you want a smaller SL that the broker allows- you can try and play around with this code
1234567891011//========LONG EXIT=======SL=2if longonmarket and close-tradeprice(1)<=-pipsize*SL thensell AT MARKETendif//=========SHORT EXIT====if shortonmarket and close-tradeprice(1)>=pipsize*SL thenexitshort AT MARKETendif01/25/2017 at 8:24 PM #22484Hi!
I tried to run it in live in my demo ig acount and it says that minimum 10 stop is allowed for automated strategies and today it made a loss trade with trailing sl at 5. Same strategy with tick backtest says it won that trade……
Regards
Henrik
01/25/2017 at 8:37 PM #2248601/25/2017 at 9:20 PM #22492off topic i know but worth reading http://www.trade2win.com/boards/spread-betting-cfds/220766-interview-highbury-fx.html
this is a smaller firm than IG and i think and i hope IG have a different way of handling the trades and hedging
but IG is still a market maker and as long they can pass on your wins to someone else (losing) its no problem but if you try to get IG to pay your profits it can be a problem?
dont answer to this here and ruin the thread, start a new topic in general trading in case of any thoughts on this
i dont want to sound negative just try to help
01/26/2017 at 9:47 AM #22541 -
AuthorPosts
Find exclusive trading pro-tools on