Organizing Class's

 

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!

 
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
 

what are the

int RandomName()

{

 code!

}

RandomName();


things called then?

 
nickblack:

what are the

int RandomName()

{

 code!

}

RandomName();


things called then?

Function definition and Function call . . .
 
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.

 

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 :)

 
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

 
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.
 

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 ?

 

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..

 

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.

Reason: