Breakout ProOrder French CAC40

Category: Strategies By: Nicolas Created: November 29, 2015, 10:15 PM
November 29, 2015, 10:15 PM
Strategies
49 Comments

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

Download
Filename: Breakout-ProOrder-EN1.itf
Downloads: 652
Nicolas Master
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Logo Logo
Loading...