3 Candle Strategy
Forums › ProRealTime English forum › ProOrder support › 3 Candle Strategy
- This topic has 82 replies, 6 voices, and was last updated 4 years ago by Regan2020.
-
-
07/25/2018 at 12:20 PM #76703
Hi together,
here is another system which works like bullish / bearish harami pattern.
In the End for a long position 3 lower highs and lower lows have to follow immediately. Close of current candle must be higher than open if first candle is bearish or close of current candle must be higher if first candle is bullish. TP is high of first candle.For Short vice versa.
Perhaps somebody can check if this code seems to be okay?
12345678910111213141516171819202122232425DEFPARAM CumulateOrders = False//Buy-Condition l1: Kerze vor 3 Perioden muss bullish sein und es müssen 3 Kerzen mit tieferen Hochs und tieferen Tiefs folgen und der Schlusskurs der vorherigen Kerze muss größer sein als der Schlusskurs der ersten Kerzel1 = OPEN[3] < CLOSE[3] AND High[3] > High [2] AND High[2] > High[1] AND Low[3] > Low[2] AND Low[2] > Low[1] AND Close[1] >= Close[3]//Buy-Condition l2: Kerze vor 3 Perioden muss bearish sein und es müssen 3 Kerzen mit tieferen Hochs und tieferen Tiefs folgen und der Schlusskurs der vorherigen Kerze ist größer als das Open der ersten Kerzel2 = OPEN[3] > CLOSE[3] AND High[3] > High [2] AND High[2] > High[1] AND Low[3] > Low[2] AND Low[2] > Low[1] AND Close[1] >= Open[3]//Sell-Condition s1: Kerze vor 3 Perioden muss bullish sein und es müssen 3 Kerzen mit höheren Hochs und höheren Tiefs und der SK der vorherigen Kerze ist kleiner als der SK's der ersten Kerze, wenn der SK von Kerze 1 kleiner als das Close ists1 = OPEN[3] < CLOSE[3] AND High[3] < High [2] AND High[2] < High[1] AND Low[3] < Low[2] AND Low[2] < Low[1] AND Close[1] <= Close[3]//Sell-Condition s2: Kerze vor 3 Perioden muss bearish sein und es müssen 3 Kerzen mit höheren hoch und hheren Tiefs und der SK der vorherigen Kerze ist kleiner als der SK's der ersten Kerze, wenn der SK von Kerze 1 kleiner als das Close ists2 =OPEN[3] > CLOSE[3] AND High[3] < High [2] AND High[2] < High[1] AND Low[3] < Low[2] AND Low[2] < Low[1] AND Close[1] <= Open[3]//Kauforder zur Eröffnung der nächsten Kerze wenn Konditionen l1 oder l2 erfüllt sindIF l1 OR l2 THENBUY 1 SHARES AT MARKET NextBarOpenENDIF//Verkauforder zur Eröffnung der nächsten Kerze wenn Konditionen s1 oder s2 erfüllt sindIF s1 OR s2 THENSELLSHORT 1 SHARE AT MARKET NextBarOpenENDIF//TP und SL-DefinitionSET TARGET %Profit 1SET STOP %Loss 107/25/2018 at 2:30 PM #76719That seems good. They are rare patterns, but the code works!
On Eur/Usd, daily, I could find just one occurrence of L1 (line 4) in a few years!
07/25/2018 at 2:43 PM #7672407/25/2018 at 2:53 PM #767261234567//For LONG trades:SET STOP LOSS (close – low[3]) //difference betwee current price and LOW of candle 3SET TARGET PROFIT (high[1] – close) //difference between the HIGH of candle 1 and current price (a lower current price is assumed)//For SHORT trades:SET STOP LOSS (high[3] – close) //difference betwee current price and HIGHof candle 3SET TARGET PROFIT (close – low[1]) //difference between the LOW of candle 1 and current price (a higher current price is assumed)07/25/2018 at 4:06 PM #76735Hi Roberto,
agein I’d like to thank you.
Is this correct?
123456789101112131415161718192021222324252627282930313233DEFPARAM CumulateOrders = true//Buy-Condition l1: Kerze vor 3 Perioden muss bullish sein und es müssen 3 Kerzen mit tieferen Hochs und tieferen Tiefs folgen und der Schlusskurs der vorherigen Kerze muss größer sein als der Schlusskurs der ersten Kerzel1 = OPEN[3] < CLOSE[3] AND High[3] > High [2] AND High[2] > High[1] AND Low[3] > Low[2] AND Low[2] > Low[1] AND Close[1] >= Close[3]//Buy-Condition l2: Kerze vor 3 Perioden muss bearish sein und es müssen 3 Kerzen mit tieferen Hochs und tieferen Tiefs folgen und der Schlusskurs der vorherigen Kerze ist größer als das Open der ersten Kerzel2 = OPEN[3] > CLOSE[3] AND High[3] > High [2] AND High[2] > High[1] AND Low[3] > Low[2] AND Low[2] > Low[1] AND Close[1] >= Open[3]//Sell-Condition s1: Kerze vor 3 Perioden muss bullish sein und es müssen 3 Kerzen mit höheren Hochs und höheren Tiefs und der SK der vorherigen Kerze ist kleiner als der SK's der ersten Kerze, wenn der SK von Kerze 1 kleiner als das Close ists1 = OPEN[3] < CLOSE[3] AND High[3] < High [2] AND High[2] < High[1] AND Low[3] < Low[2] AND Low[2] < Low[1] AND Close[1] <= Close[3]//Sell-Condition s2: Kerze vor 3 Perioden muss bearish sein und es müssen 3 Kerzen mit höheren hoch und hheren Tiefs und der SK der vorherigen Kerze ist kleiner als der SK's der ersten Kerze, wenn der SK von Kerze 1 kleiner als das Close ists2 =OPEN[3] > CLOSE[3] AND High[3] < High [2] AND High[2] < High[1] AND Low[3] < Low[2] AND Low[2] < Low[1] AND Close[1] <= Open[3]//Kauforder zur Eröffnung der nächsten Kerze wenn Konditionen l1 oder l2 erfüllt sindIF l1 OR l2 THENBUY 1 SHARES AT MARKET NextBarOpenENDIF//Verkauforder zur Eröffnung der nächsten Kerze wenn Konditionen s1 oder s2 erfüllt sindIF s1 OR s2 THENSELLSHORT 1 SHARE AT MARKET NextBarOpenENDIF//For LONG trades:IF LongOnMarket THENSET STOP LOSS (close - low[3]) //difference betwee current price and LOW of candle 3SET TARGET PROFIT (high[1] - close) //difference between the HIGH of candle 1 and current price (a lower current price is assumed)EndIF//For SHORT trades:IF ShortOnMarket THENSET STOP LOSS (high[3] - close) //difference betwee current price and HIGHof candle 3SET TARGET PROFIT (close - low[1]) //difference between the LOW of candle 1 and current price (a higher current price is assumed)EndIf07/26/2018 at 12:23 AM #76756Yes, it is correct. Good job!
07/26/2018 at 9:17 AM #7676907/26/2018 at 10:25 AM #76779You should always use tick-by-tick option, to get correct results, especially on higher TFs.
As for sunday and weekend data, NO you cannot! You can exclude them from being displayed but they are still there and indicators will use them.
07/26/2018 at 11:11 AM #76788If your strategy has SET instructions or LIMIT or STOP instructions in it (which yours does) then you must test with tick by tick data turned on. If however your strategy does not have these and does all its trading at candle close/open then you do not need it turned on and you will then have the benefit of far more data to test on as tick by tick data is only available back to a certain date.
2 users thanked author for this post.
07/26/2018 at 2:56 PM #76813I think SL and TP should be amended…
When I’m Long:
SL is Low of candle before entry and TP is High of 3 candles before entryWhen I’m Short:
SL is High of candle before entry and TP is Low of 3 candles before entryPls find example attached
07/28/2018 at 9:31 AM #76938You agree with below Marc?
I’ll try below on my copy, I was expecting better performance and below may be what it needs?
Edit / PS – Still doesn’t look good? What are you getting, what is intended market and TF?
123456789IF LongonMarket THENSET STOP LOSS (Close - Low[1])SET TARGET PROFIT (High[3] - Close)EndIfIF ShortOnMarket THENSET STOP LOSS (High[1] - Close)SET TARGET PROFIT (Close - Low[3])EndIf1 user thanked author for this post.
07/28/2018 at 9:52 AM #76939I want to outline that Marc‘s code to deal with SL & TP will only work fron the 2nd candle on, since SET are not written after BUY/SELLSHORT, but only after detecting it’s ONMARKET (either long or short), which takes one whole candle to ProOrder to become aware of it! Not having a TP & SL for one candle is not a big problem for 1-minute charts, but for daily charts….. it could be an awful surprise!
1 user thanked author for this post.
07/28/2018 at 10:26 AM #76944Thank you Roberto.
I think the exit strategy needs work anyway as I changed to below and got attached far better results with the values shown on attached.
12345678910111213IF LongonMarket THEN//SET STOP LOSS (Close - Low[1])//SET TARGET PROFIT (High[3] - Close)SET TARGET PPROFIT ASET STOP PLOSS BEndIfIF ShortOnMarket THEN//SET STOP LOSS (High[1] - Close)//SET TARGET PROFIT (Close - Low[3])SET TARGET PPROFIT CSET STOP PLOSS DEndIf1 user thanked author for this post.
07/28/2018 at 10:41 AM #76948What values did you assign to A, B, C and D?
07/28/2018 at 10:59 AM #76949What values did you assign to A, B, C and D?
I’m guessing 40 60 25 and 120.
-
AuthorPosts
Find exclusive trading pro-tools on