hello world

 

trying since hours invain

void main(){printf("hello world");}

 

Is that it? There's a few things wrong with it.

1. main() is a custom function so has to be referenced in either the functions init(), deinit() or start(). See the documentation.

2. printf() isn't a function in mql. Print() is a function which sends a message to the expert tab of the terminal.

3. In future use for code use the SRC button.

If you want to send at init() use

int init()
{
Print("Hello World");
}

For every new tick, start()

int start()
{
Print("Hello World");
}

For when the chart changes or file is removed deinit()

int deinit()
{
Print("Hello World");
}

Or you can test function references:

int init()
{
main();
}

void main()
{
Print("Hello World");
}

All of those should print out Hello World in the expert tab of the terminal.

 
heelflip43:

Is that it? There's a few things wrong with it.

1. main() is a custom function so has to be referenced in either the functions init(), deinit() or start(). See the documentation.

2. printf() isn't a function in mql. Print() is a function which sends a message to the expert tab of the terminal.

3. In future use for code use the SRC button.

If you want to send at init() use

For every new tick, start()

For when the chart changes or file is removed deinit()

Or you can test function references:

All of those should print out Hello World in the expert tab of the terminal.

its not MQL
 
Well this is a MQL forum and since he didn't state otherwise I assumed that he was talking about MQL. To be honest it looks as if he's trying to get a DLL to work but since he didn't state that he was...
 
I wrote the C-program to be converted into MQ4
what's the SRC button
what's a dll
the first program doesn't compile
the second compiles, attach it to a chart - nothing happens
should work without deinit ?
> expert tab of the terminal
so I click
view
terminal
expert
ahh, yes. Thanks !
There it is printed into. I didn't get the idea to open that "tab".
other errors :print instead of Print
init() instead of start()
ascii 26 at file-end
I had found several other hello world programs+description/tutorial
in other forums. None of them worked for me.
Well, maybe they did but I just didn't know where to look for output.
PlaySound gave no noise or must I attach a speaker somewhere ?
 
The attached indicator should give you an idea of what to do.
Files:
 

now, how to write Hello World to a file ?

 
uevst3e:

now, how to write Hello World to a file ?

Read this: https://book.mql4.com// then look here for File handling: https://docs.mql4.com/files
 

in theory I know how it should work ...

and yes, today it works in practice too. I don't know what was yesterday.

Maybe not enough memory, maybe I messed something up that was only recovered after reboot.

it creates a file in the directory \experts\files and writes to it

 
uevst3e:

in theory I know how it should work ...

and yes, today it works in practice too. I don't know what was yesterday.

Maybe not enough memory, maybe I messed something up that was only recovered after reboot.

it creates a file in the directory \experts\files and writes to it


doesn't seem to work today, so I'm back to step 0 ...

could it be memory ? cookies ?

--------------------------------------

ok, it prints hello world from init() and from deinit()

but not from start

int init() {
Print("Hello World from init() ");
return(0); }

int deinit(){
Print("Hello World from deinit() ");
return(0);}

int start(){
Print("Hello World from start() ");

return(0); }

 
uevst3e:


could it be memory ? cookies ?

Most likely your code . . .
Reason: