BOX 7 o'clock with CAC40 intraday strategy

Category: Strategies By: Stanko Created: August 21, 2023, 4:50 PM
August 21, 2023, 4:50 PM
Strategies
6 Comments

I would like to share a simple intraday strategy with CAC40, but adaptable also with Ftse100 and Eurostoxx.

Improvements and suggestions are welcome, as well as long term backtesting (I get to 100k units)

Main points:

  • 1-minute chart
  • The code works on the 1-hour timeframe to calculate the highs and lows
  • The code works on the 30-minute(long) and 15-minute(short) timeframe to handle the trailing stop
  • The trade still closes by 10 p.m.

There are two codes, one for LONG and one for SHORT.

DEFPARAM CumulateOrders = False
DEFPARAM FLATAFTER = 220000
Timeframe (1 Hour, Updateonclose)
//Once $MAXI[0] = High
//Once $mini[0] = Low
Once COMPRA = High

//Timeframe (1 Hour, Updateonclose)

Timeframe (1 Hour, Updateonclose)
IF Time = 080000 AND not OnMarket THEN
COMPRA = Highest[7](high[1]) + 5*pipsize
BUY 1 CONTRACT AT COMPRA STOP
ENDIF
//ENDIF


Timeframe (30 minutes, Updateonclose)
SET STOP pLOSS 70
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                Trailing Stop
//------------------------------------------------------------------------------------
IF Not OnMarket THEN
TrailStart    = 10          //10     Start trailing profits from this point
BasePerCent   = 0.100       //10.0%  Profit to keep
StepSize      = 6           //6      Pips chunks to increase Percentage
PerCentInc    = 0.100       //10.0%  PerCent increment after each StepSize chunk
RoundTO       = -0.5        //-0.5   rounds to Lower integer,  +0.4 rounds to Higher integer
PriceDistance = 7 * pipsize//8.9    minimun distance from current price
y1            = 0
y2            = 0
ProfitPerCent = BasePerCent
ELSIF LongOnMarket AND close > (TradePrice + (y1 * pipsize)) THEN //LONG
x1 = (close - tradeprice) / pipsize                            //convert price to pips
IF x1 >= TrailStart THEN                                       //go ahead only if N+ pips
Diff1         = abs(TrailStart - x1)
Chunks1       = max(0,round((Diff1 / StepSize) + RoundTO))
ProfitPerCent = BasePerCent + (BasePerCent * (Chunks1 * PerCentInc))
ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))
y1 = max(x1 * ProfitPerCent, y1)                            //y = % of max profit
ENDIF
ELSIF ShortOnMarket AND close < (TradePrice - (y2 * pipsize)) THEN//SHORT
x2 = (tradeprice - close) / pipsize                            //convert price to pips
IF x2 >= TrailStart THEN                                       //go ahead only if N+ pips
Diff2         = abs(TrailStart - x2)
Chunks2       = max(0,round((Diff2 / StepSize) + RoundTO))
ProfitPerCent = BasePerCent + (BasePerCent * (Chunks2 * PerCentInc))
ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))
y2 = max(x2 * ProfitPerCent, y2)                           //y = % of max profit
ENDIF
ENDIF
IF y1 THEN                                        //Place pending STOP order when y>0
SellPrice = Tradeprice + (y1 * pipsize)        //convert pips to price
IF abs(close - SellPrice) > PriceDistance THEN
IF close >= SellPrice THEN
SELL AT SellPrice STOP
ELSE
SELL AT SellPrice LIMIT
ENDIF
ELSE
SELL AT Market
ENDIF
ENDIF
IF y2 THEN                                        //Place pending STOP order when y>0
ExitPrice = Tradeprice - (y2 * pipsize)        //convert pips to price
IF abs(close - ExitPrice) > PriceDistance THEN
IF close <= ExitPrice THEN
EXITSHORT AT ExitPrice STOP
ELSE
EXITSHORT AT ExitPrice LIMIT
ENDIF
ELSE
EXITSHORT AT Market
ENDIF
ENDIF
SET STOP pLOSS 70
DEFPARAM CumulateOrders = False
DEFPARAM FLATAFTER = 220000
Timeframe (1 Hour, Updateonclose)
//Once $MAXI[0] = High
//Once $mini[0] = Low
Once VENDI = Low

//Timeframe (1 Hour, Updateonclose)

Timeframe (1 Hour, Updateonclose)
IF Time = 090000 AND not OnMarket THEN
VENDI = Lowest[7](low[1]) - 5*pipsize
SELLSHORT 1 CONTRACT AT VENDI STOP
ENDIF

Timeframe (15 minutes, Updateonclose)
SET STOP pLOSS 70
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                Trailing Stop
//------------------------------------------------------------------------------------
IF Not OnMarket THEN
TrailStart    = 10          //10     Start trailing profits from this point
BasePerCent   = 0.100       //10.0%  Profit to keep
StepSize      = 6           //6      Pips chunks to increase Percentage
PerCentInc    = 0.100       //10.0%  PerCent increment after each StepSize chunk
RoundTO       = -0.5        //-0.5   rounds to Lower integer,  +0.4 rounds to Higher integer
PriceDistance = 7 * pipsize//8.9    minimun distance from current price
y1            = 0
y2            = 0
ProfitPerCent = BasePerCent
ELSIF LongOnMarket AND close > (TradePrice + (y1 * pipsize)) THEN //LONG
x1 = (close - tradeprice) / pipsize                            //convert price to pips
IF x1 >= TrailStart THEN                                       //go ahead only if N+ pips
Diff1         = abs(TrailStart - x1)
Chunks1       = max(0,round((Diff1 / StepSize) + RoundTO))
ProfitPerCent = BasePerCent + (BasePerCent * (Chunks1 * PerCentInc))
ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))
y1 = max(x1 * ProfitPerCent, y1)                            //y = % of max profit
ENDIF
ELSIF ShortOnMarket AND close < (TradePrice - (y2 * pipsize)) THEN//SHORT
x2 = (tradeprice - close) / pipsize                            //convert price to pips
IF x2 >= TrailStart THEN                                       //go ahead only if N+ pips
Diff2         = abs(TrailStart - x2)
Chunks2       = max(0,round((Diff2 / StepSize) + RoundTO))
ProfitPerCent = BasePerCent + (BasePerCent * (Chunks2 * PerCentInc))
ProfitPerCent = max(ProfitPerCent[1],min(100,ProfitPerCent))
y2 = max(x2 * ProfitPerCent, y2)                           //y = % of max profit
ENDIF
ENDIF
IF y1 THEN                                        //Place pending STOP order when y>0
SellPrice = Tradeprice + (y1 * pipsize)        //convert pips to price
IF abs(close - SellPrice) > PriceDistance THEN
IF close >= SellPrice THEN
SELL AT SellPrice STOP
ELSE
SELL AT SellPrice LIMIT
ENDIF
ELSE
SELL AT Market
ENDIF
ENDIF
IF y2 THEN                                        //Place pending STOP order when y>0
ExitPrice = Tradeprice - (y2 * pipsize)        //convert pips to price
IF abs(close - ExitPrice) > PriceDistance THEN
IF close <= ExitPrice THEN
EXITSHORT AT ExitPrice STOP
ELSE
EXITSHORT AT ExitPrice LIMIT
ENDIF
ELSE
EXITSHORT AT Market
ENDIF
ENDIF
SET STOP pLOSS 70

Saluti.

Download
Filename: BOX-ore-7-Long.itf
Downloads: 230
Download
Filename: BOX-ore-7-Short.itf
Downloads: 184
Stanko Senior
Operating in the shadows, I hack problems one by one. My bio is currently encrypted by a complex algorithm. Decryption underway...
Author’s Profile

Comments

Logo Logo
Loading...