Q1.
- Loop for all open long orders that match your criteria (e.g. long, symbol, magic number)
- Sum all order open prices, and tally the order count
- double AvgPrice = NormalizeDouble( SumOfOpenPrices / CountOfOrders, Digits); // just typed, not compiled or checked
Q2.
- With Q1 AvgPrice, work out your SL. If current price has gone against SL, loop all orders as in Q1 & close them
I would like to use send pending order in scripts,but no take profit and stop lost,,can you show me how to make it.Thanks
ropibusu:
I would like to use send pending order in scripts,but no take profit and stop lost,,can you show me how to make it.Thanks
I would like to use send pending order in scripts,but no take profit and stop lost,,can you show me how to make it.Thanks
some (or most) brokers doesn't allow this
kyle3738:
Don't double post Figuring out the average price of positions - MQL4 forum https://www.mql5.com/en/forum/130648
I want my EA to figure out the average price of all my opening position(must be 1.2103)
qjol:
some (or most) brokers doesn't allow this
thanks bro..
some (or most) brokers doesn't allow this
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Q1: If my EA opens buy position 3times(ex, #1 1.2222, #2 1.2101, #3 1.1987), I want my EA to figure out the average price of all my opening position(must be 1.2103)
Can I get the average figure of all my opening positions by MQL4?
Q2: Can I emulate that trailing stop only works for the average price of my opening positions??
My Stratergy clears positions only by trailing stop, but I dont want my every position to have the trailing stop property.
I know this is kinda martingale..... The KEY POINT is When the average price reaches trailing stop loss price, close all positions!!