Description of Price Action Engulfing Candles Strategy

Forums Strategies and Expert Advisors Price Action Engulfing Candles EA Description of Price Action Engulfing Candles Strategy

  • This topic is empty.
Viewing 15 posts - 16 through 30 (of 87 total)
  • Author
    Posts
  • #4527
    Dominik
    Administrator

      Hi everyone!

      Today I will try to explain you how to make strategy tests reasonably and how to optimize strategy in shortest possible way. This description applies to all currency pairs, commodities, equities, indices etc. The length of the period of testing is dependent on the timeframe. There is a lot of different theories (on this subject), but practice shows that each strategy is different and you can not generalize that there is one perfect way to find the appropriate testing period etc. I made the assumption that for M5 timeframe optimization period since 2010 or 2012 is sufficient. It would be good if the strategy optimized for this period gives good results also from, for example, 2000 year, but unfortunately perfect things in nature do not occur, so we can expect that the strategy optimized for a given period will work best only in the same period. The most important issue is the steady growth with little drawdown, because it allows us to appropriate money management, which contributes to larger profits while increasing the size of the lot without risking a large drawdown.

      Techniques to obtain the best strategy may be several, depending on what we expect from the system. If we take maximum profit as the main goal, regardless of any other , we get probably the most aggressive and profitable, but also unstable system with the possibility of a big drawdown in future. If we take drawdown and/or profit factor – we get less profitable, but stable system with sustainable growth. I personally prefer systems with stable growth and proper money management in order to achieve the desired profit in the long term. In my opinion, when the system has the risk reduced to a minimum and brings regular profit then we can talk about success. In all other cases, where the profit is instantaneous and there are large drawdowns on the account, the perspective is so uncertain that it’s comparable to betting on the horses or playing roulette. Exactly this situation is with 99% Expert Advisors, which can be bought on MQL market and in other places – great optimized systems to prove to all people (potential customers) huge profits in a short time, but what happens next, after a few weeks or months of wonderfully work? It blows up accounts of all subscribers and then, with all “magical” profit, this “magical” signal disappears, along with its provider. Who earned? (Hint: only one person) Signal provider!

      OK. I go to the point. As you know, our system has a lot of parameters and it would be best to optimize all parameters at the same time, but due to the number of combinations optimizing all at once is practically impossible. Not without reason, the parameter’s list was divided into blocks. Besides that the parameters have been ordered by the relationship to each other, this was done to simplify and shorten in time the process of optimization aswell.

      The most important parameters that should be optimized as the first are parameters for: Buy/Sell Stop orders, Take Profit, Break Even, Trailing Stop Loss (optional). All parameters for pattern we can set to “False”. We cun turn off filters: RSI low level=100, ADX low level=0, ADX high level=100, Trading days = all “True”, Trading hours 0-24, all Min size of candles=0, all Max size of candles=5000 or more. We can also turn off “Room to the left” by setting large number (e.g. 5000) as a “Candles_to_Room_to_the_left”. All previously mentioned will be optimized at the very end of optimization process.

      As I said, at the beginning of optimizing new period of time, new timeframe or new currency pair, most important parameters are not these which filtrate bad orders (as RSI, ADX, RTTL, sizes etc.), but these which directly determine the circumstances of triggering orders. It is crucial to understand functioning of the system at all stages, so I also suggest to focus on the graphical analysis of system in the “Visual mode” in tester. It’s especially useful in process of removing losing trades through step by step analysis and exclusion conditions leading to losses.

      Many parameters can be optimized in pairs or 3 at one time, in different combinations, for example:

      1) Candles_To_Take_To Stop + Stops_Distance_from_Extreme + Buy_Sell_Stop_Expiation
      2) Candles_To_Take_To_TP + TP_Distance_from_Extreme
      3) Candles_To_Take_To_SL + SL_Distance_from_Extreme
      4) Candles_To_Take_To_Extreme + Min_Stop_Distance_to_Extreme
      5) Candles_To_Room_to_the_left + Room_to_the_left
      6) (“BE”=True) BE_Min_Distance_from_Price_To_Modify_Order + BE_Distance_from_Open_Order_Price
      7) (“Sl_Follow”=True) SL_Follow_Points_from_Price + SL_Follow_Min_Distance_from_SL
      When we have best parameters for number 7) we can test 2 cases of “SL_Follow”: True and False.
      8) All parameters frm “Engulfing pattern” block together
      9) All sizes of candles can be optimized separately
      10) RSI_Period + RSI_Low_Level
      11) ADX_Period + ADX_Low_Level + ADX_High_Level
      12) All parameters from “Trading Days” together
      13) “Trading hours” can be optimized separately

      This method (points above) is the fastest, in my opinion. If regardless of settings of parameters strategy isn’t good enough for specified currency pair or timeframe it may be necessary to make some changes in code of program. As always, I wait for every proposals of changes which would improve our system.

      In a few days I’ll try to make short video with example of optimization process and with another description and I will upload link here.

      It’s already enough for today. If you have any questions please feel free to ask here.

      Regards!

      #4528
      Dominik
      Administrator

        Here are a few examples of the results of the optimization.

        First, Candles To Stop + Stop Distance:

        Another example, only Stops Expiration:

        And last for today, Room to the left (candle to start counting to the left + number of candles to the left):

        To be continued… :)

        #4529
        Dominik
        Administrator

          Hi! Today another examples of optimization.

          Take Profit:

          Stop Loss:

          RSI filter:

          Trading on Mondays and Fridays on/off:

          Break Even (as an auto-TP):

          Engulfing pattern parameters:

          #4530
          Dominik
          Administrator

            And this is how looks result for EURUSD (2012-now) after example of optimization from previous posts:

            In attachment you can find detailed report.

            File with parameters available in topic with parameters for EURUSD (here: https://theinvestbay.com/viewtopic.php?f=3&t=3).

            #4531
            xdrbgr
            Spectator

              @Dominik wrote:

              Hi everyone!

              Today I will try to explain you how to make strategy tests reasonably and how to optimize strategy in shortest possible way. This description applies to all currency pairs, commodities, equities, indices etc. The length of the period of testing is dependent on the timeframe. There is a lot of different theories (on this subject), but practice shows that each strategy is different and you can not generalize that there is one perfect way to find the appropriate testing period etc. I made the assumption that for M5 timeframe optimization period since 2010 or 2012 is sufficient. It would be good if the strategy optimized for this period gives good results also from, for example, 2000 year, but unfortunately perfect things in nature do not occur, so we can expect that the strategy optimized for a given period will work best only in the same period. The most important issue is the steady growth with little drawdown, because it allows us to appropriate money management, which contributes to larger profits while increasing the size of the lot without risking a large drawdown.

              Techniques to obtain the best strategy may be several, depending on what we expect from the system. If we take maximum profit as the main goal, regardless of any other , we get probably the most aggressive and profitable, but also unstable system with the possibility of a big drawdown in future. If we take drawdown and/or profit factor – we get less profitable, but stable system with sustainable growth. I personally prefer systems with stable growth and proper money management in order to achieve the desired profit in the long term. In my opinion, when the system has the risk reduced to a minimum and brings regular profit then we can talk about success. In all other cases, where the profit is instantaneous and there are large drawdowns on the account, the perspective is so uncertain that it’s comparable to betting on the horses or playing roulette. Exactly this situation is with 99% Expert Advisors, which can be bought on MQL market and in other places – great optimized systems to prove to all people (potential customers) huge profits in a short time, but what happens next, after a few weeks or months of wonderfully work? It blows up accounts of all subscribers and then, with all “magical” profit, this “magical” signal disappears, along with its provider. Who earned? (Hint: only one person) Signal provider!

              OK. I go to the point. As you know, our system has a lot of parameters and it would be best to optimize all parameters at the same time, but due to the number of combinations optimizing all at once is practically impossible. Not without reason, the parameter’s list was divided into blocks. Besides that the parameters have been ordered by the relationship to each other, this was done to simplify and shorten in time the process of optimization aswell.

              The most important parameters that should be optimized as the first are parameters for: Buy/Sell Stop orders, Take Profit, Break Even, Trailing Stop Loss (optional). All parameters for pattern we can set to “False”. We cun turn off filters: RSI low level=100, ADX low level=0, ADX high level=100, Trading days = all “True”, Trading hours 0-24, all Min size of candles=0, all Max size of candles=5000 or more. We can also turn off “Room to the left” by setting large number (e.g. 5000) as a “Candles_to_Room_to_the_left”. All previously mentioned will be optimized at the very end of optimization process.

              As I said, at the beginning of optimizing new period of time, new timeframe or new currency pair, most important parameters are not these which filtrate bad orders (as RSI, ADX, RTTL, sizes etc.), but these which directly determine the circumstances of triggering orders. It is crucial to understand functioning of the system at all stages, so I also suggest to focus on the graphical analysis of system in the “Visual mode” in tester. It’s especially useful in process of removing losing trades through step by step analysis and exclusion conditions leading to losses.

              Many parameters can be optimized in pairs or 3 at one time, in different combinations, for example:

              1) Candles_To_Take_To Stop + Stops_Distance_from_Extreme + Buy_Sell_Stop_Expiation
              2) Candles_To_Take_To_TP + TP_Distance_from_Extreme
              3) Candles_To_Take_To_SL + SL_Distance_from_Extreme
              4) Candles_To_Take_To_Extreme + Min_Stop_Distance_to_Extreme
              5) Candles_To_Room_to_the_left + Room_to_the_left
              6) (“BE”=True) BE_Min_Distance_from_Price_To_Modify_Order + BE_Distance_from_Open_Order_Price
              7) (“Sl_Follow”=True) SL_Follow_Points_from_Price + SL_Follow_Min_Distance_from_SL
              When we have best parameters for number 7) we can test 2 cases of “SL_Follow”: True and False.
              8) All parameters frm “Engulfing pattern” block together
              9) All sizes of candles can be optimized separately
              10) RSI_Period + RSI_Low_Level
              11) ADX_Period + ADX_Low_Level + ADX_High_Level
              12) All parameters from “Trading Days” together
              13) “Trading hours” can be optimized separately

              This method (points above) is the fastest, in my opinion. If regardless of settings of parameters strategy isn’t good enough for specified currency pair or timeframe it may be necessary to make some changes in code of program. As always, I wait for every proposals of changes which would improve our system.

              In a few days I’ll try to make short video with example of optimization process and with another description and I will upload link here.

              It’s already enough for today. If you have any questions please feel free to ask here.

              Regards!

              Dominik, thank you for a description of the expert optimization settings, and that too many parameters to optimize immediately. and do not know that to start to optimize in the first place.

              #4532
              Dominik
              Administrator

                Hi everyone!

                According to the idea of DimaExtreme I’m publishing new version of our Expert Advisor: 1.1

                In new version you can manually set constant size of trade in lots by turning off “Auto_Lots_To_Margin” (False) and setting “Trade_Size_in_Lots” to the desired value.

                Example for EURUSD, 1000$ initial deposit, 0.20 lot, 2012 – now:

                Regards!

                #4533
                Dominik
                Administrator

                  Hi!

                  Today I’m publishing new version of Price Action EA: 1.2 !

                  In new version we can switch on/off trading in the first and last day of each month (“First_Day_Of_Month” and “Last_Day_Of_Month”). We can also use market orders instead of pending orders (useful for strategy testing) with parameter “Stop_Orders_instead_of_Market_Orders”. Additionally, from now EA draws arrows on chart when there is new BUY or SELL signal. Also, I optimized code of program in new version a little bit.

                  In new version there are two experimental features: “Trailing_TP_in_BB” (with 2 parameters: “BB_Period_for_TP” and “BB_Deviation_for_TP”) and “Trailing_SL_in_BB” (with 2 parameters: “BB_Period_for_SL” and “BB_Deviation_for_SL”). The concept includes putting and moving Take Profit and Stop Loss automatically on Bollinger Bands. You can take a look on this short video how it works: https://www.youtube.com/watch?v=R9yxeXthGf8.

                  I made also several videos with examples of optimizing and testing of Expert Advisor:

                  First video shows how to start test in visual mode and analyze strategy BEFORE optimization: https://www.youtube.com/watch?v=ivbqyzF65IY.
                  It can be used, for example, if we’re going to test strategy on new timeframe or new currency pair. In this way we can also control the correctness of the operation of the strategy (triggering and expiring of pending orders, putting TPs, SLs etc.).

                  Second video is a quick example how to load settings and make optimization of some parameters of strategy: https://www.youtube.com/watch?v=tWi5uW8R6Xo. It shows how optimizing works in real time (so you can imagine how long can it take to optimize all parameters together.

                  Third and the last video about optimizing process shows the whole process of optimization of all parameters step by step: https://www.youtube.com/watch?v=U8uv6FRLpQ0.

                  New settings for EURUSD M5 you can find here: http://theinvestbay.com/viewtopic.php?f=3&t=3.

                  Regards!

                  In the first uploaded file (which was 2 times downloaded) was a small bug which can cause error and stop Expert Advisor. I suggest to re-download.

                  #4534
                  viper7o3
                  Spectator

                    Hi Dominik,
                    I have not tested your EA yet but looking very good. Anyway I have a suggestion about putting partial close on tp, or when it open order it opens 3-5 order with 3-5 different tp or more.
                    for example I open 0,1lot with 50% on the 1st tp and 30% on 2nd tp and 20% on 3rd tp so this way your EA it can scalp and follow trend, with SL moved to BE when it hit 1st tp and SL move to 1st tp when 2nd tp hit and so on. ( I hope it’ll do better :D )
                    Or we can use BB or S/R as TP or SL but still use partial closed.
                    I don’t know which one easier, open 3-5 order with different tp or with option of partial closed with 3-5 different tp and the SL change when it hit TP.
                    Sometime I also closed the trade when there is a 50 or more pip candle and enter again or not after it retraced. And some times I used last candle as an SL.

                    Thanks for sharing Dominik
                    Regards,

                    #4535
                    Dominik
                    Administrator

                      @jobudi888 wrote:

                      Hi Dominik,
                      I have not tested your EA yet but looking very good. Anyway I have a suggestion about putting partial close on tp, or when it open order it opens 3-5 order with 3-5 different tp or more.
                      for example I open 0,1lot with 50% on the 1st tp and 30% on 2nd tp and 20% on 3rd tp so this way your EA it can scalp and follow trend, with SL moved to BE when it hit 1st tp and SL move to 1st tp when 2nd tp hit and so on. ( I hope it’ll do better :D )
                      Or we can use BB or S/R as TP or SL but still use partial closed.
                      I don’t know which one easier, open 3-5 order with different tp or with option of partial closed with 3-5 different tp and the SL change when it hit TP.
                      Sometime I also closed the trade when there is a 50 or more pip candle and enter again or not after it retraced. And some times I used last candle as an SL.

                      Thanks for sharing Dominik
                      Regards,

                      Hi!

                      Thanks for the idea. I’ll consider to add it to next version if results will be reasonable. I’m working now on new functionality, so that all values can be automatic. Bollinger Bands are not the best solution for automatic TP and SL. I’m still looking for a better. I’m optimizing right now parameters for another currency pairs and I will compare them and I will try to find common features.

                      Regards!

                      P.S. If anyone has already downloaded first file with version 1.2 of EA (uploaded on forum yesterday), I suggest to re-download, because there was a small bug in it causing errors.

                      #4536
                      Dominik
                      Administrator

                        Hi!

                        In attachment you can find new version of Price Action EA: 1.3 !

                        Now, we can choose 1 from 4 different modifications of Engulfing Pattern to use. Pattern 4 is pattern from previous versions of EA. Pattern 1 has only small change in algorithm and patterns 2 and 3 are experimental versions of algorithm, which may work well for other currency pairs. We will see :)

                        Another new option is possibility to ignore 1st candle when is smaller than specified value of points – then candle number 2 becomes candle number 1, and candle number 3 becomes candle number 2.

                        Again, I added some new blocks for the parameters.

                        This version will work to the end of September 2016.
                        Until that time next version will be released.

                        Good luck!

                        #4537
                        tester228
                        Spectator

                          It would be nice if backtest with at least 15-20 points spread, as it is what most broker has now.

                          Also I don’t think it is a good idea to use M5 on price action strategy, it’s because the price can be too random and the support and resistance is not strong. Also the “spread effect” on lower timeframe would kill the profit. On higher timeframe spread doesn’t effect the performance much.

                          I will be optimizing for H1 on most of the pairs and will post it here. But since I am new to this EA, I need to understand what the settings do, so that i can optimize for H1. Because i am a swing trader, i like bigger profit for each trade.

                          Sir Admin thank you for your great EA that is really profitable!!! Thank you!

                          #4538
                          Dominik
                          Administrator

                            @sunny wrote:

                            It would be nice if backtest with at least 15-20 points spread, as it is what most broker has now.

                            Also I don’t think it is a good idea to use M5 on price action strategy, it’s because the price can be too random and the support and resistance is not strong. Also the “spread effect” on lower timeframe would kill the profit. On higher timeframe spread doesn’t effect the performance much.

                            I will be optimizing for H1 on most of the pairs and will post it here. But since I am new to this EA, I need to understand what the settings do, so that i can optimize for H1. Because i am a swing trader, i like bigger profit for each trade.

                            Sir Admin thank you for your great EA that is really profitable!!! Thank you!

                            Hi sunny!

                            You’re right about spread. Old settings with parameters for beta versions of EA was made with very small spread, but now for new versions of EA only settings for EURUSD are optimized and published and spread is set to 5, because it’s the closest value to the real value. For example, my both brokers have spread for EURUSD most of the time = approx. 1-3 points and commision is equal to approx. 4 points. For protection of future spreads, I can optimize another version of parameters for another version of EA on higher spread for EURUSD. Of course, for another currency pairs spread taken to optimization will be also higher, close to reality.

                            Regarding the second issue about which you write. I started to optimize currency pairs on the M5 timeframe, because it gave the best results. It would be great to optimize strategy on higher timeframes, but till today I just haven’t found time to do it yet. Another thing is that maybe it can be needed to modify the strategy to trade on higher TFs. I’m willing to do it and each day I’m improving this EA, so if anyone has any constructive comment, which can cause increase of the effectiveness of the strategy – just let me know. I’m on Skype each day :)

                            Regards and good luck!

                            #4539
                            tester228
                            Spectator

                              @Dominik wrote:

                              Hi sunny!

                              You’re right about spread. Old settings with parameters for beta versions of EA was made with very small spread, but now for new versions of EA only settings for EURUSD are optimized and published and spread is set to 5, because it’s the closest value to the real value. For example, my both brokers have spread for EURUSD most of the time = approx. 1-3 points and commision is equal to approx. 4 points. For protection of future spreads, I can optimize another version of parameters for another version of EA on higher spread for EURUSD. Of course, for another currency pairs spread taken to optimization will be also higher, close to reality.

                              Regarding the second issue about which you write. I started to optimize currency pairs on the M5 timeframe, because it gave the best results. It would be great to optimize strategy on higher timeframes, but till today I just haven’t found time to do it yet. Another thing is that maybe it can be needed to modify the strategy to trade on higher TFs. I’m willing to do it and each day I’m improving this EA, so if anyone has any constructive comment, which can cause increase of the effectiveness of the strategy – just let me know. I’m on Skype each day :)

                              Regards and good luck!

                              Thanks Dominik
                              I think we have different environment, my broker has around 15 points of spread but does not have commission.
                              I still don’t know if H1 will be a good idea because it gives too few trades, but more stable and accurate.
                              For now i will try M5 to M15 first. ;)

                              #4540
                              Dominik
                              Administrator

                                OK. I still think about my second strategy published on forum (viewtopic.php?f=13&t=19) – maybe it will be a good idea to combine both strategies together. I mean, to use 3 Moving Averages and to use engulfing patterns only in the direction of main trend (not counter-trend) and only these between two MAs with optimized values, for example 30 and 50.

                                I will code it and I will let you know about the results. Regards!

                                P.S. Here is example:

                                #4541
                                Give_me_Fuel
                                Spectator

                                  whether you can put one optimig setfill.Ja today I tried to optimize the system did not mogao.Probao everything and I was on youtube watching your video, but I did not succeed, however I find that the optimizira.?Thenks

                                Viewing 15 posts - 16 through 30 (of 87 total)
                                • The topic ‘Description of Price Action Engulfing Candles Strategy’ is closed to new replies.