This is how they are indexed in a strategy:
[attachment file=77492]
MarcParticipant
Average
Good Day to you,
I think that code is now correct. can someone prrof this according to the systemrules? I think there could be an issue with SL and TP.
Thank you Marc
DEFPARAM CumulateOrders = false
//Buy-Condition l1 Exapmle (For daily): Candle from monday is bullish and followed by 2 candles with lower highs and lower lows. Close of current candle (wednesday-candle) is higher than close of monday candle
l1 = OPEN[2] < CLOSE[2] AND High[2] > High [1] AND High[1] > High AND Low[2] > Low[1] AND Low[1] > Low AND Close > Close[2]
//Buy-Condition l2 Exapmle (For daily): Candle of monday is bearish and followed by 2 candles with lower highs and lower lows. Close of current candle (wednesday-candle) is higher than open of monday candle
l2 = OPEN[2] > CLOSE[2] AND High[2] > High [1] AND High[1] > High AND Low[2] > Low[1] AND Low[1] > Low AND Close > Open[2]
//Sell-Condition s1 Exapmle (For daily): Candle of monday is bullish and followed by 2 candles with higher highs and higher lows. Close of current candle (wednesday-candle) is lower than close of monday candle
s1 = OPEN[2] < CLOSE[2] AND High[2] < High [1] AND High[1] < High AND Low[2] < Low[1] AND Low[1] < Low AND Close < Close[2]
//Sell-Condition s2 Exapmle (For daily): Candle of monday is bearish and followed by 2 candles with higher highs and higher lows. Close of current candle (wednesday-candle) is lower than open of monday candle
s2 =OPEN[2] > CLOSE[2] AND High[2] < High [1] AND High[1] < High AND Low[2] < Low[1] AND Low[1] < Low AND Close < Close[2]
//Buy @ open of nextcandle if condition l1 or l2 is met
IF l1 OR l2 AND Not OnMarket THEN //Not OnMarket will prevent SL & TP to be recalculated
SL = (open - low[1]) //difference between current price and LOW of candle 1
TP = (high[2] - open) //difference between the HIGH of candle 2 and current price (a lower current price is assumed)
BUY 1 SHARES AT MARKET //MarketOrder
SET STOP LOSS SL
SET TARGET PROFIT TP
ENDIF
//Sell @ open of nextcandle if condition s1 or s2 is met
IF s1 OR s2 AND Not OnMarket THEN //Not OnMarket will prevent SL & TP to be recalculated
SL = (high[1] - open) //difference between current price and HIGH of candle 1
TP = (open - low[2]) //difference between the LOW of candle 2 and current price (a higher current price is assumed)
SELLSHORT 1 SHARE AT MARKET //MarketOrder
SET STOP LOSS SL
SET TARGET PROFIT TP
ENDIF
It works, but I cannot tell if it’s working fine, I dod not check the patterns.
I checked SL & TP and sometimes they’re huge, sometimes very close to the minimun requirements!
The main isssue is the very few trades opened, on DAX daily just 3 in 8 years!
It’s for sure good practice to improve your know-how.
MarcParticipant
Average
I think that the patterns are still not correct recognized…I have to filter this out -.-
It’s a lot of workd for such a simple system…
Rgsd
Marc
MarcParticipant
Average
Recognition of patterns seems to be okay, but setting up of TP and SL is curious…
Try using ATR, searching this forum will allow you to find many examples about it.
MarcParticipant
Average
I will do and check out if there are some possibilities how tp play with ATR
MarcParticipant
Average
Another example with ATR-based SL and TP calculation
DEFPARAM CumulateOrders = false
//Buy-Condition
l1 = OPEN[2] > CLOSE[2] AND OPEN[1] > CLOSE[1] AND High[2] > High [1] AND High[1] > High AND Low[2] > Low[1] AND Low[1] > Low AND Close > Close[2]
//Sell-Condition
s1 = OPEN[2] < CLOSE[2] AND OPEN[1] < CLOSE[1] AND High[2] < High [1] AND High[1] < High AND Low[2] < Low[1] AND Low[1] < Low AND Close < Close[2]
//Buy @ open of nextcandle if condition l1 is met
IF l1 AND Not OnMarket THEN //Not OnMarket will prevent SL & TP to be recalculated
SL = TP //difference between current price and LOW of candle 1
TP = (AverageTrueRange[x]((open+close+low+high)/4))*2 //difference between the HIGH of candle 2 and current price (a lower current price is assumed)
BUY 1 SHARES AT MARKET //MarketOrder
SET STOP LOSS SL
SET TARGET PROFIT TP
ENDIF
//Sell @ open of nextcandle if condition s1 is met
IF s1 AND Not OnMarket THEN //Not OnMarket will prevent SL & TP to be recalculated
SL = TP //difference between current price and HIGH of candle 1
TP = (AverageTrueRange[x]((open+close+low+high)/4))*2 //difference between the LOW of candle 2 and current price (a higher current price is assumed)
SELLSHORT 1 SHARE AT MARKET //MarketOrder
SET STOP LOSS SL
SET TARGET PROFIT TP
ENDIF
MarcParticipant
Average
With more variables
DEFPARAM CumulateOrders = false
TPL = (AverageTrueRange[TPLATR]((open+close+low+high)/4))*TPLMOD
SLL = (AverageTrueRange[SLLATR]((open+close+low+high)/4))*SLLMOD
TPS = (AverageTrueRange[TPSATR]((open+close+low+high)/4))*TPSMOD
SLS = (AverageTrueRange[SLSATR]((open+close+low+high)/4))*SLSMOD
//Buy-Condition
l1 = OPEN[2] > CLOSE[2] AND OPEN[1] > CLOSE[1] AND High[2] > High [1] AND High[1] > High AND Low[2] > Low[1] AND Low[1] > Low AND Close > Close[2]
//Sell-Condition
s1 = OPEN[2] < CLOSE[2] AND OPEN[1] < CLOSE[1] AND High[2] < High [1] AND High[1] < High AND Low[2] < Low[1] AND Low[1] < Low AND Close < Close[2]
//Buy @ open of nextcandle if condition l1 is met
IF l1 AND Not OnMarket THEN
BUY 1 SHARES AT MARKET //MarketOrder
SET STOP LOSS SLL
SET TARGET PROFIT TPL
ENDIF
//Sell @ open of nextcandle if condition s1 is met
IF s1 AND Not OnMarket THEN
SELLSHORT 1 SHARE AT MARKET //MarketOrder
SET STOP LOSS SLS
SET TARGET PROFIT TPS
ENDIF
@Marc thank you for sharing, please could you also share the .itf file of the multi-variable System as then it saves me entering all the Labels (and probably getting it wrong!? 🙂 ).
Many Thanks
Graham
MarcParticipant
Average
Hi GraHal,
pls find attached 3 Candle Strategy itf attached.
Marc big thank you!
I’ve set it going on Demo Fwd Test as I get attached on 5 min TF on DJI on 100,000 bars!
Bigger drawdown than I like, but if it’s out of money already gained by the System then I can live with that! 🙂 🙂
Draw down has to be accepted as relative to run up or overall profit. As a rule of thumb I like to see at a glance that draw down multiplied by ten is less than run up and overall profit. So for example if draw down is £2000 then I want to see at least £20000 run up or £20000 overall profit. It is not a ‘set in stone’ rule but is an easy way to assess how bad draw down really is by comparison.
Well by your rule of thumb Vonasi it more or less passes! 🙂
MarcParticipant
Average
I think that the 5 minute backtest looks okay…which settings did you use?