Hello everyone,
This small code looks a bit like my “Day Trading Trend DAX H4”, although it is less efficient.
It takes positions on the CAC40, in M15 graphics, in the morning (hence its name), based on the current momentum, defined by a MACD on the last 14 hours (so the periods are multiplied by 56).
14 hours because it’s like the 08H to 22H day trading.
This code is profitable over the long term, logically.
DEFPARAM CumulateOrders = False
// Taille des positions
n = 3
// Définition du MACD
// Timeframe M15
p = 56 // 56*15 min = 14 HOURS, like 08H to 22H
IndicMACD = MACD[12*p,26*p,9*p](close)
// CONDITIONS ACHAT
c1a = time = 093000
c2a = IndicMACD > IndicMACD[1]
IF c1a and c2a THEN
BUY n SHARES AT MARKET
ENDIF
// CONDITIONS VENTE
c1v = time = 093000
c2v = IndicMACD < IndicMACD[1]
IF c1v and c2v THEN
SELLSHORT n SHARES AT MARKET
ENDIF
// SORTIE
c1sa = time = 214500
IF c1sa THEN
SELL AT MARKET
EXITSHORT AT MARKET
ENDIF
// STOP LOSS & TAKE PROFIT
SET STOP %LOSS 1