simultaneous analysis of postions

 

hi, my experience level is: 

ive made a few simple ea...for loops/if else/positiongetinteger/trade.mqh. things like that


ive been able to open a buy position and a sell  position at the same time on the same  currency pair. what im having difficulty with is analyzing both positions at the same time. i dont want to use a for loop, because it analyzes one at a time. i want to analyze both at the same time, so i can close one as opposed to the other. specifically, i want close a buy(or sell) trade if the sell(or buy) is showing a stop loss that i have just hit (pre programmed).

is this possible? does it involve using an array? i have  very limited knowledge of arrays. my only experience with them is copying them from a youtube video. so, the array skills of a monkey.

thank you for your time 

 
Fahq Ahsowl:

hi, my experience level is: 

ive made a few simple ea...for loops/if else/positiongetinteger/trade.mqh. things like that


ive been able to open a buy position and a sell  position at the same time on the same  currency pair. what im having difficulty with is analyzing both positions at the same time. i dont want to use a for loop, because it analyzes one at a time. i want to analyze both at the same time, so i can close one as opposed to the other. specifically, i want close a buy(or sell) trade if the sell(or buy) is showing a stop loss that i have just hit (pre programmed).

is this possible? does it involve using an array? i have  very limited knowledge of arrays. my only experience with them is copying them from a youtube video. so, the array skills of a monkey.

thank you for your time 


Theoretically yes. Practically no.

Parallel processing requires a lot of knowledge, and is very difficult to realize especially in MQL.

You have only one execution pointer per EA/Script/Service. So you must process each individually. But given the speed of modern CPUs (modern is everything since millennial) you won't be able to notice the difference between in series or parallel processed. It is way to fast to be in any disadvantage for you.

So, in short, use a for loop. And learn about arrays, you need these basics.

Consult the documentation please.


 
Dominik Egert #:

Theoretically yes. Practically no.

Parallel processing requires a lot of knowledge, and is very difficult to realize especially in MQL.

You have only one execution pointer per EA/Script/Service. So you must process each individually. But given the speed of modern CPUs (modern is everything since millennial) you won't be able to notice the difference between in series or parallel processed. It is way to fast to be in any disadvantage for you.

So, in short, use a for loop. And learn about arrays, you need these basics.

Consult the documentation please.


a multitude of gratitudes, sir.