Thinking like a programmer

 

Hi all,


I've been hitting some roadblocks in my MQL4 programming, I understand how to code which we all know is the easy part... but I'm struggling to approach coding in the right way, what I mean by this is, how do I combine all the functions and variables in the right order to achieve what I want.


Does anyone have advise on this side of programming or recourses to train this part of my mind?

and

When you have a complex  EA to build, many entry criteria, different rules for different times, multiple timeframes, etc... How do plan this out? Do you make flow charts, do you just map it out in your head and start coding, etc...?

Any help is greatly appreciated.


Best,

Joe

How to Order a Trading Robot in MQL5 and MQL4
How to Order a Trading Robot in MQL5 and MQL4
  • www.mql5.com
"Freelance" is the largest freelance service for ordering MQL4/MQL5 trading robots and technical indicators. Hundreds of professional developers are ready to develop a custom trading application for the MetaTrader 4/5 terminal.
 
JoeMSC.FX: Does anyone have advise on this side of programming or recourses to train this part of my mind?

Until you can define, in concrete terms, what you want, it can not be coded.

 
William Roeder #:

Until you can define, in concrete terms, what you want, it can not be coded.

I am able to define what I am creating in regards to entry criteria, exit criteria, take profits, stop losses, and system rules. I am also able to create the different variables required to build the EA. The area that I struggle with is then piecing the puzzle together so that everything is executed in the correct order.

 
JoeMSC.FX #:

I am able to define what I am creating in regards to entry criteria, exit criteria, take profits, stop losses, and system rules. I am also able to create the different variables required to build the EA. The area that I struggle with is then piecing the puzzle together so that everything is executed in the correct order.

Your question cannot be answered in simple lines, you need to study the subject.

Write down, Step-By-Step, what the Robot needs to do.
(very rough example)
1. Check Indicator #1 Trigger
2. Check Spread
3. Count Trades
4. if no Trades and Indicator is Buy then (Buy Custom Function)
5. if no Trades and Indicator is Sell then (Sell Custom Function)

Then Code it. If you are learning by yourself it'll be a Journey.
Test, Learn, Use F1, Learn, Print() or Comment() your Variables, Learn, Try Different things, Learn... So on and so on.

When you are tired of using "Procedures" as code, you can look into Object Oriented Programming to make your program much more flexible.

Good Luck!

 
Jeremie Courchesne #:

Your question cannot be answered in simple lines, you need to study the subject.

Write down, Step-By-Step, what the Robot needs to do.
(very rough example)
1. Check Indicator #1 Trigger
2. Check Spread
3. Count Trades
4. if no Trades and Indicator is Buy then (Buy Custom Function)
5. if no Trades and Indicator is Sell then (Sell Custom Function)

Then Code it. If you are learning by yourself it'll be a Journey.
Test, Learn, Use F1, Learn, Print() or Comment() your Variables, Learn, Try Different things, Learn... So on and so on.

When you are tired of using "Procedures" as code, you can look into Object Oriented Programming to make your program much more flexible.

Good Luck!

Hey Jeremie, 

Really appreciate this response, it's given me confidence that I am on the right track.

I decided to create a flow chart in the end to help visualise the EA.

Best,

Joe