1 (edited by Popov 2012-04-23 21:00:59)

Topic: Debug FST Expert

MT4-FST Expert has ability to write a log file since version 1.10 (FST v1.4.10).

The log files are under your MT directory: MTPATH\experts\files
For Win 7 and Vista, you have to go to "Compatibility files"

Lets discuss here MT4-FST Expert beahviour with different brokers, issues and ideas for improvement.

Latest expert v1.13 from 2012-04-23 is attached:

Post's attachments

MT4-FST Expert.mq4 79.99 kb, 21 downloads since 2012-04-23 

You don't have the permssions to download the attachments of this post.

2 (edited by Popov 2012-04-05 21:16:12)

Re: Debug FST Expert

I'll start the topic with reporting of new behaviour of FXCM-GBPDemo01 - Forex Capital Markets, LLC server.

When we have an aggregate position (position consisting of multiple positions in one direction as result of adding) and modify SL or TP, FXCM modifies all open orders automatically when send OrderModify to the first open order.

Normally the Expert cycles through the open orders and OrderModify each if them one by one.
As result of the new behaviour, OrderModify returns false and LastError = 1 (No error) for every attempt for modification after the first. This leads to multiple errors in Expert.

To fix this issue, I added check if the required new SL and TP are equal to the SL and TP of the open orders. If they are equal, the Expert do not attempts to OrderModify.

In the case where OrderModify returns false and LastError = 1, the Expert checks if the SL and TP are not already changed and if they were, OrderModify is marked as "Checked OK".

The attached Expert "MT4-FST Expert v1.11 Log.mq4" has the word Log in his name because Write_Log_File external variable is set to true.

EDIT Expert removed. Newer version attached in first post.

3 (edited by jgp 2012-04-05 14:36:46)

Re: Debug FST Expert

I downloaded the Apr 4 FSB and FST  software yesterday and redid everything for Alpari and FXCM MT4 demos, removing the "enter only once per bar " condition from every strategy.  When installing the new MT4-FST EA on charts I did change the last new option to "true" but left the next to last new option [the one you're describing in this thead] "false" because I didn't know what it did.  Result with those settings seems to be that for "winner" strategies there are no longer multiple entries on either Alpari or FXCM, but for "Add" strategies they're as bad as ever, on both Alpari and FXCM 
Should I re-install this new [Apr 5] EA with both the last two new options changed from default "false" to "true"??

Re: Debug FST Expert

Please post the server names. I'll try to reproduce the errors. It seams there are some specifics to the broker server settings.

...

You  can see the expert settings guide here MT4-FST Expert Options

Re: Debug FST Expert

Server 1
Alpari(US), LLC
MetaTrader 4
Version: 4.00 Build 409

Server 2
Forex Capital Markets Inc.
FXCM MetaTrader 4
Version: 4.00 Build 419

Re: Debug FST Expert

Popov wrote:

....
When we have an aggregate position (position consisting of multiple positions in one direction as result of adding) and modify SL or TP, FXCM modifies all open orders automatically when send OrderModify to the first open order.
...

This a loose possible X-factor, but perhaps jgp has a demo account for US residents? For US residents, the regulations say you cannot have specific stop orders for specific open positions, they have to be closed First-In-First-Out. FXCM implemented a "summary" stop for all open orders at a single stop exit price to follow these regulations. This might explain why changing a stop order modifies all open orders automatically.

If this is already known, or isn't exactly the problem jgp is having, please disregard, just mentioning in case it's not a FST-MT4 bug but the way the broker works.

Re: Debug FST Expert

If this is already known, or isn't exactly the problem jgp is having, please disregard, just mentioning in case it's not a FST-MT4 bug but the way the broker works.

It is for sure specific behaviour of "FXCM-GBPDemo01 - Forex Capital Markets, LLC" server.
"FXCM-USDDemo01 - Forex Capital Markets, LLC" server acts as normal - FST modifies all orders one by one.

The behaviour of "FXCM-USDDemo01 - Forex Capital Markets, LLC" forces FST Expert to send multiple OrderModify commands which return Response = 0 and LastError - No Error. The reason is that FST Expert sends OrderModify with SL and TP values that were already set by the server anonymously. 
The new expert checks for such case and does not return an error.

I suppose that Multiple adding problem is also caused by a specific server behaviour. We must find the reason and to work around it since this issue is uncontrollable and can cause serious loss.

Re: Debug FST Expert

A newer version of the expert is attached to the first post.
- Improved log messages,
- Sets trailing stop if Stop Loss is changed with more than 0.00001 with 4 and 5 digit brokers and 0.01 for JPY.
- Puts expert magic number in the log file name.
- Maximum length of log file is limited to 2000 lines (set in variable in the expert code). When the log file reaches the limit number of line, the Expert opens a new log file. This is done because reports that MT4 goes slower when works with long files.

Re: Debug FST Expert

Expert updated to v1.13
Changes:
- improved log file
- writing log file is switched on by default
- expert writes magic number to position's comments.

10

Re: Debug FST Expert

At least two atta-boys Master Popov. Don't seem to be getting unwanted additonal entries [Winner or ADD FST strategies attached to FXCM or Alpari charts] with the latest FST-AE, but too soon to tell whether we get the additonal entries we want and should get as per FSB backtesting.  Many, many thanks for at least stopping the unwanted multiple time/price additions.

11

Re: Debug FST Expert

Master Popov, looks like you solved the multiple virtually identical time/price addition problem for both the Alpari(US) and the FXCM noDD MT4 platforms.  At least for Winner strategies, there are significant differences in price and time between the original entry and any additions.  I am also running both Platforms on the quadcore Win7 PC at present and there does not appear so far to be any interference between platforms.  Many, many thanks.