ドキュメントとユーザーガイド
インスピレーションを与えるチュートリアルで、基礎を学ぶ、またはスキルを磨きましょう。.
Last updated on 30. 1. 2016 by Mark Fric
MetaTraderおよびTradestation向けの特別取引履歴エクスポート機能
Special trade exporters for MetaTrader and Tradestation were added in version 4.10.
They have two advantages:
- they allow for “automatic” export of trades to a predefined CSV data file, without the need of saving report file manually
- MAE (max open loss) and MFE (max open profit) is recorded for every trade. This is possible only for reports loaded this way and it will display MAE/MFE on the equity chart.
How to install custom trade exporters:
For Tradestation
- Import file SQEXPORTTRADES.ELD into Tradestation using File -> Import/Export EasyLanguage -> Import EasyLanguage File (ELD). The file is located in /loaders folder in QA installation.
- then add command: Value90 = SQExportTrades(“C:Your_File_Name.csv”, 10) to the very end of your strategy.
The trading results will be then exported to the file C:Your_File_Name.csv.
This function has two parameters:
– file name including full path
– ATR period – ATR period that will be recorded whenthe trade is opened. It could be later used to compute for example volatility when the trade was opened. You can set 1 if you don’t want to use it.
For MetaTrader
- Copy the file SQLogTrades.mqh into your MQL4Include folder – you can find the folder in MetaTrader4 in File -> Open Data Folder. The file is located in /loaders folder in QA installation.
- In your EA you have to do four things:
- include SQLogTrader.mqh file into your EA using #include<SQLogTrades.mqh
- add command sqInitLog(“Your_File_Name.csv”, 0, 10); to OnInit() / init() function.
If this function doesn’t exist in your EA you have to create it. - add command sqCloseLog(); to onDeinit() / deinit() function.
If this function doesn’t exist in your EA you have to create it. - add command sqLogTrades(); to the very beginning of OnTick() / start() function.
The trading results will be then exported to the file /tester/files/Your_File_Name.csv.
You can get to the tester folder using MetaTrader4 in File -> Open Data Folder
This function has three parameters:
– file name including full path
– magic number – if not 0 it will record only trades with given magic number
– ATR period – ATR period that will be recorded whenthe trade is opened. It could be later used to compute for example
volatility when the trade was opened. You can set 1 if you don’t want to use it.
Example – old MQL code style:
…
#include<SQLogTrades.mqh>
…
int init() {
sqInitLog(“My_EA_Results.csv”, 0, 10);
…
return(INIT_SUCCEEDED);
}
void deinit(const int reason) {
sqCloseLog();
…
}
void start() {
sqLogTrades();
…
}
Example – new MQL code style
…
#include<SQLogTrades.mqh>
…
int OnInit() {
sqInitLog(“My_EA_Results.csv”, 0, 10);
…
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason) {
sqCloseLog();
…
}
void OnTick() {
sqLogTrades();
…
}
この記事は参考になりましたか? この記事は役に立った この記事は役に立たなかった