help with mt4

Back to topics list To post a new topic, please log in or register
avatar
4
rjngh2005 2016.03.31 03:32
 

I have downloaded the MT4 software from FXCM USA

 

However when I start metaeditor  and i open the sample it says words like onInit and onTick

These are mt5  language code words

when I enter the following code from the book  as follows

 

//--------------------------------------------------------------------
// 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()
   } 

//--------------------------------------------------------------------

This code does not work when I compile it...

I have to modify all return statements to return(0);

 

Please advise how to change or modify the behaviour of the metaeditor so that it behaves like MT4 and not MT5

 

 

avatar
Moderator
3427
GumRai 2016.03.31 04:27 #
 

You can't change it. A lot of mql5 was absorbed into mql4 some time ago. However, the old functions still work as before.

If your posted code came from the book, then it has the errors that you have spotted. Fault the book, not mql4.

avatar
4
rjngh2005 2016.03.31 19:22 #
 

well...thanks for the reply...

I like the statement...'You can't change it'


Thanks...I shall modify my code accordingly...

Not a problem...I am used to this type of stuff...I have been coding 8 different languages since 1984  however I have started working on mt4 just recently.



avatar
13009
WHRoeder 2016.04.01 02:25 #
 

rjngh2005:

However when I start metaeditor  and i open the sample it says words like onInit and onTick

These are mt5  language code words

Not since February 3, 2014 (Build 600) Two years ago; RTFM.
Upcoming MetaTrader 4 and MQL4 Upgrades - Big Changes Are Underway - MQL4 forum
Back to topics list  

To add comments, please log in or register