Negative dollar profit from profitable trades?

 

Hi,

 

I am running a simple grid/martingale EA.  However, on trades that are "old", when the price eventually returns to the levels where they should become profitable, ie the take profit price should give a positive amount, the EA produces a large cash loss.  This loss is proportionately bigger the older the initial trade is.  Why does this happen? 

 
swap and maybe commission charges
 
Keith Watford:
swap and maybe commission charges

Keith, 

 

That was my thinking too.  But I am running the backtest with my own data, offline, not connected to any broker.  Does MT4 have some sort of pre-set values for swaps and other charges? 

 
Have you set the spread? Maybe the problem are your own data? How did you create them?
 
Carl Schreiber:
Have you set the spread? Maybe the problem are your own data? How did you create them?

The spread is set to current.  Not sure what that means in this case, as like I mentioned, this backtest is done offline, not connected to any broker.

I downloaded the date from here: http://www.forextester.com/data/datasources , and it seems fine.

What is surprising me is that eventhough the t/p is the same for every trade, as set by the grid strategy, the later a trade is closed (t/p activated) the smaller is the dollar profit value (even negative after a point) 

Pic attached. 

Files:
USDGBP_Grid.jpg  1259 kb
 
roman.zouev:

The spread is set to current.  Not sure what that means in this case, as like I mentioned, this backtest is done offline, not connected to any broker.

I downloaded the date from here: http://www.forextester.com/data/datasources , and it seems fine.

What is surprising me is that eventhough the t/p is the same for every trade, as set by the grid strategy, the later a trade is closed (t/p activated) the smaller is the dollar profit value (even negative after a point) 

Pic attached. 

Those trades are being held for a long time.... swap?

 
honest_knave:

Those trades are being held for a long time.... swap?

honest_dave,

three months is not that long of a time, so I'm not sure how a $1000 tp trade results in such a huge loss. (I believe swap is to do with interest rates of the two currencies in questions, and both USD and GBP have been pretty much zero since after the financial crisis of '08...)  Plus, I am not connected to any broker, just downloaded MT4 from Metaquotes, did not set up any account, used third party data, so not sure how swap can come into play here.... 

 
roman.zouev:

honest_dave,

three months is not that long of a time, so I'm not sure how a $1000 tp trade results in such a huge loss. (I believe swap is to do with interest rates of the two currencies in questions, and both USD and GBP have been pretty much zero since after the financial crisis of '08...)  Plus, I am not connected to any broker, just downloaded MT4 from Metaquotes, did not set up any account, used third party data, so not sure how swap can come into play here.... 

The only information I've seen published on this is from 2005: All swaps, margin requirements, expirations, GTC-orders are modeled 

Which is very vague. Perhaps try printing some values from within your EA while strategy tester is running.
 
honest_knave:

The only information I've seen published on this is from 2005: All swaps, margin requirements, expirations, GTC-orders are modeled 

Which is very vague. Perhaps try printing some values from within your EA while strategy tester is running.

Hi honest_knave,

 

I will try and search now for that thread.

What information from my EA should I try and print that you think would be helpful in figuring this out? 

 
roman.zouev:

honest_dave,

three months is not that long of a time, so I'm not sure how a $1000 tp trade results in such a huge loss. (I believe swap is to do with interest rates of the two currencies in questions, and both USD and GBP have been pretty much zero since after the financial crisis of '08...)  Plus, I am not connected to any broker, just downloaded MT4 from Metaquotes, did not set up any account, used third party data, so not sure how swap can come into play here.... 

Why don't you just put the swap() via Comment(..) on the chart - then multiply it by the number of days, might not be totally correct but probably getting close.
 
Carl Schreiber:
Why don't you just put the swap() via Comment(..) on the chart - then multiply it by the number of days, might not be totally correct but probably getting close.

Hi Carl,

 

Sorry, I am not exactly sure what do you mean and how I can do that... My EA was coded by another person, so I have no knowledge of the nittygritty...

 

Also, from this article https://www.mql5.com/en/articles/1512, I see that:

Lot sizes including initial size and increment step, commissions and swaps should be taken from the active account settings

Before testing, it is necessary to make sure that there is at least one activated account in the list in "Navigator" window of the terminal.

 

However, I am running this backtest offline, there is no active accounts in the Navigator, so if swaps are modeled, where does MT4 get this info from? 

Testing Features and Limits in MetaTrader 4
Testing Features and Limits in MetaTrader 4
  • 2005.09.13
  • MetaQuotes Software Corp.
  • www.mql5.com
This article allows to find out more about features and limits of Strategy Tester in MetaTrader 4.