Hello folks,
here is my very simple strategy on SP500 (spread 0.4). Long has been consistently working well for months, so I disabled short. I found the settings around September 2022, so I can say that the strategy has been working in the raw version for at least the last year. The main trend is none other than the MA20 from the TF M15. The MACD entries work in reverse, so the bot enters each mini-pullback and tries to make a profit. The tandem filter works as a trend filter, although it should be used with caution. Can easily be over-optimized. The strategy is also only positive with a MA20 filter and a very low drawdown. The TP/SL ratio is 1:1.1 and I’ve kept it that way since last year. The only thing I tweak from time to time is really the tandem filter.
@PeterSt Can you try it on PRT-IB how the curve looks there?
I would appreciate opinions and suggestions for improvement (perhaps a better filter?).
Sorry, I can’t see the “Insert code” option.
//SP500 Spread 0.4
DEFPARAM CUMULATEORDERS = false
defparam preloadbars = 10000
//Risk Management
PositionSize = 5
//Hauptfilter M15 10…50
Timeframe(15minute, updateonclose)
//Trend
M15L1 = close > Average[20,0](close) and Average[20,0](close) > Average[20,0](close)[1]
M15S1 = close < Average[20,0](close) and Average[20,0](close) < Average[20,0](close)[1]
//Tandem
M15L2 = Average[30,1](close) > Average[55,1](close)
M15S2 = Average[20,1](close) < Average[50,1](close)
Timeframe(default)
//Trigger
MACDLinie = MACDline[12,26,9](close) > 0
MACDCross = MACD[12,26,9](close) crosses over 0
MACDLinieshort = MACDline[12,26,9](close) < 0
MACDCrossshort = MACD[12,26,9](close) crosses under 0
TrendL = M15L1 and M15L2
TrendS = M15S1 and M15S2
long = MACDLinie and MACDCrossshort and TrendL
short = MACDLinieshort and MACDCross and TrendS
// trading window
ONCE BuyTime = 153000
ONCE SellTime = 210000
// position management
IF Time >= BuyTime AND Time <= SellTime THEN
If long Then //not onmarket and
buy PositionSize CONTRACTS AT MARKET
SET STOP pLOSS hl
SET TARGET pPROFIT hl*p
ENDIF
//If short Then //not onmarket and
//sellshort PositionSize CONTRACTS AT MARKET
//SET STOP pLOSS hs
//SET TARGET pPROFIT hs*p2
//
//ENDIF
endif
if time >= 220000 then
sell at market
exitshort at market
endif
if time >= 215900 and dayofweek=5 then
sell at market
exitshort at market
endif