GRat Crypto Manual

GRat Crypto Manual

29 November 2022, 16:43
Ivan Titov
1
553

Manual for GRat Crypto 

Make sure your computer's local time is synchronized with the Internet.

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:

Binance:

api.binance.com
fapi.binance.com
dapi.binance.com
testnet.binance.vision
testnet.binancefuture.com
stream.binance.com
fstream.binance.com
dstream.binance.com
stream.binancefuture.com
dstream.binancefuture.com

BingX:

open-api.bingx.com

open-api-swap.bingx.com

Bybit:

api.bybit.com
api-testnet.bybit.com
stream-testnet.bybit.com
stream.bybit.com

Coinbase:

api.exchange.coinbase.com
api-public.sandbox.exchange.coinbase.com
ws-feed.exchange.coinbase.com
ws-feed-public.sandbox.exchange.coinbase.com

Kraken:

api.kucoin.com
api-futures.kucoin.com
openapi-sandbox.kucoin.com
api-sandbox-futures.kucoin.com
ws-api.kucoin.com

push-private-sandbox.kucoin.com

MEXC:

api.mexc.com
contract.mexc.com

wbs.mexc.com

OKX:

ws.okx.com
wspap.okx.com

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, BingX, Bybit, Coinbase, 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.
DrawTrades - if true, then the levels of open orders and positions will be shown on the chart.
DrawHistory - if true, then the lines from opening to closing positions will be shown on the chart.
DrawAllCharts - true - orders, positions, liquidations will be shown on all open charts of the traded instrument, false - only on the EA's chart.
=== 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) on a similar (correlated) symbol, 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), where Magic is the nonzero parameter above. 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 correlated 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, BingX,  Bybit, Coinbase, Kraken, KuCoin, MEXC or OKX).
Coin – currency or instrument to trade, e.g., Binance – BTC, BingX - BTC,  Bybit - BTC, Coinbase — BTC, Kraken — XBT, KuCoin — BTC, MEXC — BTC, OKX – BTC or BTC_USD_SWAP or BTC-USDT-220624.
Base – balance currency, e.g., Binance – USDT, USDC, USD, BingX - USDT,  Bybit - USDT, USDC, Coinbase – USDT, USDC, USD, Kraken – USD, KuCoin – USDT, USDC, USD, MEXC – USDT, OKX – USDT, USDC, USD.
APIKey – exchange API public key.
APISecret – exchange API private key.
Hedge – you must explicitly set the Hedge mode according to Bybit's settings.
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, Bybit and OKX 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 (except Kraken; the suffix f is added to the custom symbol, e.g. BTCUSDT.bncf).
Leverage – leverage depending on the ability of the exchange (e.g., Binance Futures wallet - 1..125).
Test Environment – use exchange environmet for testing purpose: Binance testnet API Bybit testnet, Coinbase Sandbox APIKuCoin sandbox API or OKX Demo Trading Services. The suffix t is added to the custom symbol, e.g. BTCUSDT.bncft.
TotalBarTS - if true, then the total buy and sell volumes for each M1 bar are stored to Time & Sales data (for Binance only), false - the volume of each trade is stored to Time & Sales data.
IsolatedMargin - true - use isolated margin, false - cross-margin (for Binance Margin wallet only).
Coinbase Passphrase – required for Coinbase only.
KuCoin Passphrase – required for KuCoin only.
OKX Passphrase – required for OKX only.
=== Dashboard ===
Trailing- if true, then the Trailing Stop and Trailing Profit columns are available in the Trades panel.
ScalePercent - panels size in percentage to original (in case of custom system font size).
FontSize- - font size of panels controls.
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.

Important!  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 - Binance BTCUSDT futures,  or ETHUSDT.okx - OKX ETHUSDT spot), and switching of the EA's chart to this symbol. 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.

Strategy Testing

After downloading the bars from the crypto exchange, you can test any EA in the MT5 strategy tester on the downloaded history of custom symbol (it is created in the Custom\<Crypto exchange>\... group, e.g. Custom\Binance\BTCUSDT.bncf). The testing period should not go beyond the downloaded history.

To reload bars again (e.g., if you need to fix gaps in history or load earlier history), stop GRat_Crypto, close all charts with reloading custom symbol, delete the reloading custom symbol from MT5, change the QuotesStart setting or the Max bars in chart: terminal setting, restart GRat_Crypto and wait for the xxx bars loaded again.

Dashboard



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).

Trades panel



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.

History panel



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).

    Chat.