Upload
others
View
10
Download
0
Embed Size (px)
Citation preview
Version: January 2018
MetaTrader 4
KTM Scripts and Indicators
For Scalping
Trading at your side KEYTOMARKETS.COM
2 All trading involves risk. Losses can exceed deposits. Please, read the risk warning.
Contents of this Guide
Script installation, indicators and EAs for the MT4 platform 2
Installation 3
Script 1: K2M_Close_All_Open_Positions 4
Script 2: K2M_Close_All_Open_Positions_Symbol 5
Script 3: K2M_Closeby_all 6
Script 4: K2M_Closeby_all_Symbol 7
Indicator: K2M_Avg_Price_v_1_0 8
Scripts and Indicators Installation for the MT4 platform
In this guide, we will show how to install and use four different scripts and an indicator that can be
useful for manual trading and in particular for scalping. The first two scripts can close a series of
open positions with a single command instead of closing trades one by one. Other two scripts can
close positions of opposite direction ("hedging") on the same symbol and at the same moment. For
example, imagine that you have five long positions EURUSD one lot each, the fastest way to close is
to short five lots and then use script 3 or 4 as appropriate.
The indicator "K2M_Avg_Price" visually identifies the average price of your open positions by
drawing a horizontal line on the chart. Works for one direction only sell/buy.
Trading at your side KEYTOMARKETS.COM
3 All trading involves risk. Losses can exceed deposits. Please, read the risk warning.
Installation
Let us move on to practice: from the MT4 main menu click on "Open data folder"
From the installation directory click on the MQL4 folder
Then click on Script, Indicators or Experts depending on whether you install a Script, an Indicator or
an Expert Advisor and insert the files of .mq4 and .ex4 format (in some cases only the .ex4 file is
available)
From the MT4 Navigator panel, right-click on Scripts, Indicators or Expert Advisor depending on
whether it was set to a Script, Indicator or Expert and click on “Update”.
Trading at your side KEYTOMARKETS.COM
4 All trading involves risk. Losses can exceed deposits. Please, read the risk warning.
Script 1: K2M_Close_All_Open_Positions
WE RECOMMEND TESTING THE SCRIPT IN THE DEMO ENVIRONMENT. IT IS ESSENTIAL TO ACTIVATE THE AUTOTRADING FUNCTION FROM THE BUTTON PRESENT AT THE TOP OF PLATFORM MENU
This script closes all open positions of ALL SYMBOLS.
Example: consider the following exposure of three open trades:
Drag the script onto any graph to activate it:
Confirm by clicking on Yes to close all positions:
Trading at your side KEYTOMARKETS.COM
5 All trading involves risk. Losses can exceed deposits. Please, read the risk warning.
Script 2: K2M_Close_All_Open_Positions_Symbol
WE RECOMMEND TESTING THE SCRIPT IN THE DEMO ENVIRONMENT. IT IS ESSENTIAL TO ACTIVATE THE AUTOTRADING FUNCTION FROM THE BUTTON PRESENT AT THE TOP OF PLATFORM MENU
This script closes all positions of the SYMBOL when you drag it on its chart.
Example: consider the following exposure of three open trades:
Drag the script onto EURUSD chart to activate it:
Confirm by clicking on Yes to close all open trades of EURUSD currency pair:
Trading at your side KEYTOMARKETS.COM
6 All trading involves risk. Losses can exceed deposits. Please, read the risk warning.
Script 3: K2M_Closeby_all
WE RECOMMEND TESTING THE SCRIPT IN THE DEMO ENVIRONMENT. IT IS ESSENTIAL TO ACTIVATE THE AUTOTRADING FUNCTION FROM THE BUTTON PRESENT AT THE TOP OF PLATFORM MENU
This script simultaneously closes all hedged long and short positions taking into consideration the
position sizes:
Drag the script to any graph and this window will appear:
Confirm by clicking on Yes to close all hedged open positions on all symbols.
Trading at your side KEYTOMARKETS.COM
7 All trading involves risk. Losses can exceed deposits. Please, read the risk warning.
Script 4: K2M_Closeby_all_Symbol
WE RECOMMEND TESTING THE SCRIPT IN THE DEMO ENVIRONMENT. IT IS ESSENTIAL TO ACTIVATE THE AUTOTRADING FUNCTION FROM THE BUTTON PRESENT AT THE TOP OF PLATFORM MENU
This script simultaneously closes all hedged long and short positions of a particular SYMBOL taking
into consideration the position sizes. It can potentially close parts of open positions starting from the
largest size.
Drag the script on GBPJPY chart to activate it:
Confirm by clicking “Yes” to offset all open positions on GBPJPY:
Trading at your side KEYTOMARKETS.COM
8 All trading involves risk. Losses can exceed deposits. Please, read the risk warning.
Indicator: K2M_Avg_Price_v_1_0
WE RECOMMEND TESTING THE SCRIPT IN THE DEMO ENVIRONMENT. IT IS ESSENTIAL TO ACTIVATE THE AUTOTRADING FUNCTION FROM THE BUTTON PRESENT AT THE TOP OF PLATFORM MENU
This indicator allows you to identify the Medium / Break-even of open positions on a certain symbol.
Drag the K2M_Avg_Price_v_1_0 indicator on the chart to activate it and click “OK”:
After the indicator has been applied, it will appear on the graph as follows:
The indicator is composed of a horizontal line that can assume different colours depending on the
direction (buy / sell) of the overall net position:
• Blue when the overall net position is long
• Red when the total net position is short
• White when the overall position is perfectly hedged on volumes (the sum of buy and sell
positions equals zero)
In addition to the horizontal line, numerical information is provided on the screen to make it easier
to read your net position as:
Trading at your side KEYTOMARKETS.COM
9 All trading involves risk. Losses can exceed deposits. Please, read the risk warning.
• Distance in pips compared to the break-even price (draw)
• Profit / loss of the net position expressed in the currency of the deposit
• Net number of lots: defined as the algebraic sum of the buy (+) and sell lots (-)
• Total number of trades.
The index takes into account the commissions paid for the breakeven and profit / loss calculation.
The calculation is made by taking the bid price as a reference. When placing any pending buy-to-
even orders, the market spread must always be taken into account.