Dear All,
I think it is the good timing to share with you the following strategy.
“Dax Short 15′” is nothing really complicated but works fairly.
Kindly note that I am not the coder of the century 😉 however I’ll be delighted to help as much as I can.
Thank you.
//-------------------------------------------------------------------------
// Code principal : Dax Short 15'
//-------------------------------------------------------------------------
//-----------------------------------
// Code principal : Dax Short 15'
//-------------------------------------------------------------------------
// Définition des paramètres du code
// From Inertia
//Last optimization 26/07/2017
DEFPARAM Preloadbars = 3000
DEFPARAM CumulateOrders = False
DEFPARAM FLATBEFORE = 091500
DEFPARAM FLATAFTER = 213000
noEntryBeforeTime = 091500
timeEnterBefore = time >= noEntryBeforeTime
noEntryAfterTime = 213000
timeEnterAfter = time < noEntryAfterTime
daysForbiddenEntry = OpenDayOfWeek = 1 OR OpenDayOfWeek = 3 OR OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
REM Variables
ordersize = 1
mafilter = 2000 // 2000
TS = 30 // 30
SL = 45 // 45
TP = 110 // 110
//MACD settings
a = 12 // 12
b = 26 // 26
c = 9 // 9
// Conditions pour ouvrir une position en vente à découvert
indicator1 = MACD[a,b,c](close)
c1 = (indicator1 CROSSES UNDER 0)
indicator2 = MACDline[a,b,c](close)
c2 = (indicator2 < 0)
indicator3 = ExponentialAverage[mafilter](close)
c3 = (close < indicator3)
indicator4 = ExponentialAverage[mafilter](close)
indicator5 = ExponentialAverage[mafilter](close)
c4 = (indicator4 < indicator5[1])
IF (c1 AND c2 AND c3 AND c4) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
SELLSHORT ordersize CONTRACT AT MARKET
ENDIF
//trailing stop
trailingstop = TS//Best 30
//resetting variables when no trades are on market
if not onmarket then
MINPRICE = close
priceexit = 0
endif
//case SHORT order
if shortonmarket then
MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade
if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level
endif
endif
//exit on trailing stop price levels
if onmarket and priceexit>0 then
EXITSHORT AT priceexit STOP
SELL AT priceexit STOP
endif
SET STOP Ploss SL
Set Target PProfit TP
You must be logged in to post a comment.
//------------------------------------------------------------------------- // Code principal : Dax Short 15' //------------------------------------------------------------------------- //----------------------------------- // Code principal : Dax Short 15' //------------------------------------------------------------------------- // Définition des paramètres du code // From Inertia //Last optimization 26/07/2017 DEFPARAM Preloadbars = 3000 DEFPARAM CumulateOrders = False DEFPARAM FLATBEFORE = 100000 DEFPARAM FLATAFTER = 180000 noEntryBeforeTime = 100000 timeEnterBefore = time >= noEntryBeforeTime noEntryAfterTime = 213000 timeEnterAfter = time < noEntryAfterTime daysForbiddenEntry = OpenDayOfWeek = 1 OR OpenDayOfWeek = 3 OR OpenDayOfWeek = 6 OR OpenDayOfWeek = 0 REM Variables // Taille des positions REINV = 1 LEVIER = 3 IF REINV = 0 THEN N = 1 ELSIF REINV = 1 THEN capital = 500 + strategyprofit n = (capital / 500)*LEVIER N = round(n) ENDIF ordersize = N mafilter = 2000 // 2000 TS = 30 // 30 SL = 45 // 45 TP = 110 // 110 //MACD settings a = 12 // 12 b = 26 // 26 c = 9 // 9 // Conditions pour ouvrir une position en vente à découvert indicator1 = MACD[a,b,c](close) c1 = (indicator1 CROSSES UNDER 0) indicator2 = MACDline[a,b,c](close) c2 = (indicator2 < 0) indicator3 = ExponentialAverage[mafilter](close) c3 = (close < indicator3) indicator4 = ExponentialAverage[mafilter](close) indicator5 = ExponentialAverage[mafilter](close) c4 = (indicator4 =trailingstop*pointsize then //if the MFE is higher than the trailingstop then priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level endif endif //exit on trailing stop price levels if onmarket and priceexit>0 then EXITSHORT AT priceexit STOP SELL AT priceexit STOP endif SET STOP Ploss SL Set Target PProfit TP
Hi, What do you think about this ? //------------------------------------------------------------------------- // Code principal : Dax Short 15' //------------------------------------------------------------------------- //----------------------------------- // Code principal : Dax Short 15' //------------------------------------------------------------------------- // Définition des paramètres du code // From Inertia //Last optimization 26/07/2017 DEFPARAM Preloadbars = 3000 DEFPARAM CumulateOrders = False DEFPARAM FLATBEFORE = 100000 DEFPARAM FLATAFTER = 180000 noEntryBeforeTime = 100000 timeEnterBefore = time >= noEntryBeforeTime noEntryAfterTime = 213000 timeEnterAfter = time < noEntryAfterTime daysForbiddenEntry = OpenDayOfWeek = 1 OR OpenDayOfWeek = 3 OR OpenDayOfWeek = 6 OR OpenDayOfWeek = 0 REM Variables // Taille des positions REINV = 1 LEVIER = 5 IF REINV = 0 THEN N = 1 ELSIF REINV = 1 THEN capital = 500 + strategyprofit N = round(capital / 500)*LEVIER ENDIF ordersize = N mafilter = 250 // 2000 TS = 30 // 30 SL = 45 // 45 TP = 110 // 110 //MACD settings a = 12 // 12 b = 26 // 26 c = 9 // 9 // Conditions pour ouvrir une position en vente à découvert indicator1 = MACD[a,b,c](close) c1 = (indicator1 CROSSES UNDER 0) indicator2 = MACDline[a,b,c](close) c2 = (indicator2 < 0) indicator3 = ExponentialAverage[mafilter](close) c3 = (close < indicator3) indicator4 = ExponentialAverage[mafilter](close) indicator5 = ExponentialAverage[mafilter](close) c4 = (indicator4 =trailingstop*pointsize then //if the MFE is higher than the trailingstop then priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level endif endif //exit on trailing stop price levels if onmarket and priceexit>0 then EXITSHORT AT priceexit STOP SELL AT priceexit STOP endif SET STOP Ploss SL Set Target PProfit TP
Long version... not very good //DEFPARAM Preloadbars = 3000 DEFPARAM CumulateOrders = False DEFPARAM FLATBEFORE = 090000 DEFPARAM FLATAFTER = 210000 noEntryBeforeTime = 090000 timeEnterBefore = time >= noEntryBeforeTime noEntryAfterTime = 213000 timeEnterAfter = time 2) indicator3 = ExponentialAverage[mafilter](close) c3 = (close > indicator3) indicator4 = ExponentialAverage[mafilter](close) indicator5 = ExponentialAverage[mafilter](close) c4 = (indicator4 > indicator5[1]) IF (c1 AND c2 AND c3 AND c4) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN buy ordersize CONTRACT AT MARKET ENDIF //trailing stop trailingstop = TS//Best 30 //resetting variables when no trades are on market if not onmarket then MINPRICE = close priceexit = 1 endif //case long order if longonmarket then MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level endif endif //FINE LONG //exit on trailing stop price levels if onmarket and priceexit>0 then EXITSHORT AT priceexit STOP SELL AT priceexit STOP endif SET STOP Ploss SL Set Target PProfit TP
Proformence will be beter with other starting hours and closing hours @Inertia