Limitations of MQL4

 

Hello Everyone!

I'm new to the forum and new to MQL -- so please be patient with me.  I am looking to write a program but am unsure if MQL4 easily supports the kind of functionality I'm looking for.

What I want is a program that continuously monitors the net value of two or more manually placed trades, can store that value in a variable  (something like: "critical_value = p/l_of_position_one + p/l_of position_two....+ p/l_of_position_n" for any value of n), and automatically close, reduce, and add to each position based on the value of critical_value and the values of the variables that added together, form the critical value.  I would like this program to work tickwise, which calls for an EA.  When i was going through the documentation though, I didn't see a way for an expert advisor to store the value of trades taking place in charts other than the one that that particular EA is attached to.


Here's an example to clarify what I mean:

Let's say I've placed a trade on the EUR/USD, and it is currently 50 pips up, and another trade on the EUR/CHF which is 30 pips down.  Is there a way for an EA (really, the source code of the EA) attached to the EUR/USD chart to create a variable that stores the p/l of the trade on EUR/CHF chart, so that I could construct "critical_variable" described above that would have a value of "20" (the net gain of the offsetting EUR/USD, EUR/CHF trades)?  Would I need to construct a custom indicator that essentially duplicated the EURCHF trade on the EURUSD chart, and then use that to construct the variable?  I mostly want to know if this sort of thing is in the wheelhouse of MQL4 or MQL5 in order to decide if I want to devote the time to program it, or if it's necessary to do it in Python, Java, or some other, more general language.


Thanks a million in advance!

Justin

 
jdshelby:

Hello Everyone!

I'm new to the forum and new to MQL -- so please be patient with me.  I am looking to write a program but am unsure if MQL4 easily supports the kind of functionality I'm looking for.

What I want is a program that continuously monitors the net value of two or more manually placed trades, can store that value in a variable  (something like: "critical_value = p/l_of_position_one + p/l_of position_two....+ p/l_of_position_n" for any value of n), and automatically close, reduce, and add to each position based on the value of critical_value and the values of the variables that added together, form the critical value.  I would like this program to work tickwise, which calls for an EA.  When i was going through the documentation though, I didn't see a way for an expert advisor to store the value of trades taking place in charts other than the one that that particular EA is attached to. 

OrderSelect() the order and then check it's OrderProfit()
 

Hi Raptor,

Thanks for putting me on the right track.

Justin