Home Forex trading GRat Crypto Handbook – Buying and selling Methods – 29 November 2022

GRat Crypto Handbook – Buying and selling Methods – 29 November 2022


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 coin/pair for charts; Trade Only – just trades on the selected coin/pair(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 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 ..TerminalCommonFiles, if false – in the folder of the current terminal ..MQL5Files.

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

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

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.

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.

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 ..MQL5Files and in the common folder of all client terminals ..TerminalCommonFiles. The GRat_IndiTrade product creates such file. Or use OrderExport() function from the attached below module ..MQL5IncludeGRat_OrderExport.mqh to add an order from your script code:

#include <GRat_OrderExport.mqh>
MqlTradeRequest request = {};

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  = 10000;

 You should fill additional MqlTradeRequest fields for actions TRADE_ACTION_DEAL (for closing positions),  TRADE_ACTION_SLTP, TRADE_ACTION_REMOVE and TRADE_ACTION_MODIFY:

  • type
  • volume (positive for buy, negative for sell)
  • price (for pending orders only)
  • stoplimit (for Stop Limit orders only)
  • sl
  • tp
  • position (positive, for closing positions only)

Source link


Please enter your comment!
Please enter your name here