fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    How to avoid losses at each tick?

    Questions & Answers
    4
    24
    7081
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      samdeka last edited by

      Hello Fxdreema.
      I was busy for professionnal stuff and now i am more free to have a time for trading.

      Please I would like that you help me to understand and improve the implementation of my EA.
      This time I made a simple EA which open a buy order when the value of CCI (14) > = 0 and
      Stochastic (14,5,5) with K crosses up D.
      Each Buy trade should close when CCI(14) becomes < 100.
      The EA should check those condition on every ticks event in timeframe H1.
      You can check the parameters here https://fxdreema.com/shared/lX2GKBYT
      The problem is that, when I test it on MT4, its not working properly as I want.
      The cute problem is that when the buy condition is OK (CCI+Stoch), on every tick
      a buy order is opened and immediately closed. That involves successive small
      losses on every tick, before getting a profit according to the open condition.
      Up to get the close condition (CCI<100).
      So, how did I get all these small losses on every tick, and how can I avoid them?

      I use a "close losable trade" block to avoid them, but there is no effect.
      Pleased find attached some MT4 Test results in H1 with EURAUD currency for the 6 last
      months and 1000 $ account balance (tick reports showing a succession of losses on every
      tick surrounded in red and matching graphic).

      Thank you.

      ......
      succession of losses on every tick euraud.jpg
      graphic euraud test.jpg

      1 Reply Last reply Reply Quote 0
      • fxDreema
        fxDreema last edited by

        I guess these are trades with loss > 1 pips. You open a trade in the first group of blocks, and right after that you have "Close losable trades". Trades are losable right when they are opened, how much... depends on the spread at that moment 🙂

        1 Reply Last reply Reply Quote 0
        • S
          samdeka last edited by

          __I guess these are trades with loss > 1 pips. You open a trade in the first group of blocks, and right after that you have "Close losable trades". Trades are losable right when they are opened, how much... depends on the spread at that moment :)[/quote:2rao6y07]

          Thanks for your response.
          Actually, i put the block "close losable trades" because previously, when tle block "Buy now" is active, i had always
          these successives losable buy orders on each tick. And I thought that "close losable trades" would stop the others buy orders.
          Mr real wish, is that when the buy trade is opened at CCI>100 and Stock (Kx>D), no other trade must be open again, until we get
          the close order condition (CCI<100). I wish only one active open trade from the open to close condition.

          How can I make it please?

          Thanx

          1 Reply Last reply Reply Quote 0
          • fxDreema
            fxDreema last edited by

            But you have block 7 directly after "If trade...", no conditions are checked and the trade is closed if CCI is.... whatever it is.

            1 Reply Last reply Reply Quote 0
            • S
              samdeka last edited by

              __But you have block 7 directly after "If trade...", no conditions are checked and the trade is closed if CCI is.... whatever it is.[/quote:19b467ap]
              Thanx for your response.
              Actually, I did not use the block "close losable trades" formely after the condition "If trade...".
              The fact is that, even if the block "close losable trades" is not there, i get still a buy order at each
              tick when CCI > 100 and stock (Kx>D). I wanted to avoid these losses with "close losable trades" but
              without ou with this block, I get the same results.
              So (maybe I dont understand properly english because I speak french), but what block, parameters condition
              or filter can I use, to send only one unique buy order when CCI > 100 and stock (Kx>D), and avoid any
              other buy orders whatever the following ticks, until CCI becomes < 100, and the unique buy order be closed.
              That is my real question, because I tried a lot of combination to make it, 😢 , but its not working properly
              as I want.

              Thank you for your advice again.

              1 Reply Last reply Reply Quote 0
              • fxDreema
                fxDreema last edited by

                I think the problem is that CCI can go above 100 and below 100 few times in the same candle. You know that the indicator value for the current candle is always moving up and down, it's not fixed. To create a trade you also have Stochastic, but to close it - only CCI, and CCI is free to go anywhere after the trade is created.

                1 Reply Last reply Reply Quote 0
                • S
                  samdeka last edited by

                  __I think the problem is that CCI can go above 100 and below 100 few times in the same candle. You know that the indicator value for the current candle is always moving up and down, it's not fixed. To create a trade you also have Stochastic, but to close it - only CCI, and CCI is free to go anywhere after the trade is created.[/quote:3dzp4oza]

                  Thank you for your response.
                  Indeed, CCI goes up and down many times in the same candle. That is why I use the two indicators CCI and Stochastic with specific parameters,
                  to send the buy order and make sure that, CCI will not go under 100 immediately.
                  Moreover, I chosed the close price of the current candle, to send the buy order, and make sure that the profit will be get until CCI < 100.
                  This strategy with 2 indicators, should avoid false buy signals on each tick (I checked it visually when I was designing the strategy).

                  But the real problem that I want to understand is why on each tick, even if CCI is still > 100 and stoch (K x>D), a buy order is opened and
                  immediately closed, whereas, CCI is not < 100. Normally, while CCI is not < 100, no close order should be send.
                  But at each tick, when CCI (14) is still > 100 and stoch(14-5-5) (K x>D), a buy order is sent, and immediately closed at the next tick, even if
                  CCI is still > 100.
                  How can I avoid these close of buy trades? Is it possible de fix only one opened trade, in spite of others ticks, until CCI< 100?

                  Thanx. Waiting for your advise.

                  1 Reply Last reply Reply Quote 0
                  • roar
                    roar last edited by

                    I use to avoid the small loss problem with "no position is running" block and and set the minimum profit and loss a few pips from open..

                    Need small help? Tag me in your post
                    Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                    1 Reply Last reply Reply Quote 0
                    • S
                      samdeka last edited by

                      __I use to avoid the small loss problem with "no position is running" block and and set the minimum profit and loss a few pips from open..[/quote:16lhmjx5]

                      Excuse me but I dont get properly your explaination.
                      How can I use the "no position (trade/pending order) is running block" if a trade is already opened?
                      Actually, I would like that if a buy order is opened, no other order should be open again, until the close condition be executed,
                      whatever the following ticks.
                      Is there a particular block, to stop other trades, if one is already existing or pending?
                      Or how can I set such parameters?
                      Do you have an example with "no position is running" block?

                      Thanx again

                      1 Reply Last reply Reply Quote 0
                      • F
                        FHTrading last edited by

                        I can explain it to you,

                        You can search this block: "No trade is running" then put it on the top of the designe and connect it to the next block that was at the top, for example a condition block. The main thing is that this block has to be placed at the top of the procces wich opens the trades.

                        Also yo have to use the orange output to no trade running or the yellow output to the oposite situation.

                        I hope it was useful

                        1 Reply Last reply Reply Quote 0
                        • S
                          samdeka last edited by

                          __I can explain it to you,

                          You can search this block: "No trade is running" then put it on the top of the designe and connect it to the next block that was at the top, for example a condition block. The main thing is that this block has to be placed at the top of the procces wich opens the trades.

                          Also yo have to use the orange output to no trade running or the yellow output to the oposite situation.

                          I hope it was useful[/quote:gwkkx8ly]

                          Thanx. I will test it and give you back the results.

                          1 Reply Last reply Reply Quote 0
                          • roar
                            roar last edited by

                            I noticed you already have "no trade is running" block in your ea, so the logic is fine, the condition blocks just happen to give a lot of opening signals.
                            I would use "close profitable positions" instead of just "close trades" and set a minimum profit, and also a minimum loss to the "close losable positions" block.

                            Need small help? Tag me in your post
                            Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                            1 Reply Last reply Reply Quote 0
                            • S
                              samdeka last edited by

                              __I noticed you already have "no trade is running" block in your ea, so the logic is fine, the condition blocks just happen to give a lot of opening signals.
                              I would use "close profitable positions" instead of just "close trades" and set a minimum profit, and also a minimum loss to the "close losable positions" block.[/quote:21kudnul]
                              Thank you so much roar for your advice, I will test it.

                              1 Reply Last reply Reply Quote 0
                              • S
                                samdeka last edited by

                                ____I noticed you already have "no trade is running" block in your ea, so the logic is fine, the condition blocks just happen to give a lot of opening signals.
                                I would use "close profitable positions" instead of just "close trades" and set a minimum profit, and also a minimum loss to the "close losable positions" block.[/quote:3smng7up]
                                Thank you so much roar for your advice, I will test it.[/quote:3smng7up]
                                Wooohh, its working.
                                The small loss have disappeared. the EA is working. Not exactly as I want, but its working.
                                Thanx a lot.
                                So Lets go to improve it.

                                Very very happy.
                                Thanx everyone for your kindly help and advice.

                                This is the link https://fxdreema.com/shared/x6vjgwcxe

                                1 Reply Last reply Reply Quote 0
                                • roar
                                  roar last edited by

                                  That is good to hear!

                                  By the way, you will soon have a shortage of connections (theres a limit of 10 in the free version). You can spare one with replacing the "close losable trades" with a stop-loss value in the "buy now" block. Also, chaining the blocks to each other has the same effect as the "AND" block.

                                  Edit: Found a little flaw in your setup.. It only closes losable trades when "if trade exists" is false = no trade exists, so it holds the trades open until it turns profitable or your equilty reaches 0 and a stop-out occurs 😕

                                  Need small help? Tag me in your post
                                  Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                                  1 Reply Last reply Reply Quote 0
                                  • S
                                    samdeka last edited by

                                    __That is good to hear!

                                    By the way, you will soon have a shortage of connections (theres a limit of 10 in the free version). You can spare one with replacing the "close losable trades" with a stop-loss value in the "buy now" block. Also, chaining the blocks to each other has the same effect as the "AND" block.

                                    Edit: Found a little flaw in your setup.. It only closes losable trades when "if trade exists" is false = no trade exists, so it holds the trades open until it turns profitable or your equilty reaches 0 and a stop-out occurs 😕[/quote:4rxfg30j]

                                    Thanx. I will check you advices and reply you back.

                                    1 Reply Last reply Reply Quote 0
                                    • S
                                      samdeka last edited by

                                      Hello everyone and thanks for your programming help.
                                      My problem compilation has been fixed and now I can test easily my strategy.
                                      Now, the small losses has disappeared. I think it was the "Close trades" which was wrong.
                                      So this time, Id like to check if my CCI strategy can work bothly with "buy" and "sell" blocks.
                                      When I test it, I see differents problems:
                                      1- it is only the sell trades which are took in account, and the buy ones are not considered
                                      2- all the sell trades are not took in account, some are missed up
                                      3- I tested from January to june, but the test runs only for the month of january
                                      4- at the end of the test, the tester jumps from the end of january to the end of june
                                      (february,march, april, and may are missed up), and we have the type "close at stop" and a big
                                      loss of pips. How can this happen and how can I avoid it?

                                      This is the link https://fxdreema.com/shared/bUnpDjCQc

                                      Tell me all the critcis and advises. Thanx

                                      ......
                                      close at stop loss and sell trades only.jpg
                                      losses due to close at stop.jpg

                                      1 Reply Last reply Reply Quote 0
                                      • roar
                                        roar last edited by

                                        Your chart history data is probably bad.. You can re-download them this way (in mt5 at least):

                                        • close metatrader
                                        • locate the metatrader history folder, here's an example path: C:\Users\ExampleUser\AppData\Roaming\MetaQuotes\Terminal\D0E09F77C8C37AD8BF0E51FF834584\bases\Alpari-MT5\history
                                        • delete everything inside the "history" folder
                                        • start strategy tester, it should download new data automatically

                                        Need small help? Tag me in your post
                                        Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                                        1 Reply Last reply Reply Quote 0
                                        • fxDreema
                                          fxDreema last edited by

                                          I think it works for me. I disabled block 2 to check sells and this is the result: http://prntscr.com/40d3cx

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 1 / 2
                                          • First post
                                            Last post

                                          Online Users

                                          E
                                          H

                                          10
                                          Online

                                          146.7k
                                          Users

                                          22.4k
                                          Topics

                                          122.6k
                                          Posts

                                          Powered by NodeBB Forums | Contributors