fxDreema

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

    Time Arithmetic and Input

    Questions & Answers
    2
    4
    858
    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
      jado58 last edited by jado58

      Hi, what I'm trying to do is use the constant ( starttime) to indicate the first bar of 4bars. then I want to use the timestamp values to identify the series of 4 bars starting at start time. I've tried many things but I can't get it right.

      1.constant "starttime" is a string

      2.convert "starttime" using StringToDate and save into variable

      3.modify variable block to shift fwd for each of the 4 hours

      another issue entering different time value into the sting changes nothing

      https://fxdreema.com/shared/MskmJNdwb

      X 1 Reply Last reply Reply Quote 0
      • X
        Xfire @jado58 last edited by Xfire

        @jado58 I see you want to fill Hr1 with "Starttime_v" and this variable fill with "Starttime" by user input.
        if I understood your logic, you should change block number and first convert string to date and then fill your times variable.

        and I'm not sure about you formula format!

        IN GOD WE TRUST

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

          0_1586015559373_7cabe4f6-31d7-4e98-9717-ace3fde1f33f-image.png

          For some reason I cant convert the string to time, it takes on the day but not the hours and minuets

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

            I ended up using the custom MQL code block

            0_1586030104543_03b5d4f6-259c-42bf-b5ab-45524e57c736-image.png

            MqlDateTime str1,str2;

            TimeToStruct(StrToTime(starttime),str1);

            MqlDateTime hour1;

            hour1.day = str1.day;
            hour1.hour =str1.hour ;
            hour1.min =0 ;
            hour1.sec =00 ;
            hr1= str1.hour;

            MqlDateTime hour2;

            hour2.hour =str1.hour+1 ;
            hour2.min =0 ;
            hour2.sec =00 ;
            hr2=hour2.hour;

            MqlDateTime hour3;

            hour3.hour =str1.hour+2 ;
            hour3.min =0 ;
            hour3.sec =00 ;
            hr3=hour3.hour;

            MqlDateTime hour4;

            hour4.hour =str1.hour+3 ;
            hour4.min =0 ;
            hour4.sec =00 ;
            hr4=hour4.hour;

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

            Online Users

            J
            B
            A
            T
            M
            E
            C

            20
            Online

            146.7k
            Users

            22.4k
            Topics

            122.6k
            Posts

            Powered by NodeBB Forums | Contributors