Jump to content

Flow in Programming of EA


johnjet

Recommended Posts

Hello guys. I'm new in programming in MQL4 but I have some idea about C++ language :D

 

I am currently writing my first EA but I am stuck.

 

I was wondering if someone could share with me on the flow of an EA? This is what I had in mind. Please correct me if the order is wrong or I'm missing something.

 

start()

{

// First section to identify signal based on trading system and output a string with buy/sell indicator

 

// Second section to identify if there are any open orders, and maybe close orders if signal is showing opposite direction

 

// Third section to place an order if there are no open orders and fulfil the signal criteria

 

}

 

 

Thanks!!

Link to comment
Share on other sites

Its best to use separate methods for each section or subsection rather than placing it all in the start method; it just helps to keep the code clean and allows you to run the method several times throughout the code.

 

Also I would say check open trades before checking entry signals, then use an if statement to make sure that the entry signals are only checked if a trade is not open. This makes it more efficient.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...