fxDreema

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

    Using time in formula

    Questions & Answers
    4
    7
    2924
    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.
    • A
      avrahambr last edited by

      Hi!

      I would like to use the time (hours only) in a formula. How?

      Thanks,
      Avraham

      R 1 Reply Last reply Reply Quote 0
      • R
        richard96816 @avrahambr last edited by

        @avrahambr Which 'hours'? Time of day or time in trade?

        I also would like to have a condition block for time in trade. Can't seem to find it. Perhaps my glasses are dirty ...

        Thanks

        1 Reply Last reply Reply Quote 0
        • J
          josecortesllobat last edited by

          You have the "check age" block

          0_1528753576746_81366a3a-3620-4952-9b01-8dae6ef01afb-image.png

          Might be what you are looking for.

          1 Reply Last reply Reply Quote 0
          • A
            avrahambr last edited by

            Thanks. Check age seems to help in time of the trade, which i also need. But i still need time of the day. Anyone knows?

            1 Reply Last reply Reply Quote 0
            • J
              josecortesllobat last edited by

              Hi @avrahambr

              You have some blocks that can help you in what you are trying to get on the "TimeFilter" pane

              0_1528805447475_b8aa289b-3254-43a0-9fb2-81f6532cf775-image.png

              If you are looking for a TimeFilter that allows or not the EA to run on that time period, this is how I am doing that

              0_1528805626801_d50a5fff-fbc3-4eda-9078-cb63178f5fad-image.png

              It works well for my purpose.

              You have time options in the "Condition block" as well

              0_1528806222350_cb26d88b-875c-45bd-b2a3-c4d4240c4fda-image.png

              There are many ways to do the same in fxDreema. If you share more detailed info of what you are trying to get, there are many people that will be glad to help giving you some guides/suggestions or sharing a simple EA for you. You don't have to give the whole logic of your project, of course. Just explain as much as possible what you need to achieve.

              1 Reply Last reply Reply Quote 0
              • A
                avrahambr last edited by

                Thanks!
                There is no secret here, just AlphaOmega's Mean reverse strategy from ForexFactory. There is a formula there, something like ((t+1)^2)/34 , when t is GMT time - only the hours. From the things you wrote here i see some way to do it, but a little complicated. Is there any straightforward way to do this?

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

                  If you want to get the current hour, for example if now is 13:05 and you want to get 13, then in MT4 you can try this:

                  TimeHour(TimeCurrent())
                  

                  ... where TimeCurrent() gives you the current server time as a number of seconds since 1.1.1970. TimeHour() obviously gets that number of seconds and gives you the current hour back.

                  Instead of TimeCurrent() you can use TimeLocal() or TimeGMT().

                  It's interesting that TimeHour() doesn't exist in MQL5, so it is a little but more complicated.

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

                  Online Users

                  E
                  N
                  S
                  K
                  M
                  L
                  E

                  12
                  Online

                  146.7k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors