fxDreema

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

    Replace a previously closed trade

    Questions & Answers
    2
    14
    2978
    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.
    • M
      Moodybot1 last edited by

      Hi FXdreema

      After a trade has closed, i would like to be able to place a pending order at the same opening price as the closed trade with the same lot size.
      I am using a martingale entry so lot size changes between trades, any one of which may close.

      I think on trade close would be the best solution with the history but I cannot fathom out how I can get the opening price and lotsize of the closed trade, any advice would be appreciated.

      Andy

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

        Under "on Trade" get information from the trade that caused the even from "(on trade)...." category that appears in "Condition" and dynamic parameters in blocks. Recently I added a block named "Run blocks" and it can help to execute the block that creates trades.

        Otherwise you can always load parameters of the the last closed trade with "For each Closed Trade" (renamed from "Start history trades loop") with 'Not more than "n" trades" parameter set to 1. But now use parameters from "(in loop)..." category.

        I think you probably have to define Variable for the lot size and modify it.

        1 Reply Last reply Reply Quote 0
        • M
          Moodybot1 last edited by

          Thanks for the reply

          I am up to the point of using the variables, but for me that's a black art, any pointers would be appreciated,

          Cheers.

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

            Variables helps to re-use blocks and keep the project with less blocks. But you can always put many blocks.. at least until the browser starts to feel overloaded.

            1 Reply Last reply Reply Quote 0
            • M
              Moodybot1 last edited by

              Hi FX Dreema

              I have tried to add extra lots to a pending order using global variables, however no joy.

              I can see using F3 that the lot size is registered in the global variable but for the life of me I cannot see how to adjust
              a pending order to the lotsize stored.

              Do you have an example of something similar?

              Andy

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

                These global variables are called global variables, and they are really variables and really global, but they are used from MT for all EAs. In fact they are values written somewhere in some file that can be read from all EAs. Otherwise normal global variables works inside the EA.

                If you don't need to send variable from one EA to another, don't use these.

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

                  http://fxdreema.com/shared/6jEmcD4hd

                  1 Reply Last reply Reply Quote -1
                  • M
                    Moodybot1 last edited by

                    Thanks for the reply.

                    Using comment on chart I can see the lotsize that i require a pending order to be modified to, is there a way to access that value and modify the pending order?

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

                      But I don't know what variable you are using 😕

                      1 Reply Last reply Reply Quote 0
                      • M
                        Moodybot1 last edited by

                        Hi Fxdreema

                        Just getting back to looking at modifying the lotsize.

                        I have set up a variable Result1 to hold the new lotsize info but cant seem to get a pending order block to read the variable.

                        Is there anything else that I need to do to get the lotsize modified.

                        Cheers.

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

                          If you talk about your project Global Variables, there you have fixed size 0.1 lot for pending order 🙂 That formula result is not used.

                          1 Reply Last reply Reply Quote 0
                          • M
                            Moodybot1 last edited by

                            Hi

                            My mistake,it should have been result2.

                            So basically i need to try and get the information from result2 into the pending order.

                            Iv'e tried every which way but no joy.

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

                              "Formula" block creates global variable named "Result1" in your case. This global variable can be used everywhere because it is global.
                              But in "Buy now" you can use this option "Dynamic value". And in "on Trade" use "(on trade) Trade/Order under on Trade event" instead of "(in loop)...".

                              1 Reply Last reply Reply Quote 0
                              • M
                                Moodybot1 last edited by

                                Dynamic value works a treat, thanks for the advice.

                                Cheers

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

                                Online Users

                                G
                                E
                                E
                                M
                                O
                                B
                                M
                                Z
                                S
                                S
                                T
                                B

                                29
                                Online

                                146.7k
                                Users

                                22.4k
                                Topics

                                122.6k
                                Posts

                                Powered by NodeBB Forums | Contributors