The same applies to this post as my other post (Consecutive bullish or bearish candlesticks – DAX)
I ran this code since 7 Dec 2017 (as a test phase on demo account before going live with it) and so far it has delivered £302. Just over a month.
1 minute time frame with 1 mini contracts.
May be someone can some changes or even test it yourself and use it as is.
US Russel 2000 cash
Timeframe – 1 min
Contract – 1 x mini.
//-------------------------------------------------------------------------
//PRC_TS multiple candlesticks | indicator
//01.03.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//graph dayofweek
//This is not my code.
//This was written and published by Sir. Nicolas.
// Prevents the system from placing new orders on specified days of the week
//daysForbiddenEntry = OpenDayOfWeek = 1 OR OpenDayOfWeek = 2 OR OpenDayOfWeek = 3 OR OpenDayOfWeek = 5
// --- parameters
Size = 1 //position size
StopLoss = 12 //stoploss in points
TakeProfit = 9 //takeprofit in points
Xcandlesticks = 4 //consecutive bullish or bearish candlesticks to open a new position
InverseTrading = 0 //(0=false ; 1=true) trade in the same direction of the candlesticks pattern or not
CumulateOrder = 1 //(0=false ; 1=true) cumulate or not a new trade if the current candlestick is in the same trend as the pattern
// ------------
//detecting patterns
bearpattern = summation[Xcandlesticks](close<open)=Xcandlesticks
bullishpattern = summation[Xcandlesticks](close>open)=Xcandlesticks
//first order
if not onmarket then //AND not daysForbiddenEntry then
if bearpattern then //AND not daysForbiddenEntry then
if InverseTrading then //AND not daysForbiddenEntry then
BUY Size CONTRACTS AT MARKET
else
SELLSHORT Size CONTRACT AT MARKET
endif
lastbar = barindex
lastpattern = -1
endif
if bullishpattern then //AND not daysForbiddenEntry then
if InverseTrading then //AND not daysForbiddenEntry then
SELLSHORT Size CONTRACT AT MARKET
else
BUY Size CONTRACTS AT MARKET
endif
lastbar = barindex
lastpattern = 1
endif
endif
//cumulate order when a new pattern occurred
if onmarket and not CumulateOrder and barindex-lastbar>=Xcandlesticks then // AND not daysForbiddenEntry then
if bearpattern then //AND not daysForbiddenEntry then
if InverseTrading then // AND not daysForbiddenEntry then
BUY Size CONTRACTS AT MARKET
else
SELLSHORT Size CONTRACT AT MARKET
endif
lastbar = barindex
endif
if bullishpattern then // AND not daysForbiddenEntry then
if InverseTrading then //AND not daysForbiddenEntry then
SELLSHORT Size CONTRACT AT MARKET
else
BUY Size CONTRACTS AT MARKET
endif
lastbar = barindex
endif
endif
//cumulate order when a new consecutive candletick happen right after the pattern occurred
if onmarket and CumulateOrder and barindex-lastbar=1 then // AND not daysForbiddenEntry then
if longonmarket then // AND not daysForbiddenEntry then
if (close>open and lastpattern=1) or (close<open and lastpattern=-1) then //AND not daysForbiddenEntry then
BUY Size CONTRACTS AT MARKET
lastbar = barindex
endif
endif
if shortonmarket then //AND not daysForbiddenEntry then
if (close>open and lastpattern=1) or (close<open and lastpattern=-1) then // AND not daysForbiddenEntry then
SELLSHORT Size CONTRACT AT MARKET
lastbar = barindex
endif
endif
endif
SET STOP PLOSS StopLoss
SET TARGET PPROFIT TakeProfit
//END
Thanks Andre for sharing this strategy. R2K hasn’t yet been on my trading list, but I think it’s worth an attempt. Let me check your code on myside.