fxDreema

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

    On-Off switch for Condition Block

    Questions & Answers
    4
    6
    2627
    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.
    • J
      jjot last edited by

      Hello, is there a way to form a condition block with a switch so that it can be switched on or off via the Metatrader? For example, that you can switch off an RSI filter (condition block) in the MT5 EA settings ... It would be nice if someone could help me.

      1 Reply Last reply Reply Quote 0
      • C
        CPBonzo last edited by

        Why not create a button and, using the "check button state" block, set the condition block such that it only passes if the button is pressed? I use buttons on most of my EAs and find them very useful for turning functions on and off directly from within MT4. There is a good tutorial on using buttons by @miro1360 here: https://fxdreema.com/forum/topic/4184/tutorial-03-ema-cross-part-3-buttons-beginners

        J 1 Reply Last reply Reply Quote 0
        • J
          jjot @CPBonzo last edited by

          @cpbonzo Thanks for the idea. Is there a way to do this without an object in the chart? E.g. with a switch that can be set to thru / false in the EA settings?

          A 1 Reply Last reply Reply Quote 0
          • C
            CPBonzo last edited by

            I would think the easiest way to do that is create a variable and then use a condition block such that if the variable is equal to a certain value it passes, otherwise it does not.

            1 Reply Last reply Reply Quote 0
            • L
              lllll last edited by

              Hello. I found something somewhere before.

              0_1593788909993_On Off Strategy.JPG

              So, go on On init (so that when the EA is loaded, it will init and load what you`re about to make): create 3 blocks.

              1: Condition. Left operant: Value (boolean). Create a new constant, rename it how you want, but the type (whereas default is Double), has to be "bool". Bool means that can have values True or False.
              Return to your Condition block, right click on the left operand and click on your newly created boolean Constant.
              The right operand is again boolean and its value has to be set to True.

              Link your block to another block (Turn on) and write the block number you want to turn on, if your condition is set to True. (in my case is 750). And create a Turn off block, linked in the yellow dot of the Boolean Condition, so. if It is not true, means that the function "Otherwise" will be activated, thus the yellow dot will activate the next block (Turn off).

              It may seem complicated... and is not easy to grasp the first times... but go with trial and error and you will make it work.

              P.s. The only the first 3 blocks should go on On Init, the rest I would put it on On tick.

              1 Reply Last reply Reply Quote 1
              • A
                alok @jjot last edited by

                @jjot said in On-Off switch for Condition Block:

                @cpbonzo Thanks for the idea. Is there a way to do this without an object in the chart? E.g. with a switch that can be set to thru / false in the EA settings?
                Try this
                0e08aa3e-fd50-4f11-ba08-ae5381a5b1ae-image.png

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

                Online Users

                Q
                C
                T
                S
                A
                M
                R
                G
                G
                Y
                C
                S
                S

                30
                Online

                146.7k
                Users

                22.4k
                Topics

                122.6k
                Posts

                Powered by NodeBB Forums | Contributors