Trades not firing when using 'Every Tick Based on Real Ticks'

 

Hi all, first post and am happy to join the conversation. I am having difficulty with a simple bot I am creating (not for live trading, just practice coding).

The premise of the bot is simple:

- It checks if the 2nd and 3rd last candles are either both bullish or both bearish

- It checks if the last candle is a hammer/hanging man (either bullish or bearish)

- Enters a long trade if the 2nd and 3rd candles are bullish, or enters a short trade if the 2nd and 3rd candles are bearish

The bot itself works as intended, and there is no issue with the code itself. However I noticed that when I change the backtest execution to 'Every Tick Based on Real Ticks' from 'Every Tick' (both using last server ping ~407ms), some trades are not firing. I have attached examples below (working.PNG is based on 'Every Tick' and notworking.PNG is based on 'Every Tick Based on Real Ticks').

The account provider is simply a MetaQuotes-Demo account.

Given that my trade fires soon as the hammer/hanging man formation is formed on the previous candle (i.e. soon as a new candle begins), the server execution speed shouldn't impact entering a position. However, 'Every Tick Based on Real Ticks' works as expected when the execution speed is set to 'Without Delay'.

tl;dr Why does backtesting with 'Every Tick Based on Real Ticks' and 'Last Server Ping' not fire trades where the entry conditions are clear? It works when using 'Every Tick' and 'Last Server Ping', and also when using 'Every Tick Based on Real Ticks' and 'Without Delay'.

Files:
working.PNG  32 kb
notworking.PNG  19 kb
 
ima_lobster: The bot itself works as intended, 

Obviously not. Do you really expect an answer? We can't see your broken code. There are no mind readers here and our crystal balls are cracked.

 
ima_lobster:

... Why does backtesting with 'Every Tick Based on Real Ticks' and 'Last Server Ping' not fire trades where the entry conditions are clear? It works when using 'Every Tick' and 'Last Server Ping', and also when using 'Every Tick Based on Real Ticks' and 'Without Delay'.

If it works without delay but otherwise not then you probably got an off-quote error during order opening. Check the return codes, GetLastError() and trade result.

 
ima_lobster:

Hi all, first post and am happy to join the conversation. I am having difficulty with a simple bot I am creating (not for live trading, just practice coding).

The premise of the bot is simple:

- It checks if the 2nd and 3rd last candles are either both bullish or both bearish

- It checks if the last candle is a hammer/hanging man (either bullish or bearish)

- Enters a long trade if the 2nd and 3rd candles are bullish, or enters a short trade if the 2nd and 3rd candles are bearish

The bot itself works as intended, and there is no issue with the code itself. However I noticed that when I change the backtest execution to 'Every Tick Based on Real Ticks' from 'Every Tick' (both using last server ping ~407ms), some trades are not firing. I have attached examples below (working.PNG is based on 'Every Tick' and notworking.PNG is based on 'Every Tick Based on Real Ticks').

The account provider is simply a MetaQuotes-Demo account.

Given that my trade fires soon as the hammer/hanging man formation is formed on the previous candle (i.e. soon as a new candle begins), the server execution speed shouldn't impact entering a position. However, 'Every Tick Based on Real Ticks' works as expected when the execution speed is set to 'Without Delay'.

tl;dr Why does backtesting with 'Every Tick Based on Real Ticks' and 'Last Server Ping' not fire trades where the entry conditions are clear? It works when using 'Every Tick' and 'Last Server Ping', and also when using 'Every Tick Based on Real Ticks' and 'Without Delay'.

Did you find a solution?