Expert
/ * [[
Name: = Expert7
Author: = fxtest.ru
Link: = forextimes.ru
Many: = 1.00
Stop Loss: = 0
Take Profit: = 0
Trailing Stop: = 0
]] * /
define: MACDfast (12), MACDslow (26), MACDsignal (9), sl1 (30), sl2 (30)
define: sl3 (30), TP1 (20), tp2 (20), tp3 (20), lot1 (1), lot2 (2), lot3 (7);
/ * External variables Iienaiea, adjustable MACD, stops and quantity lotov * /
var: macd1 (0), macd2 (0), macd3 (0), B1 (0), Ss (0), SB (0), fb (0), FS (0);
/ *
macd1-macd3-values ��fast MACD
B1-balance before the opening of last place
SS-amount of open positions in sales
SB-quantity of open spaces to buy
FB-MACD signal pre-emptive
FS-MACD signal of first sale
* /
If FreeMargin <1000 then exit; / / output in the absence of free marzhe
If TotalTrades = 0, then
{/ / In the absence of vacancies
if balance> b1 {fb = 0 then; fs = 0; SS = 0; sb = 0;
};
/ * If the balance is increased, following the closure of the last transaction
to void all variables * /
macd1 = iMACD (MACDfast, MACDslow, MACDsignal, MODE_MAIN, 1);
/ * Calculate fast MACD * /
macd2 = iMACD (MACDfast, MACDslow, MACDsignal, MODE_MAIN, 2);
macd3 = iMACD (MACDfast, MACDslow, MACDsignal, MODE_MAIN, 3);
If macd1 <0 and macd2 <0 and macd3 <0 and macd1> macd2
and macd3> macd2 and SB = 0 and SS = 0
then fb = 1;
If macd1> 0 and macd2> 0 and macd3> 0 and macd1 <macd2
and macd3 <macd2 and SS = 0 and SB = 0
then fs = 1;
/ * Oneiaey Extrema * /
if fb = 1 and SB = 0, then
{/ * If the signal to buyers was that the guarantee is the first to buy
to cancel the purchase signal to equate 1 to counter open
positions of buyers, the current state * /
fb = 0 is fixed; sb = 1; B1 = balance;
SetOrder (op_buy, lot1, Ask, 3, draft-sl1 * point, + * TP1 service point, green);
exit;
};
if Status <B1 and WB = 1 then
{/ * If the balance is reduced and 1 position was open,
equate to 2 to the counter to purchase open spaces and open
2? position * /
sb = 2; B1 = balance;
SetOrder (op_buy, lot2, Ask, 3, draft-sl2 * point, + * tp2 service point, green);
exit;
};
if balance <B1 and SB = 2 then
{/ * If the balance is reduced and the position was open 2Y,
to equate 0 to counter the open spaces to buy and open
3? position. 0 is equal because it is the last position in a string * /
fb = 0; sb = 0;
SetOrder (op_buy, lot3, Ask, 3, draft-sl3 * point, + * tp3 service point, green);
exit;
};
/ / Sales
if fs = 1 and SS = 0, then
{/ * If the signal to sell and this is the first order who to sell
signal to cancel the sale and to equate 1 to counter
Open seats for sale, current state * /
fs = 0 is fixed; ss = 1; B1 = balance;
SetOrder (op_sell, lot1, bid, 3, Ask + * sl1 point, ask-TP1 * point, red);
exit;
};
if Status <B1 and SS = 1 then
{/ * If the balance is reduced to sell
equate to 2 to counter the open spaces for sale
current balance * /
ss = 2 is locked; B1 = balance;
SetOrder (op_sell, lot2, bid, 3, Ask + * sl2 point, ask-tp2 * point, red);
exit;
};
if balance <B1 and SS = 2 Then
{/ * If the balance is reduced to that sold at last? AC * /
ss = 0;
SetOrder (op_sell, lot3, bid, 3, Ask + * sl3 point, ask-tp3 * point, red);
exit;
};
};
Whether the expert is necessary for you to solve for you. For me, such methods are extremely psychologically not comfortable. But on Martingela had many conversations on the forums, I'm glad that although there is little touched this topic. Probably, some readers will become interested in him and finally convinced of the contrary.
In the next lesson we will begin to write your own indicators.
Subscribe to:
Post Comments (Atom)
Popular Posts
Powered by Blogger.
No comments:
Post a Comment