This EURUSD daily timeframe strategy is a simple code based mostly on the current trend detected by the difference of the Close with a simple moving average.
If the Close is above the SMA and the candlestick is green then we have a buy trading signal.
If Close is below the SMA and the candlestick is red, then this is a sell trading signal.
Seasonality parameters act as filters to prevent or not the launch of new orders at market, some days and months are not allowed to be traded.
Attached result is with 2 pips of spread. The strategy has no “0 bar” issue and could be backtested without the tick by tick mode to get a longer-term view of performance.
//-------------------------------------------------------------------------
// Main code : eurusd_TF_daily
//-------------------------------------------------------------------------
DEFPARAM cumulateOrders = False // Cumulating positions deactivated
///parameter definition
//inputs
period = 7
dayforbiddenlong =4
dayforbiddenshort = 2
monthforbiddenlong =1
monthforbiddenshort =4
//variables
mav = average[period](close)
oscillator = close-mav
rossa = (Dclose(0)-Dopen(0))<0
verde = (Dclose(0)-Dopen(0))>0
//entry condition
cl = oscillator > 0
cl = cl and rossa
cl = cl and dayofweek <> dayforbiddenlong and month <> monthforbiddenlong
cs = oscillator<0
cs =cs and verde
cs = cs and dayofweek <> dayforbiddenshort and month <> monthforbiddenshort
IF cl THEN
buy 1 PERPOINT AT MARKET
ENDIF
if cs then
sellshort 1 perpoint at market
endif