fxDreema

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

    Incorrect Declaration in MT4

    Bug Reports
    2
    3
    1708
    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
      andyjames last edited by

      Hello,

      I have a global variable called T0BOpenTime which is initialised with "".

      When a trade opens I have a formula block, left operand text and nothing initialised ie blank, + right operand which is also blank. I store the result in T0BOpenTime with a correction +TimeToStr(TimeCurrent()). A bit long winded but the only way I can see to do it in fxDreema.

      When a trade closes I want to output in excel the global variable T0BOpenTime, in this file write block I selected formula results and T0BOpenTime.

      Compiling fails because the T0BOpenTime is declared as a double within the MQ4 code. I can get around this by manually changing the declaration in 2 places but it's a bit of a pain to do so on every compile.

      FileSeek(handle,0,SEEK_END);
      if (FileSize(handle)==0) {
      FileWrite(handle,"Time",C1Title,C2Title,C3Title,C4Title,C5Title,C6Title,C7Title,C8Title,C9Title,C10Title);
      }
      double f_e_attrTicket_1=(double)e_attrTicket();
      double f_e_attrOpenPrice_2=e_attrOpenPrice();
      double f_attrClosePrice_3=e_attrClosePrice();
      double f_fResult_4=T0BOpenTime;

      I know I can output the open time when the trade opens but at that point I do not know what the profit or loss will be. This is why I store the result to use when the trade closes.

      Any help much appreciated,
      Thank you,
      Andy

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

        Global variables from "Formula" are always double type.

        I think it will be the best for me to just add server time as the second column in "File write" block. This sounds reasonable.

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

          __Global variables from "Formula" are always double type.

          I think it will be the best for me to just add server time as the second column in "File write" block. This sounds reasonable.[/quote:ic8qdy2v]

          Great idea, thanks. 🙂

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

          Online Users

          M
          H
          C
          D
          G
          T
          N

          14
          Online

          146.7k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors