Every Tick based on real Ticks

General discussion about the Tickstory Lite software package.
Post Reply
CRegis
Posts: 8
Joined: Sat Jul 27, 2024 8:16 pm

Every Tick based on real Ticks

Post by CRegis »

I'm working on a MT5 HTF scalping bot which can trade every ticks. But the option of every tick doesn't show the Broker real conditions of the market.
When I use the other option of every tick based on real ticks, the spread is totally false. Even I use the broker setups for the pairs.
Help me to resolve that please.
I want to know how to backtest my bot in real conditions with the rigth ticks variations.
tickstory
Posts: 5288
Joined: Sun Jan 06, 2013 12:27 am

Re: Every Tick based on real Ticks

Post by tickstory »

Hi CRegis,

Do note that we unfortunately don't cover questions related to MT5 as it's out of our scope of knowledge. That said, from a Tickstory perspective, the first thing we suggest you check is that your data has been imported correctly in MT5's database. Obviously make sure you have imported the tick data correctly. Once you have confirmed that, you can use code similar to that below to print out your bid, ask and spread values. We have tested this code with Tickstory imported data and it works fine. If your spread isn't changing then you'll need to do further investigation in MT5 such as setting the correct back-testing options (eg. every tick or real ticks) or some other feature we're not familiar with (or possibly your EA code). If you're still having issues, we would recommend checking out the MQL Forums.

Hope this helps.

Code: Select all

void OnTick()
  {
   MqlTick Latest_Price; // Structure to get the latest prices      
   SymbolInfoTick(Symbol() ,Latest_Price); // Assign current prices to structure
   double ask = Latest_Price.ask;
   double bid = Latest_Price.bid;
   Print("Bid: " + DoubleToString(bid) + " Ask: " + DoubleToString(ask) + " Spread: " + DoubleToString(ask-bid));
  }
Hope this helps.
Post Reply