Download MetaTrader 5

Out-of-nowhere trades

To add comments, please log in or register
Suat Gonul
11
Suat Gonul 2016.05.29 19:26 

Hello MT5 community,

I'm building up an expert advisor from scratch and I'm trying to experience the basics first.

I have code creating only "BUY" orders at beginning of each period (current at every 4 hours) as follows:


Although I only create BUY orders, I see SELL operations as well, as depicted in the next figure (see the red arrows):


And when I investigate the "Results" tab of "Strategy Tester" after the execution, the total number of long trades are as much as the number of red arrows in the chart. So, I feel that I misinterpret the chart. What am I missing here?

Thanks in advance...

Alain Verleyen
Moderator
31136
Alain Verleyen 2016.05.29 19:48  
Suat Gonul:

Hello MT5 community,

I'm building up an expert advisor from scratch and I'm trying to experience the basics first.

I have code creating only "BUY" orders every 4 hours as follows:


Although I only create BUY orders, I see SELL operations as well, as depicted in the next figure (see the red arrows):


And when I investigate the "Results" tab of "Strategy Tester" after the execution, the total number of long trades are as much as the number of red arrows in the chart. So, I feel that I misinterpret the chart. What am I missing here?

Thanks in advance...

In your idea what happens when a SL or TP is reached ?
Suat Gonul
11
Suat Gonul 2016.05.29 19:59  
Alain Verleyen:
In your idea what happens when a SL or TP is reached ?

Actually, I didn't take an explicit action considering this case. I thought (I might be wrong) the order would be closed automatically when SL or TP is reached. Currently, I just create orders. Complete code is attached.

Files:
To add comments, please log in or register