交易策略怎么做成软件测试,测试交易策略

Operation of Programs in the Strategy Tester

The Strategy Tester in MetaTrader 4 trading terminal allows you to test Expert Advisor's performance on historical data.

The features of program testing and optimization in the Strategy Tester should be considered when testing a trading robot:

Function Limitations in the Strategy Tester

There are operation limitations for some functions in the client terminal's Strategy Tester. Calling that functions leads to error 4059 (Function is not allowed in testing mode).

The Sleep() Function

The Sleep() function does not cause any delays in the Strategy Tester.

The Print() and PrintFormat() Functions

To increase performance, Print() and PrintFormat() functions are not executed when optimizing the trading robot's parameters. The exception is the use of these functions inside the OnInit() handler. This allows you to easily find the cause of errors when they occur.

The Alert(), MessageBox(), PlaySound(), SendFTP, SendMail(), SendNotification(), WebRequest() Functions

The Alert(), MessageBox(), PlaySound(), SendFTP(), SendMail(), SendNotification() и WebRequest() functions designed for interaction with the "outside world" are not executed in the Strategy Tester.

The OrderSend(), OrderModify(), OrderDelete(), OrderClose(), OrderCloseBy() Functions

Trade operations are not performed on the symbols that are different from the tested one.

The Global Variables of the Client Terminal

Since the tester is the part of the client terminal, they share the common global variables. Thus, their names should not overlap with the names of the global variables of working applications. This may lead to incorrect operation of programs and inaccurate test results.

Simulation of Time in the Tester

When testing, the time is simulated according to the historical data. TimeLocal() local time is always equal to TimeCurrent() server time. In turn, the server time is always equal to the time corresponding to the GMT - TimeGMT(). This way, all of these functions display the same time during testing.

The absence of the difference between GMT, local and server time in the tester is provided deliberately in case connection to the server is lost. The test results should always be the same, regardless of whether or not there is a connection. Information about the server time is not stored locally, and is taken from the server.

Graphical Objects in Testing

During visualization, the Expert Advisor interacts with a real chart. In case there is no visualization, the Expert Advisor works with a "virtual" chart that is not displayed. The former case has some peculiarities. During optimization, working with graphical objects is not supported.

Event Handling in the Tester

The following events are handled in the Strategy Tester: initializing an Expert Advisor before a single run of OnInit(), deinitializing an Expert Advisor after a single run of OnDeInit() and simulating a new tick OnTick().

In addition, Tester event handled in OnTester() function is generated before calling OnDeInit() deinitialization function after testing a trading robot on historical data. The value returned by this function is used as a Custom max criterion when optimizing the input parameters.

Timer and ChartEvent events are not handled in the Strategy Tester.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值