# Calculate Breakeven from long and short trades

54

I have seen some loss recovery EA's that use trading zones and multiple lots to recover losses. I have my own ideas I would like to try out so I have decided to build my own EA. This in itself will be quite a task!

I was hoping someone would be kind enough to explain to me, or better yet, point to a snippet of code that will enable me to calculate the breakeven point of multiple buys and sells on a single currency pair.

If I'm short 1 lot and price goes against me x amount of pips, I hedge my trade with a buy order at 2 lots. These two trades combined will have a breakeven point. How can I calculate that?

I would be most grateful for any help!

Thank you.

Moderator
5667

```double profit=0;

//+------------------------------------------------------------------+
{
if(OrderSymbol()==Symbol())
{
profit=profit+OrderProfit();
}
}
if(profit>0)
{
Comment("Breakeven!");
}
//+------------------------------------------------------------------+```
54

Marco vd Heijden:

Hi Marco,

Thank you for the quick reply.

So if I understand correctly.... The code you have provided will comment "Breakeven!" once OrderProfit() (on the selected pair) is greater than zero.

How can I determine what that price level is?

As I build out my EA I will want to draw my breakeven line on the chart. This breakeven line plus a few pips will be my target.What I can't get my head around is determining the breakeven price level when I take into account multiple buy and sell orders.

I really appreciate the help!