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.
-
-
02/02/2017 at 4:42 PM #2363502/02/2017 at 4:48 PM #2363702/02/2017 at 4:48 PM #23638
@ Raul, Can you rewrite the code for 1 second or something like 30seconds or 1 min chart? I tried the backtest and real results for recent 1 week, my backtest show a gain of £196 when my real Live trade lost of £304. a big different when i see the trailing stop 5 still work ok.
02/02/2017 at 6:04 PM #23645Hi All – I have tested the trailing code function that Nicolas suggested and volpiemanuele also tested earlier in #23493 with the following conclusions – Note that we are comparing the original Dax-5-min-v2 strategy with a 5 point trailing stop (labelled v3 in my screenshots below and left pic) with the same strategy using Nicolas trailing stop code (5pt trailing start, 5pt trailing step and 5pt stop loss) – labelled v3.2 in my screenshots and is right pic. Please also note that the actual p&l numbers and differences in stats between the two versions are less relevant here as we are purely testing functionality for this purpose.
1) The results for the coded trailing stop (3.2) are actually not that bad, the drawdown amount and % is quite large so there needs to be some tweaking and testing done but there is some promise.
2) Revised 3.2 produces more realistic results eg. the average time in positions seems correct eg 44s in losing positions vs 0s shown in v3 which is clearly incorrect
3) In the orders list you can see that both versions produce almost identical entry points but vastly different exit prices – suggesting indeed a problem with the way the trailing stop works in original v3 and confirming all our thoughts from earlier.
4) In the closed positions list – with the original v3 embedded PRT trailing stop code the difference between MFE (max favourable execution) and MAE (max adverse execution) ALWAYS EQUALS THE Abs performance (ie P&L) but in the revised coded version 3.2 there is usually a difference suggesting that the trailing function is working properly. This is how it should be as in real trading since a position will never always go straight to the stop loss or take profit limit, as we all know as markets constantly move up/down and never in a straight line. This gives me confidence that Nicolas’s trailing stop code indeed seems correct and is working like it should, it’s the inbuilt trailing stop function in PRT which is incorrectly executed.
Based on the above I would not trust results using the PRT trailing stop function but if you need that ability in any of your strategies please use the written code provided above earlier. Also, I feel that the original strategy Raul has suggested when he started this thread is still worth pursuing based on the revised results but with amended coding and backtesting now we are aware of the issues and limitations. I notice that it has been suggested to use 1sec timeframe which seems like something worth looking into and a step in the right direction. It’s a process, we need to be patient.
02/02/2017 at 6:08 PM #2365102/02/2017 at 7:06 PM #23670Hi nicolas, I have managed to do something, to see what you think, I note that the trailing attached is what it does is close the 5 profit points. I attach the catch made on purpose at that time so you can see that it keeps going up without going back but the operation closes to 5 points.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566// Definición de los parámetros del códigoDEFPARAM CumulateOrders = true // Acumulación de posiciones desactivadaDEFPARAM FlatAfter =174500DEFPARAM PRELOADBARS = 10000indicator2, indicator1 = CALL "valores horarios"c1 = (indicator1 > indicator2)c2 = (indicator1 < indicator2)n=1while time>=090500 and time<=091000 doif time=090613 thenIF c1 THENbuy n contract AT close stopendifIF c2 THENsellshort n contract AT close stopendifendifwendtrailingstart = 5 //trailing will start @trailinstart points profittrailingstep = 5 //trailing step to move the "stoploss"IF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-trailingstep*pipsizeENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIFSET STOP loss 51 user thanked author for this post.
02/02/2017 at 7:07 PM #2367302/02/2017 at 7:29 PM #23675Definitely, pro real time does not do well backtest, regardless of whether you use trailing or normal stop. Attached image 1, program with normal stop 5 and take 10. left what happened in real, right backtest. We see that opens exactly to the same level: 11627.3, in real loses, in the backtest of the winner.
Image 2, what happens tick by tick, we see that we lose because first the price falls and then rises.
02/02/2017 at 7:30 PM #2367802/02/2017 at 8:06 PM #2368602/02/2017 at 8:27 PM #23689@Raul, so what is the best code I should put in the real Live test for next week? Please attach full .itf file here, i will put it on Live trade next week for continue testing. But, consider I dont want to wipe out all my capital yet! Thank you Raul.
02/02/2017 at 8:35 PM #2369102/02/2017 at 8:42 PM #2369202/02/2017 at 9:03 PM #23697Oh dear, I have to agree, Raul I’ve just looked at another one of your earlier strategies in my live results from today to check and come across exactly the same problem you highlighted above. The strategy uses 10pt take profit and 5 point stop loss (ie no trailing). As you can see from the screenshot, the backtest ignores the stop loss completely and returns the 10pt take profit. In reality in the live graph as you can see the 5pt stop loss is triggered – as it correctly should be as the market went through that level.
My logical conclusion from this – I don’t think its the stop loss or take profit function that doesn’t work – if it was then it would affect pretty much every strategy here. It’s the tick by tick backtest function that definitely does not work properly (it’s essentially back to same “zero bar” problem we had before v 10.3) or if it does, it’s intermittent so best not to rely on it until PRT finds the cause and fixes it. This does not look good unfortunately I must say.
P.S – I have the tick by tick box turned on and re-run the backtest a few times just to make sure that there are no fake results.
Edit – I have just tested the strategy with the tick by tick turned off and it provides the same results for today as above (which is obviously wrong) so it’s definitely a problem with the tick by tick module ie its basically being ignored. But not all the results are the same so it’s being used for some trades but not others which is even more strange…..
02/02/2017 at 9:06 PM #23700 -
AuthorPosts
Find exclusive trading pro-tools on