fxDreema

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

    Day of the week into a string variable

    Questions & Answers
    2
    12
    587
    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.
    • T
      Temmy 25 last edited by Temmy 25

      Please help me implement this.
      After successfully closing my trade using the close trade block, I want to save the current day of the week into a string variable and show it in the journal using log message block.

      The difficulty for me is how to get the day of the week.
      Is there a way to know what day of the week is it and save that as a string variable?

      fx.PNG

      T 1 Reply Last reply Reply Quote 0
      • T
        Temmy 25 @Temmy 25 last edited by

        @Temmy-25

        Or any idea on how to convert UNIX time to day of week?

        fx.PNG

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

          If you use this DayOfWeek(); you will get the number, 0=Sunday. Then write this into custom code.
          if (DayOfWeek()==0) Day_variable="Sunday";
          else if (DayOfWeek()==1) Day_variable="Monday";
          else if (DayOfWeek()==2) Day_variable="Tuesday";
          Do this for all days.

          Learn fxDreema Without the Wait!

          My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

          The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

          Don’t miss out

          Click here➡️ https://mybook.to/fxDreema to get your copy today!

          Enjoy! 😊

          T 1 Reply Last reply Reply Quote 0
          • T
            Temmy 25 @jstap last edited by

            @jstap Thank you
            I will try this

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

              I got it wrong day constant, I meant variable.

              Learn fxDreema Without the Wait!

              My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

              The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

              Don’t miss out

              Click here➡️ https://mybook.to/fxDreema to get your copy today!

              Enjoy! 😊

              T 1 Reply Last reply Reply Quote 0
              • T
                Temmy 25 @jstap last edited by

                @jstap
                Please how do I save this into a variable or is it automatic and the name of the variable must be Day_variable?

                Sorry, I have no programming experience

                fx.PNG

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

                  Like that, the day variable will always have the day it is, so as you have it should print the name in a log message.

                  Learn fxDreema Without the Wait!

                  My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                  The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                  Don’t miss out

                  Click here➡️ https://mybook.to/fxDreema to get your copy today!

                  Enjoy! 😊

                  T 2 Replies Last reply Reply Quote 0
                  • T
                    Temmy 25 @jstap last edited by

                    @jstap Thank you. It works

                    1 Reply Last reply Reply Quote 0
                    • T
                      Temmy 25 @jstap last edited by

                      @jstap
                      Please I have another issue with this
                      The custom code runs as if it is directly under on Tick
                      At the beginning of the day, it logs the week day variable
                      But I only want it to log the week day variable after a particular profit is reach for the day

                      I open trades for the day from 10am
                      The day of the week logs at the first tick of the day, 1 am

                      fx.PNG

                      fx1.PNG

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

                        I am not sure what you're asking, under the once a day block it will only run once at that time.

                        Learn fxDreema Without the Wait!

                        My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                        The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                        Don’t miss out

                        Click here➡️ https://mybook.to/fxDreema to get your copy today!

                        Enjoy! 😊

                        T 1 Reply Last reply Reply Quote 0
                        • T
                          Temmy 25 @jstap last edited by

                          @jstap
                          I want it to run once a day only after the check profit block is true
                          But instead it runs at the beginning of each day when the check profit block isn't yet true

                          1 Reply Last reply Reply Quote 0
                          • T
                            Temmy 25 last edited by

                            I figured what the problem is
                            The block is running before another block that resets my group number
                            Thanks for your help

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

                            Online Users

                            D
                            S
                            G

                            13
                            Online

                            146.7k
                            Users

                            22.4k
                            Topics

                            122.6k
                            Posts

                            Powered by NodeBB Forums | Contributors