Read through documentation, so confused b/w Position, Orders(and deals too). Help!!

 

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?

 
Jun Fx:

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

Orders, Positions and Deals in MetaTrader 5
Orders, Positions and Deals in MetaTrader 5
  • www.mql5.com
Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
 

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.