MT5 & EA Setup
1. Run MT5 on any account (even demo).
2. In MT5 go to Tools – Options.
a. On the Charts tab, set in Max bars in chart: the default number of bars to load from the exchange (Though it cannot load more bars than is available through the exchange API).
b. On the Expert Advisors tab, check Allow WebRequest for listed URL:
3. Run GRat_Crypto EA on any chart.
4. On the Inputs tab enter the parameters:
Magic – Important! Each instance of GRat_Crypto running on the same terminal must have a unique magic number.
Mode – Feed Only just feeds market data for the selected currency or instrument for charts, Depth Of Market and Time & Sales; Trade Only – just trades on the selected currency or instrument(you need to feed marked data by another GRat_Crypto instance); Feed & Trade – both feeds and trades.
WebSocket - if true (recommended), then market data is requested via WebSocket API (possible for Binance, Bybit, KuCoin и OKX), otherwise - via REST API. UpdateMilliseconds
- quote request frequency (0
– minimum possible for the exchange).
QuotesStart - the start date of the quotes history. If 1970.01.01 00:00:00 is set, then no more than the number of bars specified in the Max bars in chart: terminal setting will be loaded. Simulation
– if true
then the EA doesn't open real trades on crypto exchanges, but just draws lines он the chart and shows the trades in Trades panel. Use it for testing. For real trading set false
TradeAlerts - if true then an alert will appear on each trade event, otherwise only a record in the log.
ErrorAlerts - if true then an alert will appear on each error, otherwise only a record in the log.
ShowTradesOnChart - if true then the chart will show lines from opening to closing positions. === CopyFrom ===
Exchange on Start — when starting GRat_Crypto, if there are open orders or positions on the cryptocurrency exchange, you will be prompted to copy them to the EA.
Symbol – you can run any EA or trade manually on any account (even demo) and GRat_Crypto will copy all orders and trades made by other EAs from the specified symbol (not empty) to the cryptocurrency exchange.
Magic – you can run any EA on any account (even demo) and GRat_Crypto will copy all orders and trades made by other EAs with the specified magic number (nonzero) to the cryptocurrency exchange.
File – if true then GRat_Crypto will copy orders and trades not from other EAs, but from OrderExchange<Magic>.csv file (added after GRat_Crypto start only). See below how to add orders to this file.
Common — if true, then the OrderExchange<Magic>.csv file is located in the common folder of all client terminals ..\Terminal\Common\Files, if false - in the folder of the current terminal ..\MQL5\Files\.
VolumeFactor - multiplier for the volume. It can be used to change the risk of trading, or in the case when the lots of instruments differ, for example, when copying trades from spot to futures and vice versa.
PriceFactor - multiplier for the price. It can be used when the prices of correlated instruments differ, for example, when copying trades from spot to futures and vice versa.
DeleteAfter - true - delete all trades from the exchange file immediately after import. For the case when deals are imported into only one instance of GRat_Crypto. For several GRat_Crypto set false.
=== Exchange === - cryptocurrency exchange (Binance, Bybit, Kraken, KuCoin or OKX).
Coin – currency or instrument to trade, e.g., Binance – BTC, Bybit - BTC, Kraken - XBT, KuCoin – BTC, OKX – BTC or BTC_USD_SWAP or BTC-USDT-220624.
Base – balance currency, e.g., Binance – USDT, Bybit - USDT, Kraken - USD, KuCoin – USDT, OKX – USDT or USD.
APIKey – exchange API public key.
APISecret – exchange API private key.
BookDepth – the number of entries in the order book (0 - disabled). To view, open the Depth Of Market window in MT5.
TimeSales - true - receive Time & Sales data (except for Kraken) to use multiple indicators of split buying and selling volumes, delta, etc.
Liquidation - true - receive liquidation data (Futures & WebSocket only, Binance and Bybit for now). Liquidations will appear on the chart in the form of circles, the size of which depends on the volume of liquidated positions, and the color - on the direction of liquidation trades: red - sells, green - buys.
WalletType – trading wallet type: Exchange – spot, Margin – (Binance only) or Futures (Binance, KuCoin and OKX only).
Leverage – leverage depending on the ability of the exchange (e.g., Binance Futures wallet - 1..125).
IsolatedMargin - true - use isolated margin, false - cross-margin (for Binance Margin wallet only).
KuCoin Passphrase – required for KuCoin only.
OKX Passphrase – required for OKX only.
=== Dashboard ===
ScalePercent - panels size in percentage to original (in case of custom system font size).
PerPage – the number of lines per page in the Trades and History panel.
MaxHistory – the maximum number of trades in the History panel.
Press OK. You should wait for the xxx bars loaded entry in the Experts log for a specified coin (it can take a long time at the first launch) and the appearance in the Market Watch window of the corresponding custom symbol with the addition of the exchange suffix (e.g. BTCUSDT.bncf or ETHUSDT.okx). The number of loaded bars depends on QuotesStart EA setting, or on Max bars in chart: terminal setting, the timeframe of the chart on which the EA is running, and the capabilities of the specified crypto exchange API.
1. By default, the order volume is in the currency to trade. Press BTC: (or other currency) button to set it as balance currency or a percentage of the total balance (it will change to Risk %). Enter the order volume.
2. Enter Leverage: (for some exchanges only).
3. Enter Price: if you want to send pending order.
4. Enter Stop Limit: price (for Stop Limit orders only).
5. Enter SL: price.
6. Enter TP: price.
7. Press Buy @.. / Sell @.. button to send Market order.
8. Press Buy Stop / Sell Stop button to open Stop order.
9. Press Buy Limit / Sell Limit button to open Limit order.
10. Press Buy Stop Limit / Sell Stop Limit button to open Stop Limit order.
11. Press Trades button to show Trades panel (see below).
12. Press History button to show History panel (see below).
1. In SL column press button to delete stop-loss, or button to set stop-loss according to the dashboard settings.
2. In TP column press button to delete take-profit, or button to set take-profit according to the dashboard settings.
3. In Trailing Stop column press the button to set trailing stop-loss parameters: distance, step and start level.
4. In Trailing Profit column press the button to set trailing take-profit parameters as well.
5. In Close column enter the part of closing volume (optional, for position only) and press to close position or delete order.
Copy from File
GRat_Crypto can copy orders from external file OrderExchange<Magic>.csv (where Magic is GRat_Crypto unique magic number). For example, OrderExchange10000.csv. The file can be located both in the terminal folder ..\MQL5\Files\ and in the common folder of all client terminals ..\Terminal\Common\Files. The GRat_IndiTrade product creates such file. Or use GRat_OrderExport (MT5), GRat_OrderExport (MT4).