looking for sample code on how to calculate the price BE for a few Buy and Sell orders simultaneously
didjeridoo: 1 Sell order of 1 lot, 1 Buy order 50 pip above the sell order of 1,5 lots at which level i will Reach the break even?
- Volume weighted average price. Sum[ OrderLots * (OrderType == OP_BUY ? +1 : -1) * OrderOpenPrice ] / Sum[ OrderLots * (OrderType == OP_BUY ? +1 : -1) ] if denominator is zero, no solution, e.g. buy 1 sell 1, hedging, any price.
BEprice = [1 * (-1) * 1.2345 + 1.5 * (+1) * 1.2395] / [1 *(-1) + 1.5 * (+1)] = 0.62475 / 0.5 = 1.2495. profit= -1* DeltaPerlot * (1.2495-1.2345) + 1.5 * DeltaPerlot * (1.2495-1.2395) = DeltaPerlot *[ -1 * 0.0150 + 1.5 * 0.0100 ] = DeltaPerlot * [ -0.015 + 0.015 ] = 0

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
hi all
I'm looking for sample code, or an explanation, on how to calculate the price Break Even for a few Buy and Sell orders simultaneously
basically this is the scenario
1 Sell order of 1 lot, 1 Buy order 50 pip above the sell order of 1,5 lots at which level i will Reach the break even?
keep in mind that i could have multiple sell order and multiple buy orders...
any idea?