Does any math explain this?

 

I made an EA.

Fast moving average crosses slow moving average upwards. Open a buy order.
Fast moving average crosses slow moving average downwards. Open a sell order.

SL and TP are always the same distance. Whichever the price hits first wins.


The EA loses money.

In visual mode, it seems that most orders hit SL before they hit TP so the EA loses money.


Well, that is easy to fix, isn't it?


Fast moving average crosses slow moving average upwards. Open a SELL order.
Fast moving average crosses slow moving average downwards. Open a BUY order.

Now the TP mark will be hit more often than the SL mark, right?


Wrong. The EA still loses money.


How does that even make sense?

 
whoowl:

Wrong. The EA still loses money.


How does that even make sense?

The spread.

 
Keith Watford #:

The spread.

How exactly?

The spread is fixed. No variation.

And I tried multiple SL/TP values. They range from 2 to 10 times the amount of spread.

 
whoowl #:

How exactly?

The spread is fixed. No variation.

And I tried multiple SL/TP values. They range from 2 to 10 times the amount of spread.

With a 2 pip spread and 20 pip SL and TP

Price has to move 22 pips to hit TP

BUT

Price only has to move 18 pips to hit SL

So it is more likely to hit the SL than the TP no matter what the trade direction is.

 
Keith Watford #:

With a 2 pip spread and 20 pip SL and TP

Price has to move 22 pips to hit TP

BUT

Price only has to move 18 pips to hit SL

So it is more likely to hit the SL than the TP no matter what the trade direction is.


OK. So I make the TP a little shorter than SL.

Still loses.

Don't forget TP has its own bias. The crossing upwards or downwards constitutes bias towards the direction of the crossing.

 
whoowl #:

OK. So I make the TP a little shorter than SL.

Then your loss making trades will be larger than the profitable trades. This means that you will probably require at least 60% winners just to break even.

whoowl #:

Don't forget TP has its own bias. The crossing upwards or downwards constitutes bias towards the direction of the crossing.

Don't forget that you reversed that bias, so you can't have any faith in it.

 
I had the same question and I tried using the Bid to sell and using the Ask to buy in the strategy tester(Just for debugging, it will not work in the live/demo market). And the win rate for both buy and sell orders was close to 50/50 when SL and TP were the same. So it's the Spread that steals your win rate.
 
William William #:
 I tried using the Bid to sell and using the Ask to buy in the strategy tester(Just for debugging, it will not work in the live/demo market).

You should always use Bid for sells and Ask for buys when opening orders. I don't know why you think that will only work in the tester.

 
Keith Watford #:

You should always use Bid for sells and Ask for buys when opening orders. I don't know why you think that will only work in the tester.

Oh, I mean the opposite. I was trying to  figure out why the difference was so huge after the first time I translated my tradingview script which was also my first couple of  scripts. 

Reason: