This automated trading strategy is coming from the French ProBacktest/ProOrder documentation itself. I made an article about it that you can read just here : http://www.prorealcode.com/blog/automated-breakout-trading-strategy-french-cac40/
It deals with breakout of the last high and low price levels of the first 2 15 minutes bars of the market open, french time. It’s an intraday strategy with great rewards when prices make real nice breakout. The strategy take only 2 positions maximum each every day as it tries to deals with a first false breakout and take the over side position while the price break the other price level.
I suggest you to read look at my trading journal on forum, while i am trading it myself on a small personnal account.
Here is the code with the constant trade volume (no gain is re-invest into the lot) :
// 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
DEFPARAM PreLoadBars = 0
// Position is closed at 7h45 PM, french time (in case of CAC40 trading)
DEFPARAM FlatAfter = 194500
// No new position will be initiated after the 5h00 PM candlestick
LimitHour = 171500
// Market scan begin with the 15 minute candlestick that closed at 9h15 AM
StartHour = 091500
// The 24th and 31th days of December will not be traded because market close before 7h45 PM
IF (Month = 5 AND Day = 1) OR (Month = 12 AND (Day = 24 OR Day = 25 OR Day = 26 OR Day = 30 OR Day = 31)) THEN
TradingDay = 0
ELSE
TradingDay = 1
ENDIF
// Variables that would be adapted to your preferences
if time = 084500 then
//PositionSize = max(2,2+ROUND((strategyprofit-1000)/1000)) //gain re-invest trade volume
PositionSize = 2 //constant trade volume over the time
endif
MaxAmplitude = 32.5
MinAmplitude = 11
OrderDistance = 4
PourcentageMin = 30
// Variable initilization once at system start
ONCE StartTradingDay = -1
// Variables that can change in intraday are initiliazed
// at first bar on each new day
IF (Time <= StartHour AND StartTradingDay <> 0) OR IntradayBarIndex = 0 THEN
BuyTreshold = 0
SellTreshold = 0
BuyPosition = 0
SellPosition = 0
StartTradingDay = 0
ELSIF Time >= StartHour AND StartTradingDay = 0 AND TradingDay = 1 THEN
// We store the first trading day bar index
DayStartIndex = IntradayBarIndex
StartTradingDay = 1
ELSIF 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 defined
IF BuyTreshold = 0 OR SellTreshold = 0 THEN
HighLevel = Highest[IntradayBarIndex - DayStartIndex + 1](High)
LowLevel = Lowest [IntradayBarIndex - DayStartIndex + 1](Low)
// Spread calculation between the higher and the
// lower value of the instrument since StartHour
DaySpread = HighLevel - LowLevel
// Minimal spread calculation allowed to consider a significant price breakout
// of the higher and lower value
MinSpread = DaySpread * PourcentageMin / 100
// Buy and sell tresholds for the actual if conditions are met
IF DaySpread <= MaxAmplitude THEN
IF SellTreshold = 0 AND (Close - LowLevel) >= MinSpread THEN
SellTreshold = LowLevel + OrderDistance
ENDIF
IF BuyTreshold = 0 AND (HighLevel - Close) >= MinSpread THEN
BuyTreshold = HighLevel - OrderDistance
ENDIF
ENDIF
ENDIF
// Creation of the buy and sell orders for the day
// if the conditions are met
IF SellTreshold > 0 AND BuyTreshold > 0 AND (BuyTreshold - SellTreshold) >= MinAmplitude THEN
IF BuyPosition = 0 THEN
IF LongOnMarket THEN
BuyPosition = 1
ELSE
BUY PositionSize CONTRACT AT BuyTreshold STOP
ENDIF
ENDIF
IF SellPosition = 0 THEN
IF ShortOnMarket THEN
SellPosition = 1
ELSE
SELLSHORT PositionSize CONTRACT AT SellTreshold STOP
ENDIF
ENDIF
ENDIF
ENDIF
// Conditions definitions to exit market when a buy or sell order is already launched
IF LongOnMarket AND ((Time <= LimitHour AND SellPosition = 1) OR Time > LimitHour) THEN
SELL AT SellTreshold STOP
ELSIF ShortOnMarket AND ((Time <= LimitHour AND BuyPosition = 1) OR Time > LimitHour) THEN
EXITSHORT AT BuyTreshold STOP
ENDIF
// Maximal risk definition of loss per position
// in case of bad evolution of the instrument price
SET STOP PLOSS MaxAmplitude
You must be logged in to post a comment.
Hey Guys,
I really like this strategy, but I would like to change the stop loss level. In the code the level is set at MaxAmplitude.
I would like it to be at at the same level as the stop buy/sell orders.
So I tried it like this
27 StopSize = Dayspread - (2*OrderDistance)
92 SET STOP PLOSS StopSize
Most of the time it seems correct, but I get a slightly different result for the backtest, because at some days the stop level is not correct.
Any idea what might be the problem?
I am thankful for every help!
Cheers
Flo
@nicolas
buonasera nicolas , grazie di nuovo per la tua risposta, sono un nuovo appassionato di trading, questo è un forum molto interessante.
avrei un paio di cose da chiederti, la prima quanto è secondo te l'importo minimo per fare funzionare questi sistemi di trading in maniera proficua, poi se si devono lasciare sempre attivi e infine come impostare stop loss un po meno devastanti.
(Non riesco ad impostarlo su super trend against trend perché mi dice che devo usare stopprice invece dei pips)
Ho lanciato alcuni trading system su Dax, cac, eurusd con risultati molto deludenti. Pur intravedendo un grosso potenziale...
Ti ringrazio se vorrai aiutarmi a crescere e ad avere meno perdite con qualche nozione di base...
grazie infinite e buona serata
Alfredo's code tweaked to work on GBPUSD 15 min. Since 30 December the backtest shows 109.3% increase. I only changed the times, MinAmplitude, & PourcentageMin.
// Position is closed at 4h45 PM, frenh time (in case of CAC40 trading)
DEFPARAM FlatAfter = 164500
// No new position will be initiated after the 4h00 PM candlestick
LimitHour = 160000
// Market scan begin with the 15 minute candlestick that closed at 5h30 AM
StartHour = 053000
// Variables that would be adapted to your preferences
if time = 053000 then
PositionSize = max(2,2+ROUND((strategyprofit-1000)/1000)) //gain re-invest trade volume
//PositionSize = 2 //constant trade volume over the time
endif
MaxAmplitude = 80
MinAmplitude = 14
OrderDistance = 4
PourcentageMin = 41
buonasera nicolas , grazie di nuovo per la tua risposta, sono un nuovo appassionato di trading, questo è un forum molto interessante.
avrei un paio di cose da chiederti, la prima quanto è secondo te l’importo minimo per fare funzionare questi sistemi di trading in maniera proficua, poi se si devono lasciare sempre attivi e infine come impostare stop loss un po meno devastanti.
(Non riesco ad impostarlo su super trend against trend perché mi dice che devo usare stopprice invece dei pips)
Ho lanciato alcuni trading system su Dax, cac, eurusd con risultati molto deludenti. Pur intravedendo un grosso potenziale…
Ti ringrazio se vorrai aiutarmi a crescere e ad avere meno perdite con qualche nozione di base…
grazie infinite e buona serata
Ciao Nicolas, ho settato tutto come tu hai detto ma con timeframe 15min, ora italiana, 100000 unita, non produce nessuna transazione in proorder, puoi brevemente riassumere i parametri di funzionamento e spiegarmi perche sulla mia piattaforma prorealtime il tuo robot non funziona?
grazie
buonasera nicolas , grazie di nuovo per la tua risposta, sono un nuovo appassionato di trading, questo è un forum molto interessante.
avrei un paio di cose da chiederti, la prima quanto è secondo te l’importo minimo per fare funzionare questi sistemi di trading in maniera proficua, poi se si devono lasciare sempre attivi e infine come impostare stop loss un po meno devastanti.
(Non riesco ad impostarlo su super trend against trend perché mi dice che devo usare stopprice invece dei pips)
Ho lanciato alcuni trading system su Dax, cac, eurusd con risultati molto deludenti. Pur intravedendo un grosso potenziale…
Ti ringrazio se vorrai aiutarmi a crescere e ad avere meno perdite con qualche nozione di base…
grazie infinite e buona serata
Also Nicolas, I don't understand how you're getting these performance figures here? :
http://www.prorealcode.com/topic/proorder-breakout-on-french-cac40-my-account-performances/
I'm using the same code with
MaxAmplitude = 58
MinAmplitude = 11
OrderDistance = 4
PourcentageMin = 30
and CAC40 market and 15 timeframe and it makes losses straight away whichever month you start from this year?
What Commission and Spread figures do you use live?
Thanks
If the CAC40 Breakout System is not performing as well (because it would seem, looking at the chart the market is now going into sideways price action) why not incorporate - Futures Truth Magazine Top 10 Trading System designer - Randy Stuckey's Choppiness Index used in Cat Scan IV?
p=30
//30 is the daily setting recommendation Stuckey used for every commodity he traded - this added to the robustness of his Cat Scan systems
MaxHi=Highest[p](High)
MinLo=lowest[p](low)
chop=100 * LOG( SUMMATION[p](AverageTrueRange[1](close))/log(10) / ( MaxHi - MinLo)) / (LOG(p)/log(10))
return chop as "Choppiness Index"
Yes, I saw your informative blog on the CAC40 Breakout Strategy and that's why I was looking forward to trying it out (and adapting it to Forex). But it even gave errors on the very last line of the code (stop loss), that was remedied by copying that line, removing it and them re-pasting it back in and it worked?
It's that kind of nonsensical programming errors that are beyond my understanding, and it would seem, patience levels.
I had a non diversified style of trading and focused only on scalping the £/$ intraday - with hedges in other Forex pairs if things went against me. I was an average trader with strict money management rules and made 700% a year until the volatility of the '08 Crash. After that I became a slightly better trader but more flexible on the money management and could make 1000% in 6 months until invariably tiredness or some other distraction would cause account "issues"
(-:
I know that sudden volatility, trading with the trend and Dow Theory using pivot points works. I just can't program it... If anyone has any ideas how to do that I would be interested in hearing them.
The day a programmer writes a s/ware system that allows traders to express/write in normal English what they want to do, is the day that person will become an overnight millionaire.
I'm glad you haven't forgotten, I know you're busy. I think all the traders on here will benefit from the Kase PeakOscillator and KaseCD. Kase was using it with the confidence to be able to make million dollar trades in oil or silver -- going with the main trend and getting out (in two 50% of position size exits by using different timing chart monitors and her indicators), then going with the countertrend for a limited duration and then getting back into the main trend.
I have another World Class Algo Trader I'm reading about (I'm a better researcher than coder), who won the Robbins World Cup trading competition 3 years in a row with 100%+ returns. I will put the code up on a new thread to see if anyone can convert it.
Did you ever post the ATR percentile rank, I couldn't find it?
Best
Brad
This strategy cut loss quickly and let the profit run. That's why there are so many loss in a row. I can't say that the strategy is actually in a good mood, but I keep on trading it since last year and so far I'm still confident. I'm used to say that automated trading needs more work than manual one.. and patience.. We all want green profit everyday, but it's not possible. Keep on trading strategies you understand and also keep on diversification with adjusted risk on each one. (Brad= the Kase Dev Stop is on my mind, no worry.. :) )
Using both systems on this forum - one with maxamplitude 32.5 and the other 80, provided by Alfredo.
Result: No trades taken on CAC40 using Europe/London timezone
Tried more capital from £1k up to £10k capital — No trades taken…
Doesn’t produce any trades on 1 Hour or Daily — No trades taken…
PositionSize = max(2,2+ROUND((strategyprofit-1000)/1000))
Tried 1,2+ROUND etc —No trades taken…
Tried no commission / spread — No trades taken…
Does anyone have any idea why?
I am finding using PRT to be a real struggle as a limited coder but once very profitable discretionary spot Forex Trader would like to learn to code.
I abandoned ProOrder 5 years ago (and used Curtis Faith’s Trading Blox) because so many times systems that were supposed to be coded correctly would throw up lots of yellow warning symbols.
Why is does so much code on these forums not work first time after installation?
What I find strange is that on my test, with this formula of re-invested earning, he can't give me a result, he's always calculating and loading... Do you have the same problem ?
The "1000" value depends of the account size and your lot size capabilities to earn 1000$ without trading a century or so :)
Also, the "2" parameter is the minimum size a trade would trade on market. If you change this size, be sure that your instrument can be traded with this size (minimum allowed).
Yes, thanks !
Can you explain me the formula :
PositionSize = max(2,2+ROUND((strategyprofit-1000)/1000))
Thanks !
Hi,
I am new here. I tried the code in the backtest and it works just like shown here. However, when I start the code for real in ProOrder. Time settings are correct (Paris time etc) A yellow warning sign appears shortly after starting. I says that some command cannot be executed because DEFPARAM preload bars is set to 0. The program suggests 2000 or so. When I do this, the code worked. My question is: why is it necessary to set Preload Bars to 0 in the first place ? And second: if it is set to 0, why does it not work with me? Thank you for your answer.
Kind regards,
Glen
Hi Glen, Preloadbars needs to be setted at 0 to avoid the system to start immediately, on the very first day of the system start. This strategy needs to be functional on the first hours of the market open. So if you launch the system in the afternoon, it will not be accurate at all for the present day (if you defined prealoadbars to anything else than 0).
When I try the code with ProOrder (on ProRealTime CFD) with 1000€ and 1 mini-contract, no order is triggerd.
Error : something like "Insufficient minimal contract".
Do you know why ?
Thanks
Then I don't understand the backtest data. Yesterday (28.9.) range was from ~ 4410,5 - 4450,7 and the breakout was at 9:45 long. But the position was opened around 16 o'clock at 4457,3. Same procedure at 26. and 27.9.
The code says "buy short before breakout" but backtest shows "buy (timely and pricely) after breakout" and that's where I can't follow the code.
Could you write a pseudocode starting at line 50, please?