I am new to MQL4... while developing EA, got problems.. PLZ help
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
some (or most) brokers doesn't allow this
I want my EA to figure out the average price of all my opening position(must be 1.2103)
some (or most) brokers doesn't allow this
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!!