Download MetaTrader 5

Trying my hand at Expert Advisor, unable to use printf

To add comments, please log in or register
Deposit to your account via Visa QIWI Wallet
Pronoe
10
Pronoe 2016.03.11 10:01 

Hi guys,


I started fooling around with MetaEditor and I'm not able to do a simple printf. Here is my code

double down = 10;
double fast=iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,0);

void OnTick()
{
  printf("fast=",fast);
  printf("slow=",down);
}

The code compile without error, I'm able to make it run in the Strategy Tester.

However when I'm looking at the journal this is all I can see over and over again.


2016.03.11 22:50:20.738    2016.03.10 19:28  test EURUSD,M5: slow=
2016.03.11 22:50:20.738    2016.03.10 19:28  test EURUSD,M5: fast=
2016.03.11 22:50:20.738    2016.03.10 19:28  test EURUSD,M5: slow=
2016.03.11 22:50:20.738    2016.03.10 19:28  test EURUSD,M5: fast=
2016.03.11 22:50:20.738    2016.03.10 19:28  test EURUSD,M5: slow=
2016.03.11 22:50:20.500    2016.03.10 17:44  test EURUSD,M5: fast=
2016.03.11 22:50:20.500    2016.03.10 17:44  test EURUSD,M5: slow=

What am I doing wrong?


Thanks in advance

Keith Watford
Moderator
9603
Keith Watford 2016.03.11 10:54  
You have no format flags. It looks like you just need to use Print()
Pronoe
10
Pronoe 2016.03.11 10:59  
I tried but the software doesn't seem to know this function, first I don't get the auto completion when I type it, then when I type it, it doesn't change color like other functions and when I try to compile it I have an error : 'print' - function not defined
Vasyl Nosal
18535
Vasyl Nosal 2016.03.11 11:04  
Pronoe:
I tried but the software doesn't seem to know this function, first I don't get the auto completion when I type it, then when I type it, it doesn't change color like other functions and when I try to compile it I have an error : 'print' - function not defined
Print
Pronoe
10
Pronoe 2016.03.11 11:09  
oooooh, didn't pay attention of the Capital p. thanks for your help guys it worked.
To add comments, please log in or register