How to make ensure that not more than one trade is taken per pair when multiple pairs are traded

 

I'll be putting my EA on several pairs at the same time which is something I'm doing for the first time. Usually with one pair its quite easy to manage using a check for 

PositionsTotal()

Now I want to make sure that not more than one trade is taken per pair when trading with multiple pairs. How can this be done?

 
Jackery: I'll be putting my EA on several pairs at the same time which is something I'm doing for the first time. Usually with one pair its quite easy to manage using a check for Now I want to make sure that not more than one trade is taken per pair when trading with multiple pairs. How can this be done?
  1. Check the position's symbol
  2. Use and check the position's magic number.

PositionGetSymbol

Returns the symbol corresponding to the open position

PositionGetInteger

Returns the requested property of an open position (datetime or int)

POSITION_MAGIC

Position magic number (see ORDER_MAGIC)

long

Reason: