How to make my Function?

 

I have a question that I want to make my own Function but I don't know how to make it,

I guess I have to save my Function code in Library. And then For calling My Function, Using #import.

I did that but compiler said there is no function like that .

So I didn't understand how to make it.

Could anybody please suggest how to make my function? thanks a lot 

 
tatsuyaha wrote >>

I have a question that I want to make my own Function but I don't know how to make it,

I guess I have to save my Function code in Library. And then For calling My Function, Using #import.

I did that but compiler said there is no function like that .

So I didn't understand how to make it.

Could anybody please suggest how to make my function? thanks a lot

Here is a link to a lesson covering functions and writing your own. This is just for starters. https://www.mql5.com/en/articles/1496

BTW You can code the function in the Ea and call it from within the EA.

HTH

kEITH

 
tatsuyaha:

I have a question that I want to make my own Function but I don't know how to make it,

I guess I have to save my Function code in Library. And then For calling My Function, Using #import.

I did that but compiler said there is no function like that .

So I didn't understand how to make it.

Could anybody please suggest how to make my function? thanks a lot 





















Hey - you wasted a lot of whitespace below your post. Don't you know there's a recession?

Anyways, regarding your function, if you're coding it in MQL, then just insert it in the .MQ4 file like this (and you don't need include statements etc.)


init()

 {

   put instructions here (like calls to your function) that you want executed once at the start

 }


start()

 {

   put instructions here (like calls to your function) that you want executed on every arriving tick whilst idle

 }


YourFunction()

 {

   this is all the clever stuff (be quiet everyone) in your own function

 }

 

Thanks a Lot!!

 
I’m sorry. I missed that. and thanks for answer my question:)
Reason: