fxDreema

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

    variables vs contants

    Questions & Answers
    2
    16
    730
    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
      speedsk8r last edited by

      this might be a basic topic to some of you but I'm pretty confused on how/when to use a variable when it seems like a constant will do the same thing. I get that variables are just that "variable" but how is a constant that I can "vary" the value of in my EA not variable as well. what is an example that I would need to use a variable over a constant?

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

        You change constants, computer changes variables.

        Constants are constant from the computer's viewpoint

        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 1
        • S
          speedsk8r last edited by

          Ive watched some videos on the use of variables in fxdreema but the use/placement of them within blocks didnt make any sense to me.
          if for example I am trying to create something like a donchain upper and lower channel by reading the high and low within a period of candles and then display that on the chart how could i use a variable to keep up with those changes?

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

            @speedsk8r if you want to take some chart value and store that value, a variable is always the way to go.

            Maybe this helps
            https://fxdreema.com/tutorial/builder/constants-and-variables

            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 1
            • S
              speedsk8r last edited by

              i see a block that uses "new top in trend and new bottom in trend. how could i display that on a chart like a donchain line? could i just use those blocks and create a variable for use within those blocks?

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

                yes ive seen and read through that link. i can see that I can create and apply a variable like a constant to a given block but how do I know what that variable is reading on the chart if its automatically going to change values. what determines what data that variable is getting?

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

                  for example in the "new top on trend" block it has 3 parameters that all seem to be fixed values. if i want to use a variable to read the new top in the trend how would i go about that?

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

                    @speedsk8r that is probably not the right block for you. The block gives you a yes/no answer, not a price level.

                    Its probably better for you to use modify variables block and then select highest/lowest price from market properties.
                    c16d7085-77f2-4501-a40e-88ecd4d30d93-image.png

                    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 1
                    • S
                      speedsk8r last edited by

                      ahh ok i see! so... i see that block is using the market properties to get the highest price within a period of candles id start id end. if its already doing that then what do I use as the variable input above?

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

                        The value will be stored in that variable so you can use it later.

                        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 1
                        • S
                          speedsk8r last edited by

                          ahh ok i see.. so then if the retrieved value is the variable what do I attach the output of that block to? does the output of that block do the same thing as the value stored in the variable? is the proper way to let that block stand alone in my workspace and not attached to anything else?

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

                            @speedsk8r well that depends on your project, what you are trying to accomplish...

                            But in general, you should connect everything on one chain so the proper order is ensured; you should first update your variable and then use it, not try to use a variable before it has a value.

                            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 1
                            • S
                              speedsk8r last edited by

                              yes I understand that logic. I need the value before I can display it on the chart as an object or line. I think I also understand that variables are retrieved values from the operations of a specific block. Im trying to lastly understand that in order to use that retrieved variable do I need to have that block connected to something or will it read the changing values anyways and I can just apply that variable to anything else connected or otherwise.
                              for example.. if I want to buy when a new high is made by the upper donchain and a new high is made by the lower donchain it seems like I would need to connect that block to an order block or a series of blocks responsible for my order flow.

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

                                up until right now I've never noticed to the modify variables block! A big discovery for me and a source of my consternation on understanding this topic. thank you for the help Roar!

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

                                  if the value of a variable is "retrieved" by the system then should I not be using my own value when creating them? If I do use a value then how do I determine what that value is? wont that value be changed even if I set it preliminarily?

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

                                    @speedsk8r when you create a variable, usually it gets a default value of 0 unless you specify something else. The default value doesnt matter, the system will replace it anyway.

                                    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 1
                                    • 1 / 1
                                    • First post
                                      Last post

                                    Online Users

                                    A
                                    Z
                                    T
                                    B
                                    A
                                    P

                                    15
                                    Online

                                    146.7k
                                    Users

                                    22.4k
                                    Topics

                                    122.6k
                                    Posts

                                    Powered by NodeBB Forums | Contributors