So I want to build a simple EA that will open several trades based on simple. I'm using 1:100 leverage.
OnTick(){
if trade_condition=true
Check Money Mgmt;
Open a trade
Go through all open trades
Close if close-condition of the trade is met
Modify SL & TP accordingly
Q#1:
I'm opening trades using CTrade.Buy/Sell. Now I'm so confused between how to iterate and modify trades- should I use position or orders or deals?
If I use Position the document says there's ONLY one open Position per symbol, why is that? I can always open several trades right?
What is the best function use to open/modify/close trades- I see several options in documentation and it is so confusing?
Q#2: How do I ensure that if I close chart by mistake the EA should continue to work?
Q#3: How do I make my EA to work on several currencies and time-frames?
Q#4: Noob alert: if _Digits is not 3 or 5 then pips and points are same?
Have you read this?
https://www.mql5.com/en/articles/211

- www.mql5.com
Yep. It is a bit complicated. An Order is like saying "I ordered a pair of shoes". Say I have a pending buy/sellstop order in gold at a certain price.
A deal is a deal. Like "we have a deal!", a legally binding agreement between you and the broker, when an order is filled.
A trade is when one or more deals are done together.
A position is opened and closed by two opposite type deals. A Buy Position is opened by a buy deal and closed by a sell deal, a sell position vice versa.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
So I want to build a simple EA that will open several trades based on simple. I'm using 1:100 leverage.
OnTick(){
if trade_condition=true
Check Money Mgmt;
Open a trade
Go through all open trades
Close if close-condition of the trade is met
Modify SL & TP accordingly
Q#1:
I'm opening trades using CTrade.Buy/Sell. Now I'm so confused between how to iterate and modify trades- should I use position or orders or deals?
If I use Position the document says there's ONLY one open Position per symbol, why is that? I can always open several trades right?
What is the best function use to open/modify/close trades- I see several options in documentation and it is so confusing?
Q#2: How do I ensure that if I close chart by mistake the EA should continue to work?
Q#3: How do I make my EA to work on several currencies and time-frames?
Q#4: Noob alert: if _Digits is not 3 or 5 then pips and points are same?