start() function is not being executed

 

Hello

I'm very new to MQL4 programming but I have a lot of experience in programming

I started with the most simple program to get a first feel of how things work. init() function is being called but start() function is never called

This is my code:

#property copyright "talfink"

#property link "http://www.metaquotes.net"


//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

//----

MessageBox("Hello world\n");

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

MessageBox("Goodbye world\n");

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

//----

MessageBox("Running world\n");

//----

return(0);

}

//+------------------------------------------------------------------+

when I tried to call start() function from the init function it was executed
Can anyone explain me why start() function is not executed? or send me a link how to use it?
I tried to look for a solution online but couldn't
And I run my EA while there is trading, I see the quotes changing on the graph but I never get to start() function

Thank you in advance,
Tal

 
1) MessageBox() needs a dll to work at least use #include <WinUser32.mqh>

2) no need MessageBox() to chack or test something use Print() or Alert() (easier)
 

Thank you for the quick response

1. Since I didn't do include, Why did the MessageBox() worked on init() and deinit() functions?
2. Where do I see the output of Print()?

 
talfink:

Thank you for the quick response

1. Since I didn't do include, Why did the MessageBox() worked on init() and deinit() functions?

i don't know

2. Where do I see the output of Print()?

in the "experts" tab

 

MessageBox needs to click on a button to purchase the programm and if not clicked, even if there is a tick (wich will automatically execute the start function), the programm (EA) will not be execute untill you have clicked on the init MessageBox () button

I think it's the explication

Maybe I wrongbut it's what I think...

 
I tried using Print and it still didn't work (only init() and deinit() prints were shown)
Is it possible that it doesn't work since I'm using a Demo account?
I thought of trying working with a demo account first before I move to a real account...
 
check if there is some error/message in the journal/experts tab (expert is forbidden ect.)
 
No, I am using a demo account in this momment for debugging my EA and it works good, maybe problems with your broker, you have some ticks?
 
talfink:


when I tried to call start() function from the init function it was executed

You don't call start() . . . it is called when a tick arrives . . . if you have no ticks because you are offline start will not be called.

Try running it in the Strategy tester.

 

Please use this to post code . . . it makes it easier to read.

 
emmett_brown:

MessageBox needs to click on a button to purchase the programm and if not clicked, even if there is a tick (wich will automatically execute the start function), the programm (EA) will not be execute untill you have clicked on the init MessageBox () button

I think it's the explication

Maybe I wrongbut it's what I think...


I did click it, and I also removed the MessageBox() on init() function so the only line of code I had was the one in start, didn't work

Reason: