EA gives invalid stops (order 130 error) with Tickstory data but not with brokers demo acct

General discussion about the Tickstory Lite software package.
Post Reply
tilltheend
Posts: 2
Joined: Sun Aug 16, 2020 1:47 pm

EA gives invalid stops (order 130 error) with Tickstory data but not with brokers demo acct

Post by tilltheend »

Hi folks,
I am new to writing EA in MT4. I am facing issue while Trailing SL during backtesting.

- When I backtest in broker's Demo acct gives no problem (But, modelling quality is <=90%)

To improve modelling quality, I downloaded more accurate Tick data from Tickstory. (EURUSD)

- When backtest using Tickstory, it gives "Invalid Stops' error for most of trades.

"If I increase pips for SL, error does not occur. But I dont understand why it works with broker and not with more accurate data? I want trail SL to be tight."

Can somebody please help. Thanks a lot.


Below is code snippet.

//Stops in Pips
double StopLossPips = 15;
double TrailingStep = 1;
double TrailingStop = 1.5;
.
.
I use Ordermodify to trail SL.
//

tickstory
Posts: 4895
Joined: Sun Jan 06, 2013 12:27 am

Re: EA gives invalid stops (order 130 error) with Tickstory data but not with brokers demo acct

Post by tickstory »

Hi tilltheend,

The 'invalid stops' (OrderSend Error 130 error) usually means that you are attempting to place your stops too close to the current price. With using more accurate tick data, this is more likely to occur with a tight stop because the pricing is constantly moving like in a real environment as opposed to low-quality data.

You should make sure that:

- You have exported data using your broker's instrument settings (lot step, lot size, etc). To do this, simply select your broker's symbol in the "Map to" field in the MT4 Export -> MT4 Settings -> Map to option. (Please see our manual for more information on this).

- That you put a call to RefreshRates() prior to placing your order. This will ensure MQL has the latest Bid and Ask prices available at the time of placing your order. This is important because with tick data, the price may have moved in-between MQL having the latest cached price and the current market.

- That you are ensuring your amended lot size meets the broker's requirements (eg. it is a multiple of lot size) and that the price has been rounded correctly to the broker's "Digits" (this might be an issue if you are using a 4 digit broker, for example).

Hope this helps.

tilltheend
Posts: 2
Joined: Sun Aug 16, 2020 1:47 pm

Re: EA gives invalid stops (order 130 error) with Tickstory data but not with brokers demo acct

Post by tilltheend »

Hi,
Thanks for elaborate reply.
I shall incorporate these solutions.

Regards.
Pankaj

Post Reply