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
Only if the lot sizes are all the same will sum/n work. Otherwise:
Lots Weighted Average Price (∑ opi × loti ÷ ∑ loti) This is the break even price of all orders combined.
OrderOpenPrice question . - MQL4 programming forum
looking for sample code on how to calculate the price BE for a few Buy and Sell orders simultaneously - Pips - MQL4 programming forum
William Roeder:
mark692: i want to get the average of my entry price on buy, is that possible?
Only if the lot sizes are all the same will sum/n work. Otherwise:
Lots Weighted Average Price (∑ opi × loti ÷ ∑ loti) This is the break even price of all orders combined.
OrderOpenPrice question . - MQL4 programming forum
looking for sample code on how to calculate the price BE for a few Buy and Sell orders simultaneously - Pips - MQL4 programming forum
mark692 didn't ask for the Lots weighted average.
He asked for the average entry price and that's the question that I answered!
Hi Sir Keith Watford I think of this two "Lots weighted average" or "Net Mean Opening Price" is what I need, if they are the same. I'm sorry I didn't explain clearly what I want. I thought that average entry price of all my position will give me the breakeven price, but I think I also need to consider the lotsize of my open trades not just the entry price to get the average. Thank you anyway :)
Also in Sum (open price * lotsize) / sum (lotsize)
oh yeah i also need to get the lot size i need to use right? is there a formula for that?
oh yeah i also need to get the lot size i need to use right? is there a formula for that?
first you should get :order open price...with the OrderSelect() functions..as wiliam said at first
if you use differernt lot size for each order
you should get each positions LOT size separately with: OrderLots function
There are two potential break even prices. Using this code gives me one:
Anyone know how to calculate the second potential price?
In order to test it I used these positions:
GBPAUD SELL 0.02 @ 1.89544
GBPAUD SELL 0.04 @ 1.89547
GBPAUD SELL 0.08 @ 1.89464
GBPAUD BUY 0.16 @ 1.89478
With the code I provided I get a price of 1.89330, which would be breakeven if all trades exited there. However when the price reaches 1.89511 the account profit is also $0.00.
I would like to be able to calculate both breakeven points in this case, and any help would be greatly appreciated.
There are two potential break even prices. Using this code gives me one:
Anyone know how to calculate the second potential price?
In order to test it I used these positions:
GBPAUD SELL 0.02 @ 1.89544
GBPAUD SELL 0.04 @ 1.89547
GBPAUD SELL 0.08 @ 1.89464
GBPAUD BUY 0.16 @ 1.89478
With the code I provided I get a price of 1.89330, which would be breakeven if all trades exited there. However when the price reaches 1.89511 the account profit is also $0.00.
I would like to be able to calculate both breakeven points in this case, and any help would be greatly appreciated.
Can you apply the calculation to indicators so that it shows the average opening price on the chart?