Newbee first question

 

Hello guys,

I try the very first code in MQL4book below.

https://book.mql4.com/programm/execution

The compilation is fine.

When I "drag and drop" it to a chart, the window show up and I leave it default: Checking only "Enable Alert" and "Allow import of external experts"

Once click ok, the first Alert show up as planned. Funct. init() triggered at start

And it is all I got from the program :(

I leave it for 9 hours and nothing happen. No more Alert in the window.

I suspect that the setting of my terminal might cause this trouble.

I appreciate if you could help me to solve this issue.

Many thanks.

Harry

//--------------------------------------------------------------------
// create.mq4
// To be used as an example in MQL4 book.
//--------------------------------------------------------------------
int Count=0;                                    // Global variable
//--------------------------------------------------------------------
int init()                                      // Spec. funct. init()
   {
   Alert ("Funct. init() triggered at start");  // Alert
   return;                                      // Exit init()
   }   
//--------------------------------------------------------------------
int start()                                     // Spec. funct. start()
   {
   double Price = Bid;                          // Local variable
   Count++;                                     // Ticks counter
   Alert("New tick ",Count,"   Price = ",Price);// Alert
   return;                                      // Exit start()
   }
//--------------------------------------------------------------------
int deinit()                                    // Spec. funct. deinit()
   {
   Alert ("Funct. deinit() triggered at exit"); // Alert
   return;                                      // Exit deinit()
   }
//--------------------------------------------------------------------
 
I suspect you copied it to experts/indicators and ran it as an Indicator, you should copy it to experts/ and run it as an EA (Expert Advisor)
 
RaptorUK:
I suspect you copied it to experts/indicators and ran it as an Indicator, you should copy it to experts/ and run it as an EA (Expert Advisor)


Thanks RaptorUK.

Actually, it is EA.

Just as I read your replay, I click on the Expert Advisor and Alert keep showing up and yes never stop :)

I wonder it is required to click on EA to see the Alert?

Thansk,

Harry

 
Ah I see, you have to click on the Expert Advisors button so it goes from a Red x to a Green >, when you do this you should see a smiley face in the top right corner of your chart with the EA name, this shows that the EA is running.
 

i don't think u r on the same page with scfx

scfx:
[...]

Once click ok, the first Alert show up as planned. Funct. init() triggered at start

And it is all I got from the program :(

[...]

 

Yeah Raptor UK.

You are right!

Thanks a lot.

I have been working with SAS programming and it is my first time on MT4.

Hope you are still around helping when seeing SCFX questions :)

Thanks,

Harry

 
scfx:

Hope you are still around helping when seeing SCFX questions :)

Thanks,

Harry

I'm not planning on going anywhere soon ;-)
 

Another question please.

Now I can get EA running with alert show up nicely. When I want to kill a EA, I simply remove the EA from chart or click on the EA (to make it X-red).

However, in the Alert Tab, there are still alert of one of the EA I wrote and run before (i dont know on which chart). I dont know how to kill that EA.

I go through all chart 1 by 1, making sure that I remove all EA. Yep, still the alert pop up on the Alert tab.

How could we check all processes that are running and how to kill them?

Thanks a lot,

Harry.

 
scfx:

Another question please.

Now I can get EA running with alert show up nicely. When I want to kill a EA, I simply remove the EA from chart or click on the EA (to make it X-red).

Harry.

Yes, that's what I do too to stop all EAs running.
 
scfx:


I go through all chart 1 by 1, making sure that I remove all EA. Yep, still the alert pop up on the Alert tab.

How could we check all processes that are running and how to kill them?

You have to go through chart by chart to find where the EA is . . . but if you have clicked Expert Advisors so it goes to a Red X then that will halt all EAs running. Are you sure that Alert is caused by an EA ? could it be caused by an Indicator or Script or manually set Alert ?

In your EA above, if you had done this it would have made things clearer . . .

Alert (Symbol(), ": Funct. init() triggered at start");  // Alert
 
RaptorUK:

You have to go through chart by chart to find where the EA is . . . but if you have clicked Expert Advisors so it goes to a Red X then that will halt all EAs running. Are you sure that Alert is caused by an EA ? could it be caused by an Indicator or Script or manually set Alert ?

In your EA above, if you had done this it would have made things clearer . . .

he was referring "alert" as in what he saw in Tab

"However, in the Alert Tab, there are still alert"

So it may not be the audible 'Ting Tong' one.