CAC Breakout ported to other markets
Forums › ProRealTime English forum › ProOrder support › CAC Breakout ported to other markets
- This topic has 37 replies, 10 voices, and was last updated 7 years ago by Despair.
-
-
08/18/2016 at 4:09 PM #11842
I have been working on getting some more reliable auto strategies incorporated in to my trading along side the manual stuff I do.
I’m testing Nicolas’ code for CAC breakout on different markets at the moment due to the fact that with 200k units and the 15TF you can get 8-9 years of data for increased confidence + the fact of no 0 bars/no fake profits. Prior to this I was using 1min TF to eliminate 0 bars/fake profits on some breakout auto trades that I had made for the major indices but with only 18 months of data, of course the forward testing did not match up to the backtest and I lost confidence.
I’ve tried a few markets but the two I focused on at the moment are DAX and EUR/USD.
I optimised these with 2/3 of the data as suggested to avoid curve fitting. The results are below.
I can give the basic changes here or upload the ITF’s if any one is interested.
Has anyone else had success porting this one to different markets?
2 users thanked author for this post.
08/19/2016 at 5:30 AM #11860Have you calculated with spread or without?
08/19/2016 at 7:38 AM #1186208/19/2016 at 7:42 AM #1186308/19/2016 at 9:13 AM #11865Nice work cosmic. I know some people have successfully adapted the strategy to other markets already. But I’ve never had the chance to investigate more their codes.
I’m pleased to know that you made optimization with In/Out sample, that’s a lot of work to do manually 👌.So yes, this topic could be the new central topic for the breakout strategy experiments! Your modified code is welcome! I’ll do my best to help here. Like I said before I believe in this strategy.
08/19/2016 at 1:18 PM #11874I think I tested it on DAX as well, and the conclusion was that It looked promising. I need to dig in my notes to see where and why I did not pay any further attention for this. Most likely it drowned among all the other codes that I was testing. I fond these notes and Screendumps:
“Looks pretty good on DAX 5 min” unfortunately I did not get the equity curve.
Edit- when I look deeper into this, It was not Nicolas’ code, but Reiners. I seem to remember testing the CAC code. I need to look deeper in my notes
Cheers Kasper
08/19/2016 at 3:30 PM #11890Here is the DAX one. Feel free to take a look at that first while I tidy up EUR/USD. You will see that I added a pprofit limit at the bottom of the code as this improved things slightly. There are some alternate values that are commented that I played around with.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697//-------------------------------------------------------------------------// Main code : Breakout ProOrder EN DAX//-------------------------------------------------------------------------// We do not store datas until the system starts.// If it is the first day that the system is launched and if it is afternoon,// it will be waiting until the next day for defining sell and buy orders//All times are UK Time ZoneDEFPARAM PreLoadBars = 0// Position is closed at 20h00 PMDEFPARAM FlatAfter = 200000// No new position will be initiated after the 16h00 PM candlestickLimitHour = 161500// Market scan begin with the 15 minute candlestick that closed at 8h15 AMStartHour = 081500// The 24th and 31th days of December will not be traded because market close before 7h45 PMIF (Month = 5 AND Day = 1) OR (Month = 12 AND (Day = 24 OR Day = 25 OR Day = 26 OR Day = 30 OR Day = 31)) THENTradingDay = 0ELSETradingDay = 1ENDIF// Variables that would be adapted to your preferencesif time = 074500 then//PositionSize = max(2,2+ROUND((strategyprofit-1000)/1000)) //gain re-invest trade volumePositionSize = 2 //constant trade volume over the timeendifMaxAmplitude = 140 //140 //160MinAmplitude = 24 //24 //15OrderDistance = 7 //7 //10PourcentageMin = 30 //30 //32// Variable initilization once at system startONCE StartTradingDay = -1// Variables that can change in intraday are initiliazed// at first bar on each new dayIF (Time <= StartHour AND StartTradingDay <> 0) OR IntradayBarIndex = 0 THENBuyTreshold = 0SellTreshold = 0BuyPosition = 0SellPosition = 0StartTradingDay = 0ELSIF Time >= StartHour AND StartTradingDay = 0 AND TradingDay = 1 THEN// We store the first trading day bar indexDayStartIndex = IntradayBarIndexStartTradingDay = 1ELSIF StartTradingDay = 1 AND Time <= LimitHour THEN// For each trading day, we define each 15 minutes// the higher and lower price value of the instrument since StartHour// until the buy and sell tresholds are not definedIF BuyTreshold = 0 OR SellTreshold = 0 THENHighLevel = Highest[IntradayBarIndex - DayStartIndex + 1](High)LowLevel = Lowest [IntradayBarIndex - DayStartIndex + 1](Low)// Spread calculation between the higher and the// lower value of the instrument since StartHourDaySpread = HighLevel - LowLevel// Minimal spread calculation allowed to consider a significant price breakout// of the higher and lower valueMinSpread = DaySpread * PourcentageMin / 100// Buy and sell tresholds for the actual if conditions are metIF DaySpread <= MaxAmplitude THENIF SellTreshold = 0 AND (Close - LowLevel) >= MinSpread THENSellTreshold = LowLevel + OrderDistanceENDIFIF BuyTreshold = 0 AND (HighLevel - Close) >= MinSpread THENBuyTreshold = HighLevel - OrderDistanceENDIFENDIFENDIF// Creation of the buy and sell orders for the day// if the conditions are metIF SellTreshold > 0 AND BuyTreshold > 0 AND (BuyTreshold - SellTreshold) >= MinAmplitude THENIF BuyPosition = 0 THENIF LongOnMarket THENBuyPosition = 1ELSEBUY PositionSize CONTRACT AT BuyTreshold STOPENDIFENDIFIF SellPosition = 0 THENIF ShortOnMarket THENSellPosition = 1ELSESELLSHORT PositionSize CONTRACT AT SellTreshold STOPENDIFENDIFENDIFENDIF// Conditions definitions to exit market when a buy or sell order is already launchedIF LongOnMarket AND ((Time <= LimitHour AND SellPosition = 1) OR Time > LimitHour) THENSELL AT SellTreshold STOPELSIF ShortOnMarket AND ((Time <= LimitHour AND BuyPosition = 1) OR Time > LimitHour) THENEXITSHORT AT BuyTreshold STOPENDIF// Maximal risk definition of loss per position// in case of bad evolution of the instrument priceSET STOP PLOSS MaxAmplitudeset target pprofit 190//1902 users thanked author for this post.
08/19/2016 at 8:47 PM #11916EUR/USD
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495// We do not store datas until the system starts.// If it is the first day that the system is launched and if it is afternoon,// it will be waiting until the next day for defining sell and buy orders//All times are in UK timezoneDEFPARAM PreLoadBars = 0// Position is closed at 20h30 PMDEFPARAM FlatAfter = 203000// No new position will be initiated after the 19h45 PM candlestickLimitHour = 200000// Market scan begin with the 15 minute candlestick that closed at 7h45 AMStartHour = 074500// The 24th and 31th days of December will not be traded because market close before 7h45 PMIF (Month = 5 AND Day = 1) OR (Month = 12 AND (Day = 24 OR Day = 25 OR Day = 26 OR Day = 30 OR Day = 31)) THENTradingDay = 0ELSETradingDay = 1ENDIF// Variables that would be adapted to your preferencesif time = 073000 thenPositionSize = 1//max(2,2+ROUND((strategyprofit-1000)/1000)) //gain re-invest trade volume//PositionSize = 2 //constant trade volume over the timeendifMaxAmplitude = 85 //85 //140MinAmplitude = 9 //9 //20OrderDistance = 0 //0 //-4PourcentageMin = 34 //34 //30?// Variable initilization once at system startONCE StartTradingDay = -1// Variables that can change in intraday are initiliazed// at first bar on each new dayIF (Time <= StartHour AND StartTradingDay <> 0) OR IntradayBarIndex = 0 THENBuyTreshold = 0SellTreshold = 0BuyPosition = 0SellPosition = 0StartTradingDay = 0ELSIF Time >= StartHour AND StartTradingDay = 0 AND TradingDay = 1 THEN// We store the first trading day bar indexDayStartIndex = IntradayBarIndexStartTradingDay = 1ELSIF StartTradingDay = 1 AND Time <= LimitHour THEN// For each trading day, we define each 15 minutes// the higher and lower price value of the instrument since StartHour// until the buy and sell tresholds are not definedIF BuyTreshold = 0 OR SellTreshold = 0 THENHighLevel = Highest[IntradayBarIndex - DayStartIndex + 1](High)LowLevel = Lowest [IntradayBarIndex - DayStartIndex + 1](Low)// Spread calculation between the higher and the// lower value of the instrument since StartHourDaySpread = HighLevel - LowLevel// Minimal spread calculation allowed to consider a significant price breakout// of the higher and lower valueMinSpread = DaySpread * PourcentageMin / 100// Buy and sell tresholds for the actual if conditions are metIF DaySpread <= MaxAmplitude THENIF SellTreshold = 0 AND (Close - LowLevel) >= MinSpread THENSellTreshold = LowLevel + OrderDistanceENDIFIF BuyTreshold = 0 AND (HighLevel - Close) >= MinSpread THENBuyTreshold = HighLevel - OrderDistanceENDIFENDIFENDIF// Creation of the buy and sell orders for the day// if the conditions are metIF SellTreshold > 0 AND BuyTreshold > 0 AND (BuyTreshold - SellTreshold) >= MinAmplitude THENIF BuyPosition = 0 THENIF LongOnMarket THENBuyPosition = 1ELSEBUY PositionSize CONTRACT AT BuyTreshold STOPENDIFENDIFIF SellPosition = 0 THENIF ShortOnMarket THENSellPosition = 1ELSESELLSHORT PositionSize CONTRACT AT SellTreshold STOPENDIFENDIFENDIFENDIF// Conditions definitions to exit market when a buy or sell order is already launchedIF LongOnMarket AND ((Time <= LimitHour AND SellPosition = 1) OR Time > LimitHour) THENSELL AT SellTreshold STOPELSIF ShortOnMarket AND ((Time <= LimitHour AND BuyPosition = 1) OR Time > LimitHour) THENEXITSHORT AT BuyTreshold STOPENDIF// Maximal risk definition of loss per position// in case of bad evolution of the instrument priceSET STOP PLOSS MaxAmplitudeset target pprofit 10008/21/2016 at 3:09 PM #1199108/21/2016 at 4:34 PM #11993UK timezone are GMT+1(summertime) so I think you need to add 7 hours everywhere there is a time involved. To be sure try and change things according to the world timezones.
08/28/2016 at 8:30 AM #1232708/28/2016 at 8:31 AM #123281234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495// We do not store datas until the system starts.// If it is the first day that the system is launched and if it is afternoon,// it will be waiting until the next day for defining sell and buy orders//All times are Changed to SG timezoneDEFPARAM PreLoadBars = 0// Position is closed at 20h30 PMDEFPARAM FlatAfter = 033000// No new position will be initiated after the 19h45 PM candlestickLimitHour = 030000// Market scan begin with the 15 minute candlestick that closed at 7h45 AMStartHour = 144500// The 24th and 31th days of December will not be traded because market close before 7h45 PMIF (Month = 5 AND Day = 1) OR (Month = 12 AND (Day = 24 OR Day = 25 OR Day = 26 OR Day = 30 OR Day = 31)) THENTradingDay = 0ELSETradingDay = 1ENDIF// Variables that would be adapted to your preferencesif time = 143000 thenPositionSize = 1//max(2,2+ROUND((strategyprofit-1000)/1000)) //gain re-invest trade volume//PositionSize = 2 //constant trade volume over the timeendifMaxAmplitude = 85 //85 //140MinAmplitude = 9 //9 //20OrderDistance = 0 //0 //-4PourcentageMin = 34 //34 //30?// Variable initilization once at system startONCE StartTradingDay = -1// Variables that can change in intraday are initiliazed// at first bar on each new dayIF (Time <= StartHour AND StartTradingDay <> 0) OR IntradayBarIndex = 0 THENBuyTreshold = 0SellTreshold = 0BuyPosition = 0SellPosition = 0StartTradingDay = 0ELSIF Time >= StartHour AND StartTradingDay = 0 AND TradingDay = 1 THEN// We store the first trading day bar indexDayStartIndex = IntradayBarIndexStartTradingDay = 1ELSIF StartTradingDay = 1 AND Time <= LimitHour THEN// For each trading day, we define each 15 minutes// the higher and lower price value of the instrument since StartHour// until the buy and sell tresholds are not definedIF BuyTreshold = 0 OR SellTreshold = 0 THENHighLevel = Highest[IntradayBarIndex - DayStartIndex + 1](High)LowLevel = Lowest [IntradayBarIndex - DayStartIndex + 1](Low)// Spread calculation between the higher and the// lower value of the instrument since StartHourDaySpread = HighLevel - LowLevel// Minimal spread calculation allowed to consider a significant price breakout// of the higher and lower valueMinSpread = DaySpread * PourcentageMin / 100// Buy and sell tresholds for the actual if conditions are metIF DaySpread <= MaxAmplitude THENIF SellTreshold = 0 AND (Close - LowLevel) >= MinSpread THENSellTreshold = LowLevel + OrderDistanceENDIFIF BuyTreshold = 0 AND (HighLevel - Close) >= MinSpread THENBuyTreshold = HighLevel - OrderDistanceENDIFENDIFENDIF// Creation of the buy and sell orders for the day// if the conditions are metIF SellTreshold > 0 AND BuyTreshold > 0 AND (BuyTreshold - SellTreshold) >= MinAmplitude THENIF BuyPosition = 0 THENIF LongOnMarket THENBuyPosition = 1ELSEBUY PositionSize CONTRACT AT BuyTreshold STOPENDIFENDIFIF SellPosition = 0 THENIF ShortOnMarket THENSellPosition = 1ELSESELLSHORT PositionSize CONTRACT AT SellTreshold STOPENDIFENDIFENDIFENDIF// Conditions definitions to exit market when a buy or sell order is already launchedIF LongOnMarket AND ((Time <= LimitHour AND SellPosition = 1) OR Time > LimitHour) THENSELL AT SellTreshold STOPELSIF ShortOnMarket AND ((Time <= LimitHour AND BuyPosition = 1) OR Time > LimitHour) THENEXITSHORT AT BuyTreshold STOPENDIF// Maximal risk definition of loss per position// in case of bad evolution of the instrument priceSET STOP PLOSS MaxAmplitudeset target pprofit 10008/29/2016 at 4:06 PM #12396I did the porting of nicolas CAC breackout on dax but only changing his values and parameter to fit on dax without any optimization. You may find a thread regarding this.
08/29/2016 at 4:10 PM #12397what parameters have you optimized? Which is the InSample and the Outof sample period?
Thanks
David
08/29/2016 at 4:28 PM #12399Hey David, nice to see you back! Hope everything’s ok on your side.
There’s not much variables to change in this strategy, because it doesn’t rely at all on indicator. I think the only optimized values are these ones:
1234MaxAmplitude = 85 //85 //140MinAmplitude = 9 //9 //20OrderDistance = 0 //0 //-4PourcentageMin = 34 //34 //30?Since it’s Cosmic topic, I let him answer to this question more precisely.
-
AuthorPosts
Find exclusive trading pro-tools on