In September a human would be trading short. There were only 2 short long phases, otherwise it would be a short month. The short longs were not enough to trigger a TP. There is the solution.
A solution might be an additional slower MA size EMA100 or something similar.
Breakouts in H4 over candles with long top shadow don’t seem to be that good … how can you code candles with long top shadow? Then you could check it out.
you could try
shadow = (high-close)/(high-low) < s
s value > 0.5 means the top shadow is more than half the candle
add shadow as an entry condition
optimize ‘s’ from 0.1 to 1 in steps of 0.1
Thank you, I’ll try tonight.
To see the max amount of CumulateOrders in backtest:
Once MaxOrders = 0
MaxOrders = max(MaxOrders,abs(CountOfPosition))
Graph MaxOrders
edited: CountOfPosition was badly spelled and has been corrected at a later time
As a quick train of thought, in case I’m wrong … the 1 Trade function via H4 bar is built into my version. So if I calculate TP / SL in the M5 over the entire period and then simply switch to an M1 chart and calculate the trailing stop there … We have a system that triggers 1 trade per H4 bar in the M1 with the SL / TP in the M5 Timeframe works well and the trailing stop in the M1 … all months with greater profit / less drawdown than in the M5 chart … without September problems. 😉 Do I understand this logic correctly? Because then the system is damn good without cummulate = true.
This is essentially the version 2 of Nonetheless with 1 contract. I have changed only TradeTime (from 120000 to 130000) and added a filter with a second moving averages (optimized). This version has a lower DD than version 2 (tested on 200K).
//TS NAS 5m Breakout v2B
DEFPARAM CUMULATEORDERS = false
//spread = 1.5
positionsize = 1
Tradetime = time >=130000 and time <220000
//——————————————————-
timeframe(4 hour, updateonclose)
H4 = high
avg1 = average[40,6](close)
c1 = avg1 > avg1[1] //filter
avg2 = average[110,2](close)
c2 = close > avg2 //new filter II
//——————————————————–
timeframe(5 minutes)
c0 = close crosses over H4 // trigger
If Tradetime and c0 and c1 and c2 Then
Buy PositionSize CONTRACTS AT MARKET
SET STOP %LOSS 1.8
SET TARGET %PROFIT 2.2
ENDIF
//——————————————————-
once trailingStop = 1
If trailingStop then
trailingPercentLong = 0.39
once acceleratorLong = 0.015
once stepPercentLong = (trailingPercentLong/10)*acceleratorLong
If onMarket then
trailingStartLong = positionprice*(trailingPercentLong/100)
trailingsteplong = positionprice*(stepPercentLong/100)
endif
IF NOT ONMARKET THEN
newSL=0
ENDIF
IF LONGONMARKET THEN
IF newSL=0 AND high-tradePrice(1)>=trailingStartLong THEN
newSL = tradePrice(1)+trailingStepLong
ENDIF
IF newSL>0 AND high-newSL>trailingStepLong THEN
newSL = newSL+trailingStepLong
ENDIF
ENDIF
IF newSL>0 THEN
SELL AT newSL STOP
ENDIF
ENDIF
//——————————————————————————————-
RSIexit = 1
if RSIexit then
myrsi=rsi[9](close)
if myrsi<10 and barindex-tradeindex>1 and longonmarket and close>positionprice then
sell at market
endif
if myrsi>85 and barindex-tradeindex>1 and shortonmarket and close<positionprice then
exitshort at market
endif
endif
//—————————————————————————————————-
EZT = 1
if EZT then
IF (longonmarket and barindex-tradeindex(1)>= 1590 and positionperf>0) or (longonmarket and barindex-tradeindex(1)>= 1390 and positionperf<0) then
sell at market
endif
IF (shortonmarket and barindex-tradeindex(1)>= 3500 and positionperf>0) or (shortonmarket and barindex-tradeindex(1)>= 3500 and positionperf<0) then
exitshort at market
endif
endif
//———————————————————————————————————
How does your version with “1 Trade function via H4 bar” phoentzs conpares to MauroPro TS NAS 5m Breakout v2B?
How do I use tradeon. When I use it like below the results no different.
timeframe(4 hour, updateonclose)
H4 = high
avg1 = average[40,6](close)
c1 = avg1 > avg1[1] //filter
avg2 = average[110,2](close)
c2 = close > avg2 //new filter II
barCount = barIndex
//——————————————————–
timeframe(5 minutes)
once tradeOn = 1
if intradayBarIndex = 0 then
tradeOn = 1
endif
tradeBar = barCount
if not onMarket and tradeBar<>tradeBar[1] then
tradeOn = 1
endif
c0 = close crosses over H4 // trigger
If Tradetime and c0 and c1 and c2 and tradeon Then
Buy PositionSize CONTRACTS AT MARKET
SET STOP %LOSS 1.8
SET TARGET %PROFIT 2.2
ENDIF
//——————————————————-
Under line 22: TRADEON = 0
My version has advantages with the additional MA in some market phases, but in sideways phases also disadvantages. So I do not use it first. Besides, I tested average (40.6) and average (15.1) with my “small” SL settings. There is the advantage of average (15.1). This becomes particularly clear if you only test with SL / TP for over 8 years. Conclusion: I think EMA15 is not over-optimized. My modest opinion, but only because I do not like a huge SL. I can fool myself, I’m just apprentice as we all.
we change easily into a M3 chart with the same settings TP / SL only … we see the faster reaction of M3 bars over M5-bars is a great improvement.
How does ur version look like I code phoentzs