fxDreema

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

    Working Buttons in StrategyTester

    Tutorials by Users
    5
    5
    2005
    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.
    • F
      FenixTrading last edited by

      Hello everyone, someone asked to me in a old post how i solved the Working Buttons problem in StrategyTester, so i decided to make a tutorial about it.

      1. Create buttons in onInit Section like this, name it as you want, I used "buy" as name.
        0_1592560694294_284e041b-b226-4ee4-a8af-a272362a7a5a-image.png

      2. Now we need a block that detect the Test Mode, so we insert "If Testing".

      3. After that we are going to select our object with the block "Select Object by Name", in the box write the same name of our button:
        0_1592561050389_5e569e97-ecef-4066-bbc1-57ac90c793bf-image.png

      4. The next step is to check when our button is pressed, so we will add the block "Check button state". If the button is pressed we want to Buy:
        0_1592561218573_328cffcf-991d-4cc5-bb45-520af33d9d56-image.png

      5. Since the MT4 buttons are like a switch, after we press this button it will stay pressed until we click again on it, this will involve in multiple Buy Market action in just a click. To avoid that, I fount another good solution.
        Just add this custom MQL code to reset the button state on "Not Pressed". So we will have only the buy market we want:

      0_1592561460570_08cdd7ae-1239-49ad-9dfc-55d23f12d947-image.png

      You don't need to edit this code, it will work with any button.

      I hope this tutorial will help a lot of you.
      Enjoy!

      A 1 Reply Last reply Reply Quote 2
      • A
        ambrogio @FenixTrading last edited by

        @fenixtrading thank you very much!

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

          THANK YOU BRU

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

            Thank you, this is amazing!

            1 Reply Last reply Reply Quote 0
            • B
              btrader last edited by

              I have a question on this custom code for the buttons in the tester which sets the state after it's pressed.
              I've used it in the MT4 version of an EA I'm building and it works perfectly.
              Just converted my creation to MT5 and I get a compile error on all these blocks on the buttons.

              What would be the MT5 version of this code?
              ObjectSet(LoadedObjectName(),OBJPROP_STATE,0);

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

              Online Users

              S
              D
              V
              O

              17
              Online

              146.7k
              Users

              22.4k
              Topics

              122.6k
              Posts

              Powered by NodeBB Forums | Contributors