user6216142
user6216142

Reputation:

My EA loses money when I breakeven

I have a very successful EA which is designed to move my stop loss to breakeven when I get 50 pips "in the money". So pretty basic stuff, however, I still lose a small amount of money on the trade that hit the new breakeven price - of course the breakeven price being equal to the OrderOpenPrice.

Granted, I don't lose as much as I would if my price were to hit the original S/L but my net profit on trading position that hit the breakeven price was NIL. I've made no modifications to the EA code.

I'm thinking my broker maybe moved the stopLevel figures so my breakeven price can no longer reach the OrderOpenPrice but I can't be sure.

Does anyone have this issue and how would I go about solving this?

Here is the code. The relevant code starts on line 537 ; https://github.com/indomtrading/ea/commit/5de74283f02ebee634952d5d204e21749ea25714

Upvotes: 1

Views: 834

Answers (3)

user3666197
user3666197

Reputation: 1

To reach a B/E-state, there are two distinct processes to watch:

  • one is the PriceDOMAIN distance between the XTO OrderOpenPrice() and the "new" value one wishes to set a "future" XTO OrderStopLoss().

  • the other is the Broker-side accrued sum of all Commissions + Fees + Swaps

While OrderCommission() + OrderSwap() could be inspected explicitly ( as have been accrued and have been a part of "a-just-theoretical" OrderProfit() ), any additional costs, associated by your Broker's "Terms & Conditions" with an XTO on OrderClose() or on any of materialised { OrderStopLoss() | OrderTakeProfit() } does not show up, until the XTO operation is finished and such costs get visible after such position was terminated.

If the EA does not precisely account for both of these principal P/L-drivers in evaluating BreakEven,
it may systematically move your money into losses.

Check both of these in the EA B/E-driving policies against your Broker "Terms & Conditions" so as to avoid the so far observed losses.


Nota Bene:

while the slippage may appear during a live-trading session, the nature of the slippage-mechanics ought be ( sure, outside of the Fundamental major events ) principally symmetric .. sometimes gaining, sometimes loosing a pip or a few. In case your Broker does not exhibit a symmetrical nature, some investigation is in place, but that does not explain a systematically loosing EA-trade automation.

Upvotes: 1

jlee88my
jlee88my

Reputation: 3043

You need to factor in Swap and Commission.

Upvotes: 0

Daniel Kniaz
Daniel Kniaz

Reputation: 4681

As discussed, when you move your OrderStopLoss() to OrderOpenPrice() it may close with slippage so loss instead of breakeven. In order to fight with that, OrderModify() your OrderStopLoss()to OrderOpenPrice()+2*Point, if there's a small slippage you will have a tick gain or zero

Upvotes: 0

Related Questions