Incorrect Declaration in MT4
-
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 -
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.
-
__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.
