Download MetaTrader 5
To add comments, please log in or register
Do you want to order an application? Find out how to obtain the desired result
NickBlack
65
NickBlack 2012.11.26 18:17 

hey, my programs are starting to get awfully long, I'm trying to keep everything nice and simple by using big spacing between sections and lots of comments.

but is there a way you can have different classes on different pages (and perhaps even have different groups of classes in their own folder) but still call them up the same way you normally would?


I'm sure this would be somewhere in the Mql4 book, but I cant seem to find it.

thanks!

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2012.11.26 18:25  
nickblack:

hey, my programs are starting to get awfully long, I'm trying to keep everything nice and simple by using big spacing between sections and lots of comments.

but is there a way you can have different classes on different pages (and perhaps even have different groups of classes in their own folder) but still call them up the same way you normally would?


I'm sure this would be somewhere in the Mql4 book, but I cant seem to find it.

thanks!


mql4 doesn't use classes . .  . that might explain why you can't find it in the book
NickBlack
65
NickBlack 2012.11.26 20:16  

what are the

int RandomName()

{

 code!

}

RandomName();


things called then?

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2012.11.26 20:22  
nickblack:

what are the

int RandomName()

{

 code!

}

RandomName();


things called then?

Function definition and Function call . . .
Ubzen
Moderator
5394
Ubzen 2012.11.26 20:30  
nickblack:

hey, my programs are starting to get awfully long, I'm trying to keep everything nice and simple by using big spacing between sections and lots of comments.

but is there a way you can have different classes on different pages (and perhaps even have different groups of classes in their own folder) but still call them up the same way you normally would?

I'm sure this would be somewhere in the Mql4 book, but I cant seem to find it.

thanks!

https://book.mql4.com/metaeditor/files Using include files/ and libraries might help.

https://docs.mql4.com/basis/preprosessor/include Here's some more documents.

NickBlack
65
NickBlack 2012.11.26 20:38  

RaptorUK, thanks ^.^ i thought the stuff inside the Functions were called functions (if/while, ect) thanks for correcting me :)

ubzen. Thank you! that should do the trick :)

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2012.11.26 20:46  
nickblack:

RaptorUK, thanks ^.^ i thought the stuff inside the Functions were called functions (if/while, ect) thanks for correcting me :)

ubzen. Thank you! that should do the trick :)

OrderSend() is a function, if and while are Operators


I know it's picky but using the correct terminology helps communication and also helps us all find stuff in the Documantation

whroeder1
13644
whroeder1 2012.11.27 14:22  
nickblack: hey, my programs are starting to get awfully long,

Use functions so you only have to look at small sections of code at a time. See my code.
DrZogg
140
DrZogg 2014.03.16 03:11  

Hi,

I'm also taking on classes but running into a brick wall quite frankly. My plan is to write all the components of my trading as classes so I can use the classes in ALL of my EA's. So I want different EA's to call the same classes from one folder instead of having to duplicate the classes over and over. But I have to use different brokers and several versions of EA's. So what I want to do is create folders in the projects folder (or maybe even an independent folder on c drive) and then separate the classes by broker. So I want all the EA's calling the same classes so if I have to change a class I do it for all EA's.

Putting the class in the include folder of one instance of MT is kind of pointless. I might just as well simply write functions instead if this is the case.

Does it have to be in the include folder ? And if not how do I call it ?

Ian Venner
2583
Ian Venner 2014.03.16 04:42  

I noticed something the other day, if you have several instances installed, and you go up two levels from the data folder to the Terminal folder, you see each instance there plus there is a also a "common" folder. I dont know for what or how that common folder is implemented, mine is empty, but I think MQ ought to set up that common folder to have its own set of experts folders that all instances can access. To save duplicating everything for each instance.

Each instance of MT4 and Metaeditor would then check its own set of native folders plus the common folder when building their navigator tree's and looking for include files, libraries, etc..

Ovo Cz
2955
Ovo Cz 2014.03.16 06:43  

Not sure if I understand your problem correctly. Do you mean you want to share source folders among different terminal installations?

I was using simple joins to share resources (templates, history, etc.), by creating symbolic links. Here is the cmd script I was using to create them. You may get inspired by it to share sources. Not sure if it is what you talked about though.

set broker_name=ForexBrokerFX

mkdir "C:\Users\Ovo\Documents\metatrader4\%broker_name%"
mkdir "C:\Users\Ovo\Documents\metatrader4\%broker_name%\experts"
mkdir "C:\Users\Ovo\Documents\metatrader4\%broker_name%\mailbox"
mkdir "C:\Users\Ovo\Documents\metatrader4\%broker_name%\profiles"
rem
rename experts experts_original
rename templates templates_original
rename history history_original
rename sounds sounds_original
rename languages languages_original
rename mailbox mailbox_original
rename profiles profiles_original
rem
mklink /j experts "C:\Users\Ovo\Documents\metatrader4\%broker_name%\experts"
mklink /j templates "C:\Users\Ovo\Documents\metatrader4\templates"
mklink /j history "C:\Users\Ovo\Documents\metatrader4\history"
mklink /j sounds "C:\Users\Ovo\Documents\metatrader4\sounds"
mklink /j languages "C:\Users\Ovo\Documents\metatrader4\languages"
mklink /j mailbox "C:\Users\Ovo\Documents\metatrader4\%broker_name%\mailbox"
mklink /j profiles "C:\Users\Ovo\Documents\metatrader4\%broker_name%\profiles"
set broker_name=

PS. I do not share folders any longer, since the 529.

/ /12
To add comments, please log in or register