5.1. The syntax of the indicator in the general form
iInd (period, mode, shift);
Ind - called indicator;
Period - period of averaging;
Mode - most often indicates which of the values of the indicator was adopted (for indicators of the two lines)
Shift - the index indicates the ordinal value of the indicator taken for the calculation of (0 is the current value of the indicator, 1-back, 2-before, etc., similar to the indexes with quotes). Before the title bar
5.2. Moving averages
Moving averages are the most common indicator. Therefore, I would like to address this indicator in more detail.
Moving Average (iMA)
iMA (period, ma_method, shift)
period - the period of averaging;
ma_method - This parameter specifies the method for calculating the average, the parameter can take
following values:
MODE_SMA,
MODE_EMA,
MODE_SMMA,
MODE_LWMA.
Example:
iMA (21, MODE_SMA, 1) - the importance of the past moving average simple type with a period averaging 21
iMA (9, MODE_EMA, 0) - the current value of the rolling average of exponential type with a period averaging 9
By default, the indicators are based on closing prices, so the values of the indicators with a score of 0, ie the current values on the emerging bar will ever change with the price.
5.3. Extended (extended) indicators
As I said earlier, most indicators are based on closing prices
ADX extended
iADXEx (period, applied_price, mode, shift)
CCI extended
iCCIEx (period, applied_price, shift)
Bolinger bands extended iBandsEx (period, deviation, bands_shift, applied_price, mode, shift)
MACD extended
iMACDEx (fast_ema_period, slow_ema_period, signal_period, applied_price, mode, shift)
Moving average extended
iMAEx (period, ma_method, ma_shift, applied_price, shift)
Momentum extended
iMomEx (period, applied_price, shift)
RSI extended
iRSIEx (period, period2, applied_price, mode, shift)
If you notice any of the indicators have the option of extended
5.4. Expert
To consolidate the knowledge, write an expert. It will use 2 indicator, moving average with a large period and RSI. If the RSI above a certain our top overzony, turned down, and the average is directed downward, the expert will sell. If the RSI below the bottom overzony, turned up and the average is directed upward, then buy. Out of position is carried out on the key steps.
/ * [[
Name: = Expert4
Author: = Fxtest.ru
Link: = forextimes.ru
Lots: = 1.00
Stop Loss: = 40
Take Profit: = 40
Trailing Stop: = 0
]] * /
defines:
per (7), Upzone (70), Downzone (30), BigTrend (100);
/ / per-period RSI; Upzone, Downzone-overzony, BigTrend - period, showing an average global trend
var: r1 (0), r2 (0), m1 (0), m2 (0);
/ / R1-time value of RSI r2-before value of RSI
r1 = iRSI (per, 1);
r2 = iRSI (per, 2);
m1 = iMA (BigTrend, MODE_SMA, 1); / / MA simple type (SMA)
m2 = iMA (BigTrend, MODE_SMA, 2);
if TotalTrades <1 then (/ / play if no open positions
if r2> r1 and r2> Upzone and m1
trend down, sell
(SetOrder (op_sell, lots, bid, 3, ask + stoploss * point, ask-takeprofit * point, red); exit;);
if r2
global trend is up, buy (SetOrder (op_buy, lots, ask, 3, bid-stoploss * point, bid + takeprofit * point, green);
exit ;};};
In the next lesson we will learn to apply to open positions and forced them to close, with the faults of any conditions.
Company «Fxtest»
Halhalyan Arthur
Technical support for traders
artur@fxtest.ru
Halhalyan Arthur
Technical support for traders
artur@fxtest.ru
No comments:
Post a Comment