#property copyright "Copyright © 2010 - 2011, Хлыстов Владимир, в редакции AMRo" #property link "cmillion@narod.ru, nemo811@mail.ru" #property show_inputs extern int MAGIC = 0; extern string t1 = " Выключатели рыночных ордеров "; extern bool BUY = FALSE; extern bool SELL = FALSE; extern string t2 = " Выключатели отложенных ордеров "; extern bool BUY_STOP = FALSE; extern bool BUY_LIMIT = FALSE; extern bool SELL_STOP = FALSE; extern bool SELL_LIMIT = FALSE; extern string t3 = " Параметры рыночных и отложенных ордеров "; extern double Lot = 0.1; extern int takeprofit = 0; extern int stoploss = 0; extern int DistanceSet = 35; extern int Proskalz = 3; double gd_152; double gd_160; int start() { if (BUY) { if (takeprofit != 0) gd_160 = NormalizeDouble(Ask + takeprofit * Point, Digits); else gd_160 = 0; if (stoploss != 0) gd_152 = NormalizeDouble(Ask - stoploss * Point, Digits); else gd_152 = 0; f0_2("Buy"); BUY = FALSE; } if (SELL) { if (takeprofit != 0) gd_160 = NormalizeDouble(Bid - takeprofit * Point, Digits); else gd_160 = 0; if (stoploss != 0) gd_152 = NormalizeDouble(Bid + stoploss * Point, Digits); else gd_152 = 0; f0_2("Sell"); SELL = FALSE; } if (BUY_STOP) { if (takeprofit != 0) gd_160 = NormalizeDouble(Ask + DistanceSet * Point + takeprofit * Point, Digits); else gd_160 = 0; if (stoploss != 0) gd_152 = NormalizeDouble(Ask + DistanceSet * Point - stoploss * Point, Digits); else gd_152 = 0; f0_2("Buy Stop"); BUY_STOP = FALSE; } if (SELL_STOP) { if (takeprofit != 0) gd_160 = NormalizeDouble(Bid - DistanceSet * Point - takeprofit * Point, Digits); else gd_160 = 0; if (stoploss != 0) gd_152 = NormalizeDouble(Bid - DistanceSet * Point + stoploss * Point, Digits); else gd_152 = 0; f0_2("Sell Stop"); SELL_STOP = FALSE; } if (BUY_LIMIT) { if (takeprofit != 0) gd_160 = NormalizeDouble(Ask - DistanceSet * Point + takeprofit * Point, Digits); else gd_160 = 0; if (stoploss != 0) gd_152 = NormalizeDouble(Ask - DistanceSet * Point - stoploss * Point, Digits); else gd_152 = 0; f0_2("Buy Limit"); BUY_LIMIT = FALSE; } if (SELL_LIMIT) { if (takeprofit != 0) gd_160 = NormalizeDouble(Bid + DistanceSet * Point - takeprofit * Point, Digits); else gd_160 = 0; if (stoploss != 0) gd_152 = NormalizeDouble(Bid + DistanceSet * Point + stoploss * Point, Digits); else gd_152 = 0; f0_2("Sell Limit"); SELL_LIMIT = FALSE; } return (0); }