The attached .mqh files are designed to export orders and trades from one EA and import them into another one (copying trades), which can be run both in the same terminal and in another terminal on the same computer. It is also possible to exchange trades between different symbols, for example, copy trades of an instrument of spot market on the corresponding futures or any other instrument that correlates with it.
You need to include the GRat_OrderExport.mqh file to your exporting EA with the following command:
#include <GRat_OrderExport.mqh> This must be done in the input parameters area exactly in the place where the export parameters should be:
Then, in the EA code, wherever orders are executed by the OrderSend() function (or methods of the CTrade class), you need to add a call to the ExportOrder() function, for example:
MqlTradeRequest request = {}; // Market sell request.action = TRADE_ACTION_DEAL; request.symbol = Symbol(); request.volume = 0.2; request.type = ORDER_TYPE_SELL; request.price = SymbolInfoDouble (Symbol(), SYMBOL_BID); request.magic = 20000; OrderExport(request);
The MqlTradeRequest structure can be used the same as for the OrderSend() function, but you should fill additional MqlTradeRequest fields for actions
TRADE_ACTION_DEAL (for closing positions), TRADE_ACTION_SLTP, TRADE_ACTION_REMOVE and TRADE_ACTION_MODIFY:
An example implementation of an exporting EA is GRat_OrderExport .
You need to include the GRat_OrderImport.mqh file to your importing EA with the following command:
#include <GRat_OrderImport.mqh>
You need to do this in the input parameters area exactly in the place where the import parameters should be:
Then, to import trades, you need to call the ImportOrder() function. Call example:
MqlTradeRequest aReq[]; OrderImport(aReq, Magic, Symbol());
As a result, the aReq array contains all the latest unprocessed trades with the Magic number and the symbol of the current chart. In the last parameter, specify a different symbol if it differs in imported trades.
Next, in the cycle, you need to execute imporded trades on the desired symbol, adjusting the order parameters if necessary:
for ( int i = 0 ; i < ArraySize (aReq); i++) { aReq[i].symbol = _Symbol ; aReq[i].price = NormalizeDouble (aReq[i].price, _Digits ); aReq[i].stoplimit = NormalizeDouble (aReq[i].stoplimit, _Digits ); aReq[i].sl = NormalizeDouble (aReq[i].sl, _Digits ); aReq[i].tp = NormalizeDouble (aReq[i].tp, _Digits ); if (aReq[i].action == TRADE_ACTION_DEAL ) { ... } ... }
Attached EA is an example of the implementation of an importing EA that opens the imported trades on the symbol of EA's chart.
The Roofing Filter
The Roofing Filter Indicator was created by John Ehlers ("Cycle Analytics for Traders" pg. 80 - 82).
BSI Trend and Channel
This indicator shows trend line and channels using the BSI Indicator. Original work of https://www.mql5.com/en/code/13615
Fear And Greed Function
It is known that the market is mainly driven by two emotions: fear and greed. This should be seen as an attempt to implement these emotions in the form of a mathematical model.
Lazy Bot MT5 (Daily Breakout EA)
- This Bot use stratery Breakout of Daily Bar, I tested for 3 Pair currency : GBPUSD, EURUSD, XAUUSD - Default setting is not sure the best, you can test for your parameter. - This is version for MT5 that convert from MT4 - this EA is best for broker low spread