There is a know forextrader called the rumpleone. He has been around for along time. On his youtube chanel he and a friend of his trades this strategy on mt4. They are both only trading using statistics and have been for last 20+ years. Would like to get some help coding it for PRT. In theory it seems supereffective. Want to see how it tests back in time over a big sample.
Attached a picture on the template they use in mt4. Red and Green lines are the breakout lines where stop-orders should be +-1 pip
Rules:
- SL 10 pips
- Only trade in direction of hourly candle
- Only trade from 8.00 to 16.00 GMT, this is when ex GBPUSD range always is bigger then 10, therefor in theory price has to break out between 00, 10, 20, 30, 40, 50, 60, 70, 80, 90 lines
- Every new hour, take a trade when price breaks 00, 10, 20, 30, 40, 50, 60, 70, 80, 90 line (ex. 1.37400) example in the picture, price opened between 1.37500 and 1.37600. Set a sellstop at 1.37500 -1 pip and a buystop at 1.37600 +1 pip
- When price moved 1 pips in my favor. Move SL to -7.
- When price moved 5 pips move SL to BE+1
- No fixed TP, trailstop keep locking in for every 5 pip gain. So at 10 pips profit, move SL to +5. at 15 move to 10 etc.
if trailstop/BE function is not possible. Just trailstop every 5 pip.
dont know why picture did not upload on last post
There you go:
// Rumpleone
//
DEFPARAM CumulateOrders = FALSE
cTime = Time >= 100000 AND Time <= 180000
cDay = OpenDayOfWeek >= 1 AND OpenDayOfWeek <= 5
SL = 10 * PipSize
Offset = 1 * PipSize
LossPips = 7 * PipSize
TSstep = 5
Hundred = 1 * PipSize * 10
FirstPip = 1 * PipSize
IF Not OnMarket THEN
NewSL = 0
ENDIF
Bullish = close > open
Bearish = close < open
Plevel = round((close * 1000) - 0.5) / 1000
IF close <> Plevel THEN
IF Bullish AND Not OnMarket THEN
BUY 1 CONTRACT AT Plevel + Hundred + Offset STOP
ELSIF Bearish AND Not OnMarket THEN
SELLSHORT 1 CONTRACT AT Plevel - Offset STOP
ENDIF
SET STOP LOSS SL
SET TARGET PROFIT SL * 3
ENDIF
Pips = (TradePrice * PositionPerf) / PipSize
IF Pips >= TSstep THEN
IF LongOnMarket THEN
IF (NewSL < TradePrice) OR (NewSL = 0) THEN
NewSL = TradePrice + FirstPip
ELSE
NewSL = max(NewSL,NewSL + TSstep * PipSize)
ENDIF
ELSIF ShortOnMarket THEN
IF (NewSL > TradePrice) OR (NewSL = 0) THEN
NewSL = TradePrice - FirstPip
ELSE
NewSL = min(NewSL,NewSL - TSstep * PipSize)
ENDIF
ENDIF
ELSIF (Pips >= (FirstPip / PipSize)) AND (NewSL = 0) THEN //1 pip gain
IF LongOnMarket THEN
NewSL = TradePrice - LossPips
ELSE
NewSL = TradePrice + LossPips
ENDIF
ENDIF
IF NewSL > 0 THEN
SELL AT NewSL STOP
EXITSHORT AT NewSL STOP
ENDIF
//
//graph Pips
//graphonprice Plevel coloured(0,0,255,255) AS "Plevel"
//graphonprice Plevel + Hundred + Offset coloured(0,255,0,255) AS "Long"
//graphonprice Plevel - Offset coloured(255,0,0,255) AS "Short"
//graphonprice NewSL coloured(0,0,0,255) AS "SL"
I think this code will exit quite soon when running, because most of times the entry price is too close to the current price so it is likely not to meet the broker’s minimum distance requirements for pending orders.
thanks alot again roberto!!
but strategy takes position at night as well it looks like.
Also, is it possible to code that it takes maximum x number of positions every hour?
My fault, I forgot to add cTime and cDay to the conditions to enter a trade.
Replace line 18 with this one:
IF close <> Plevel AND cTime AND cDay THEN
Moreover, I added line 25 for a TP to better test the code. You did not want it, so you can comment it out.
I forgot to answer your question about the max. number of trades per hour.
I modified the code using MTF support so that I can use the 1-hour TF to accomplish that limitation.
Of course you cannot use TF’s higher than 1 hour and the 1-hour TF must be multiple of the one you are using on your chart (you cannot use a 7-minute TF because 1 hour, or 60 minutes, is not a multiple of 7).
Set MaxTrades to any integer number.
// Rumpleone
//
DEFPARAM CumulateOrders = FALSE
TimeFrame(1h,UpdateOnClose)
ThisHour1 = OpenTime
//
TimeFrame(default)
ONCE Tally = 0
// determine whether a trade has been closed in the last candle
z1 = OnMarket[1] AND Not OnMarket
z2 = LongOnMarket AND ShortOnMarket[1]
z3 = ShortOnMarket AND LongOnMarket[1]
z4 = (Not OnMarket[1] AND Not OnMarket) AND (StrategyProfit <> StrategyProfit[1])
Traded = z1 OR z2 OR z3 OR z4 //OR 1
Tally = Tally + Traded
// clear the counter each hour
ThisHour2 = ThisHour1
IF (ThisHour2 <> ThisHour2[1]) THEN
Tally = 0
ENDIF
//
cTime = Time >= 100000 AND Time <= 180000
cDay = OpenDayOfWeek >= 1 AND OpenDayOfWeek <= 5
SL = 10 * PipSize
Offset = 1 * PipSize
LossPips = 7 * PipSize
TSstep = 5
Hundred = 1 * PipSize * 10
FirstPip = 1 * PipSize
MaxTrades = 1
IF Not OnMarket THEN
NewSL = 0
ENDIF
Bullish = close > open
Bearish = close < open
Plevel = round((close * 1000) - 0.5) / 1000
IF close <> Plevel AND cTime AND cDay AND (Tally < MaxTrades) THEN
IF Bullish AND Not OnMarket THEN
BUY 1 CONTRACT AT Plevel + Hundred + Offset STOP
ELSIF Bearish AND Not OnMarket THEN
SELLSHORT 1 CONTRACT AT Plevel - Offset STOP
ENDIF
SET STOP LOSS SL
SET TARGET PROFIT SL * 3
ENDIF
Pips = (TradePrice * PositionPerf) / PipSize
IF Pips >= TSstep THEN
IF LongOnMarket THEN
IF (NewSL < TradePrice) OR (NewSL = 0) THEN
NewSL = TradePrice + FirstPip
ELSE
NewSL = max(NewSL,NewSL + TSstep * PipSize)
ENDIF
ELSIF ShortOnMarket THEN
IF (NewSL > TradePrice) OR (NewSL = 0) THEN
NewSL = TradePrice - FirstPip
ELSE
NewSL = min(NewSL,NewSL - TSstep * PipSize)
ENDIF
ENDIF
ELSIF (Pips >= (FirstPip / PipSize)) AND (NewSL = 0) THEN //1 pip gain
IF LongOnMarket THEN
NewSL = TradePrice - LossPips
ELSE
NewSL = TradePrice + LossPips
ENDIF
ENDIF
IF NewSL > 0 THEN
SELL AT NewSL STOP
EXITSHORT AT NewSL STOP
ENDIF
//
//graph Pips
//graphonprice Plevel coloured(0,0,255,255) AS "Plevel"
//graphonprice Plevel + Hundred + Offset coloured(0,255,0,255) AS "Long"
//graphonprice Plevel - Offset coloured(255,0,0,255) AS "Short"
//graphonprice NewSL coloured(0,0,0,255) AS "SL"
Made a backtest on GBPEUR and it looked amazing as in Holy Smokes-amazing… until I saw I forgot to put in the spread 😉
Still very good job though, Robert!
That’s backtest.
As I said, when you let it run on your account (demo or real makes no difference), the pending orders will, most of the time, be rejected being too close to the current price (and the strategy is most likely to be shut down).
Whenever you deal with small SL’s and TP’s using pending orders… bad things may happen!
This LONG exit will work, even though the current price is quite at the same leve lthan the current price:
MyProfitPips = PositionPrice * PositionPerf / PipSize
IF MyProfitPips >= 0 THEN //exit at breakeven immediately at market
SELL AT MARKET
ENDIF
this is likely not to work (unless a spike earned you a bunch of more than 2 pips):
MyProfitPips = PositionPrice * PositionPerf / PipSize
IF MyProfitPips >= 2 THEN
SELL AT PositionPrice STOP //exit at breakeven using a pending order
ENDIF