← К каталогу
Исходный код · ID 214

indicator max pips.mq4

Вы автор или правообладатель?

Сообщите нам, если считаете, что материал размещён без разрешения.

Краткий обзор

О программе

Программа представляет собой торгового советника для MetaTrader 4, написанный на MQL4. Она анализирует ценовые данные (свечи, скользящие средние) и на основе набора настраиваемых условий формирует отложенные ордера Buy и Sell с параметрами объёма, стоп-лосса и тейк-профита.

Советник обрабатывает события тиков, таймера и торговых операций. Включает фильтры по паттернам свечей, фильтр направления тренда на скользящих средних, а также проверку условий по спреду перед открытием позиций.

Поддерживается система виртуальных стопов, автоматическое управление историей ордеров, а также уведомления через MT4-алерты, email и push-сообщения. Все торговые параметры настраиваются через входные параметры советника.

Настройки программы

НастройкаОписание
____Engulfing Filters_____ (_____EngulfingFilters_____) Engulfing Filters — Групповой разделитель настроек фильтров по паттернам поглощения (Engulfing).
Use MA Trend Filter (_UseMATrendFilter) Use MA Trend Filter — Переключатель: включает или отключает фильтр тренда на основе скользящих средних.
MA1 Period (_MA1Period) MA1 Period — Период первой простой скользящей средней (SMA) для фильтра тренда.
MA2 Period (_MA2Period) MA2 Period — Период второй простой скользящей средней (SMA) для фильтра тренда.
Use Prev Candles Bearish/Bullish Filter (_UsePrevCandlesBearishBullishFilter) Use Prev Candles Bearish/Bullish Filter — Переключатель: включает или отключает фильтр по направлению предыдущих свечей (бычий/медвежий).
____Order Settings_____ (_____OrderSettings_____) Order Settings — Групповой разделитель настроек ордеров.
Fixed Lot Size Pips (_FixedLotSizePips) Fixed Lot Size Pips — Фиксированный размер лота для открытия ордеров.
Pending Order Offset Pips (_PendingOrderOffsetPips) Pending Order Offset Pips — Смещение в пипсах для установки цены отложенного ордера относительно расчётного уровня.
Add Pips To SL (_AddPipsToSL) Add Pips To SL — Количество пипсов, добавляемых к уровню стоп-лосса при расчёте ценовых уровней.
TP Factor Based On Candle1 Length (_TPFactorBasedOnCandle1Length) TP Factor Based On Candle1 Length — Коэффициент для расчёта тейк-профита на основе длины первой свечи.
Pending Order Expiration Minutes (_PendingOrderExpirationMinutes) Pending Order Expiration Minutes — Количество минут до истечения срока действия отложенного ордера.
Pending Order Expiration Hours (_PendingOrderExpirationHours) Pending Order Expiration Hours — Количество часов до истечения срока действия отложенного ордера.
Pending Order Expiration Days (_PendingOrderExpirationDays) Pending Order Expiration Days — Количество дней до истечения срока действия отложенного ордера.
____Spread Handling_____ (_____SpreadHandling_____) Spread Handling — Групповой разделитель настроек обработки спреда.
____Notifications_____ (_____Notifications_____) Notifications — Групповой разделитель настроек уведомлений.
Send Notification Instead Of Trade (_SendNotificationInsteadOfTrade) Send Notification Instead Of Trade — Переключатель: при активации отправляются уведомления вместо выполнения реальных торговых операций.
_Send MT4 Alerts (__SendMT4Alerts) Send MT4 Alerts — Переключатель: включает отправку MT4-алертов.
_Send Email Alerts (__SendEmailAlerts) Send Email Alerts — Переключатель: включает отправку email-уведомлений.
_Send Push Alerts (__SendPushAlerts) Send Push Alerts — Переключатель: включает отправку push-уведомлений.
____For Trading Activity Alerts, Check The Box In MT4 Options______ (_____ForTradingActivityAlertsCheckTheBoxInMT4Option For Trading Activity Alerts — Групповой разделитель настроек для уведомлений о торговой активности.
Magic Start (MagicNumber=MagicStart+Group#) (MagicStart) MagicStart — Начальное значение магического номера для идентификации ордеров (MagicNumber = MagicStart + Group#).
Получить полный код

Поиск по коду файла

/************************************************************************************************************************/

/************************************************************************************************************************/

#define PROJECT_ID           "mt4-1526"
#define VIRTUAL_STOPS_ENABLED    false // true or false
#define VIRTUAL_STOPS_TIMEOUT 0//--
#define USE_EMERGENCY_STOPS  "no"   // "yes" to use emergency (hard stops) when virtual stops are in use. "always" to use EMERGENCY_STOPS_ADD as emergency stops when there is no virtual stop.
#define EMERGENCY_STOPS_REL  0       // Use 0 to disable hard stops when virtual stops are enabled. Use a value >=0 to automatically set hard stops with virtual. Example: if 2 is used, then hard stops will be 2 times bigger than virtual ones.
#define EMERGENCY_STOPS_ADD  0       // Add pips to relative size of emergency stops (hard stops)

#define ON_TRADE_REALTIME    0 //
#define ON_TIMER_PERIOD   60        // Timer event period (in seconds)

#define ENABLE_EVENT_TICK  1 // "Tick"  event: 1 - enable, 0 - disable
#define ENABLE_EVENT_TRADE 0 // "Trade" event: 1 - enable, 0 - disable
#define ENABLE_EVENT_TIMER 0 // "Timer" event: 1 - enable, 0 - disable

#define TLOBJPROP_TIME1 801
#define OBJPROP_TL_PRICE_BY_SHIFT 802
#define OBJPROP_TL_SHIFT_BY_PRICE 803
#define OBJPROP_FIBOVALUE 804
#define OBJPROP_FIBOPRICEVALUE 805
#define OBJPROP_BARSHIFT1 807
#define OBJPROP_BARSHIFT2 808
#define OBJPROP_BARSHIFT3 809
#define SEL_CURRENT 0
#define SEL_INITIAL 1

extern string _____EngulfingFilters_____ = "------------------------"; // ____Engulfing Filters_____
extern bool _UseMATrendFilter = false; // Use MA Trend Filter
extern int _MA1Period = 200; // MA1 Period
extern int _MA2Period = 50; // MA2 Period
extern bool _UsePrevCandlesBearishBullishFilter = true; // Use Prev Candles Bearish/Bullish Filter
extern string _____OrderSettings_____ = "------------------------"; // ____Order Settings_____
extern double _FixedLotSizePips = 0.01; // Fixed Lot Size Pips
extern double _PendingOrderOffsetPips = 0.2; // Pending Order Offset Pips
extern double _AddPipsToSL = 0.2; // Add Pips To SL
extern double _TPFactorBasedOnCandle1Length = 1.0; // TP Factor Based On Candle1 Length
extern int _PendingOrderExpirationMinutes = 0; // Pending Order Expiration Minutes
extern int _PendingOrderExpirationHours = 0; // Pending Order Expiration Hours
extern int _PendingOrderExpirationDays = 0; // Pending Order Expiration Days
extern string _____SpreadHandling_____ = "------------------------"; // ____Spread Handling_____
extern bool _TakeSpreadsIntoAccountTheCorrectWay = true; // Take Spreads Into Account The Correct Way
extern bool _TakeSpreadsIntoAccountTheMax_PipsWay = false; // Take Spreads Into Account The Max_Pips Way
extern string _____Notifications_____ = "------------------------"; // ____Notifications_____
extern bool _SendNotificationInsteadOfTrade = false; // Send Notification Instead Of Trade
extern bool __SendMT4Alerts = false; // _Send MT4 Alerts
extern bool __SendEmailAlerts = false; // _Send Email Alerts
extern bool __SendPushAlerts = false; // _Send Push Alerts
extern string _____ForTradingActivityAlertsCheckTheBoxInMT4Options______ = "------------------------"; // ____For Trading Activity Alerts, Check The Box In MT4 Options______

double Result11;
double Result12;
double Result13;
double Result14;
double Result15;
double Result16;
double Result17;
double Result18;
double Result19;
double Result26;
double Result27;
double Result28;
double Result29;
double Result58;
double Result59;
double Result60;
double Result61;
extern int MagicStart=1526; // Magic Start (MagicNumber=MagicStart+Group#)

int FXD_CURRENT_FUNCTION_ID=0;
double FXD_MILS_INIT_END=0;
bool FXD_FIRST_TICK_PASSED=false;
bool FXD_BREAK=false;
bool FXD_CONTINUE=false;
bool FXD_CHART_IS_OFFLINE = false;
bool FXD_ONTIMER_TAKEN = false;
bool FXD_ONTIMER_TAKEN_IN_MILLISECONDS = false;
double FXD_ONTIMER_TAKEN_TIME = 0;
bool USE_VIRTUAL_STOPS = VIRTUAL_STOPS_ENABLED;

bool block1=true; // Pass
bool block2=true; // Condition 
bool block3=true; // Condition 
bool block4=true; // Condition 
bool block5=true; // Condition 
bool block6=true; // Condition 
bool block7=true; // Condition 
bool block8=true; // Condition 
bool block9=false; // Buy pending order 
bool block10=false; // Sell pending order
bool block11=true; // Formula
bool block12=true; // Formula
bool block13=true; // Formula 
bool block14=true; // Formula
bool block15=true; // Formula
bool block16=true; // Formula 
bool block17=true; // Formula
bool block18=true; // Formula
bool block19=true; // Formula
bool block21=false; // Pass
bool block22=false; // Pass
bool block23=false; // Pass
bool block24=false; // Buy pending order
bool block25=false; // Sell pending order
bool block26=true; // Formula
bool block27=false; // Formula
bool block28=true; // Formula
bool block29=false; // Formula
bool block30=true; // Pass
bool block31=true; // Once a day
bool block32=true; // Pass
bool block33=true; // spreads correct
bool block34=true; // Turn ON blocks
bool block35=true; // spreads max
bool block36=true; // Turn ON blocks
bool block37=true; // Turn OFF blocks
bool block38=true; // bullbear
bool block39=true; // Turn ON blocks
bool block40=true; // Turn OFF blocks
bool block41=false; // Condition 
bool block42=true; // Pass
bool block43=true; // Pass
bool block44=true; // ma
bool block45=true; // Turn ON blocks
bool block46=true; // Turn OFF blocks
bool block47=true; // Condition 
bool block48=true; // Condition 
bool block49=false; // Condition 
bool block55=true; // Condition 
bool block57=true; // Pass
bool block58=true; // Formula
bool block59=true; // Formula
bool block60=true; // Formula
bool block61=true; // Formula
bool block62=true; // Once per bar
bool block63=true; // Once per bar
bool block64=true; // Once per bar
bool block65=true; // Once per bar
bool block66=true; // Once per bar
bool block1666538=false; // Custom Alert MQL4 code
bool block1666570=false; // Custom Alert MQL4 code
bool block1666571=false; // Custom Alert MQL4 code
bool block1666573=false; // Custom Alert MQL4 code
bool block1666605=false; // Custom Alert MQL4 code
bool block1666606=false; // Custom Alert MQL4 code
bool block1666607=true; // Pass
bool block1666608=true; // Pass
bool block1666609=true; // Pass
bool block1666610=true; // Pass
bool block1666611=true; // Pass
bool block1666612=true; // Pass
bool block1666613=true; // mt4 alert
bool block1666614=true; // Turn ON blocks
bool block1666615=true; // email alert
bool block1666616=true; // Turn ON blocks
bool block1666617=true; // push alert
bool block1666618=true; // Turn ON blocks
bool block1666619=true; // alert only
bool block1666621=true; // Turn OFF blocks

/************************************************************************************************************************/

/************************************************************************************************************************/

int OnInit()
{
      // код доступен только после оплаты
   }

void OnTick()
{
      // код доступен только после оплаты
   }

void EventTrade()
{

	OnTradeQueue(-1);
}

void OnTimer()
{

	if (FXD_CHART_IS_OFFLINE && RefreshRates()) {
		OnTick();
	}
	if (ON_TRADE_REALTIME == 1) {
		OnTradeListener();
	}

	static int t0 = 0;
	int t = 0;
	bool ok = false;

	if (FXD_ONTIMER_TAKEN)
	{
		if (FXD_ONTIMER_TAKEN_TIME > 0)
		{
			if (FXD_ONTIMER_TAKEN_IN_MILLISECONDS == true)
			{
				t = GetTickCount();
			}
			else
			{
				t = TimeLocal();
			}
			if ((t - t0) >= FXD_ONTIMER_TAKEN_TIME)
			{
				t0 = t;
				ok = true;
			}
		}

		if (ok == false) {
			return;
		}
	}

}

void OnDeinit(const int reason)
{

	EventKillTimer();

	if (MQLInfoInteger(MQL_TESTER)) {
		Print("Backtested in "+DoubleToStr((GetTickCount()-FXD_MILS_INIT_END)/1000, 2)+" seconds");
		Print("Average ticks per second: "+DoubleToStr(TicksFromStart()/(GetTickCount()-FXD_MILS_INIT_END),0));
	}

	DrawStatus("stopped");
	if (MQLInfoInteger(MQL_PROGRAM_TYPE) == PROGRAM_EXPERT)
	{
		switch(UninitializeReason())
		{
			case REASON_PROGRAM		: Print("Expert Advisor self terminated"); break;
			case REASON_REMOVE		: Print("Expert Advisor removed from the chart"); break;
			case REASON_RECOMPILE	: Print("Expert Advisorhas been recompiled"); break;
			case REASON_CHARTCHANGE	: Print("Symbol or chart period has been changed"); break;
    		case REASON_CHARTCLOSE	: Print("Chart has been closed"); break;
    		case REASON_PARAMETERS	: Print("Input parameters have been changed by a user"); break;
    		case REASON_ACCOUNT		: Print("Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings"); break;
			case REASON_TEMPLATE	: Print("A new template has been applied"); break;
			case REASON_INITFAILED	: Print("OnInit() handler has returned a nonzero value"); break;
			case REASON_CLOSE		: Print("Terminal has been closed"); break;
		}
	}
}

/************************************************************************************************************************/

/************************************************************************************************************************/

void block1(int _parent_=0)
{
	if (block1==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1;

	block31(1);
}

void block2(int _parent_=0)
{
	if (block2==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=2;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_candles("iHigh", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_candles("iHigh", "id", 2, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo>=Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro>=Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block3(2);} else if (o2==true) {/* Yellow output */}
}
double _candles(string iOHLC, string ModeCandleFindBy, int CandleID, string TimeStamp, string SYMBOL, int TIMEFRAME) {
	double retval=0;
	double cOpen=0;
	double cHigh=0;
	double cLow=0;
	double cClose=0;

	if (ModeCandleFindBy == "time")
	{
	   CandleID = iCandleID(SYMBOL, TIMEFRAME, StrToTime(TimeStamp));
	}

	CandleID=CandleID+IndicatorMoreShift();

	if (iOHLC=="iOpen")        {retval=iOpen(SYMBOL, TIMEFRAME, CandleID);}
	else if (iOHLC=="iHigh")   {retval=iHigh(SYMBOL, TIMEFRAME, CandleID);}
	else if (iOHLC=="iLow")    {retval=iLow(SYMBOL, TIMEFRAME, CandleID);}
	else if (iOHLC=="iClose")  {retval=iClose(SYMBOL, TIMEFRAME, CandleID);}
	else if (iOHLC=="iVolume") {retval=iVolume(SYMBOL, TIMEFRAME, CandleID);}
	else if (iOHLC=="iTime")   {retval=iTime(SYMBOL, TIMEFRAME, CandleID);}
	else
	{
	   if (iOHLC=="iMedian") {
	      cLow=iLow(SYMBOL,TIMEFRAME,CandleID);
	      cHigh=iHigh(SYMBOL,TIMEFRAME,CandleID);
	   	retval=((cLow+cHigh)/2);
	   }
	   else if (iOHLC=="iTypical") {
	   	cLow=iLow(SYMBOL,TIMEFRAME,CandleID);
	   	cHigh=iHigh(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	retval=((cLow+cHigh+cClose)/3);
	   }
	   else if (iOHLC=="iAverage") {
	   	cLow=iLow(SYMBOL,TIMEFRAME,CandleID);
	   	cHigh=iHigh(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	retval=((cLow+cHigh+cClose+cClose)/4);
	   }
	   else if (iOHLC=="iTotal") {
	   	cHigh=iHigh(SYMBOL,TIMEFRAME,CandleID);
	   	cLow=iLow(SYMBOL,TIMEFRAME,CandleID);
	   	retval=toPips(MathAbs(cHigh-cLow),SYMBOL);
	   }
	   else if (iOHLC=="iBody") {
	   	cOpen=iOpen(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	retval=toPips(MathAbs(cClose-cOpen),SYMBOL);
	   }
	   else if (iOHLC=="iUpperWick") {
	   	cHigh=iHigh(SYMBOL,TIMEFRAME,CandleID);
	   	cOpen=iOpen(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	cLow=iLow(SYMBOL,TIMEFRAME,CandleID);
	   	retval=0;
	   	if (cClose>cOpen) {
	   	   retval=toPips(MathAbs(cHigh-cClose),SYMBOL);
	   	} else {
	   	   retval=toPips(MathAbs(cHigh-cOpen),SYMBOL);
	   	}
	   }
	   else if (iOHLC=="iBottomWick") {
	   	cHigh=iHigh(SYMBOL,TIMEFRAME,CandleID);
	   	cOpen=iOpen(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	cLow=iLow(SYMBOL,TIMEFRAME,CandleID);
	   	retval=0;
	   	if (cClose>cOpen) {
	   	   retval=toPips(MathAbs(cOpen-cLow),SYMBOL);
	   	} else {
	   	   retval=toPips(MathAbs(cClose-cLow),SYMBOL);
	   	}
	   }
	   else if (iOHLC=="iBullTotal") {
	   	cOpen=iOpen(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	cHigh=iHigh(SYMBOL,TIMEFRAME,CandleID);
	   	cLow=iLow(SYMBOL,TIMEFRAME,CandleID);
	   	retval=toPips((cHigh-cLow),SYMBOL);
	   	if (cClose<cOpen) {return(EMPTY_VALUE);}
	   }
	   else if (iOHLC=="iBullBody") {
	   	cOpen=iOpen(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	retval=toPips((cClose-cOpen),SYMBOL);
	   	if (cClose<cOpen) {return(EMPTY_VALUE);}
	   }
	   else if (iOHLC=="iBullUpperWick") {
	   	cHigh=iHigh(SYMBOL,TIMEFRAME,CandleID);
	   	cOpen=iOpen(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	retval=toPips((cHigh-cClose),SYMBOL);
	   	if (cClose<cOpen) {return(EMPTY_VALUE);}
	   }
	   else if (iOHLC=="iBullBottomWick") {
	   	cLow=iLow(SYMBOL,TIMEFRAME,CandleID);
	   	cOpen=iOpen(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	retval=toPips((cOpen-cLow),SYMBOL);
	   	if (cClose<cOpen) {return(EMPTY_VALUE);}
	   }
	   else if (iOHLC=="iBearTotal") {
	   	cOpen=iOpen(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	cHigh=iHigh(SYMBOL,TIMEFRAME,CandleID);
	   	cLow=iLow(SYMBOL,TIMEFRAME,CandleID);
	   	retval=toPips((cHigh-cLow),SYMBOL);
	   	if (cOpen<cClose) {return(EMPTY_VALUE);}
	   }
	   else if (iOHLC=="iBearBody") {
	   	cOpen=iOpen(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	retval=toPips((cOpen-cClose),SYMBOL);
	   	if (cOpen<cClose) {return(EMPTY_VALUE);}
	   }
	   else if (iOHLC=="iBearUpperWick") {
	   	cHigh=iHigh(SYMBOL,TIMEFRAME,CandleID);
	   	cOpen=iOpen(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	retval=toPips((cHigh-cOpen),SYMBOL);
	   	if (cOpen<cClose) {return(EMPTY_VALUE);}
	   }
	   else if (iOHLC=="iBearBottomWick") {
	   	cLow=iLow(SYMBOL,TIMEFRAME,CandleID);
	   	cOpen=iOpen(SYMBOL,TIMEFRAME,CandleID);
	   	cClose=iClose(SYMBOL,TIMEFRAME,CandleID);
	   	retval=toPips((cClose-cLow),SYMBOL);
	   	if (cOpen<cClose) {return(EMPTY_VALUE);}
	   }
	}
	return(retval);
}

void block3(int _parent_=0)
{
	if (block3==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=3;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_candles("iLow", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_candles("iLow", "id", 2, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo<=Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro<=Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block11(3);} else if (o2==true) {/* Yellow output */}
}

void block4(int _parent_=0)
{
	if (block4==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=4;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_candles("iClose", "id", 2, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_candles("iOpen", "id", 2, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo<Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro<Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block5(4);} else if (o2==true) {/* Yellow output */}
}

void block5(int _parent_=0)
{
	if (block5==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=5;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_candles("iClose", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_candles("iOpen", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo>Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro>Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block2(5);} else if (o2==true) {/* Yellow output */}
}

void block6(int _parent_=0)
{
	if (block6==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=6;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_candles("iClose", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_candles("iOpen", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo<Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro<Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block7(6);} else if (o2==true) {/* Yellow output */}
}

void block7(int _parent_=0)
{
	if (block7==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=7;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_candles("iHigh", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_candles("iHigh", "id", 2, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo>=Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro>=Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block8(7);} else if (o2==true) {/* Yellow output */}
}

void block8(int _parent_=0)
{
	if (block8==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=8;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_candles("iLow", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_candles("iLow", "id", 2, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo<=Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro<=Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block12(8);} else if (o2==true) {/* Yellow output */}
}

void block9(int _parent_=0)
{
	if (block9==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=9;

	string OrdersGroup=""; // Group # (empty=Default)
	string SYMBOL=CurrentSymbol(); // Market (empty=Current)
	string Price="dynamic"; // Open at price
	double PriceOffset=0; // Price offset
	string VolumeMode="fixed"; // Money management
	double VolumeSize=_FixedLotSizePips; // Lot size
	double VolumeSizeRisk=50; // Risk fixed amount of money
	double VolumeRisk=2.5; // Risk percent
	double VolumePercent=100; // Volume size
	double VolumeBlockPercent=3; // Block % of Balance
	double FixedRatioUnitSize=0.01; // Fixed Ratio: Unit size
	double FixedRatioDelta=20; // Fixed Ratio: Delta parameter
	string StopLossMode="dynamicLevel"; // Stop-Loss mode
	double StopLossPips=100; // in pips...
	double StopLossPercentTP=100; // % of Take-Profit
	string TakeProfitMode="dynamicLevel"; // Take-Profit mode
	double TakeProfitPips=100; // in pips...
	double TakeProfitPercentSL=100; // % of Stop-Loss
	string ExpMode="specified"; // Expiration mode
	int ExpDays=_PendingOrderExpirationDays; // Days
	int ExpHours=_PendingOrderExpirationHours; // Hours
	int ExpMinutes=_PendingOrderExpirationMinutes; // Minutes
	int CreateOCO=0; // Create OCO order
	double Slippage=4; // Slippage
	string MyComment="Long pending order"; // Comment
	color ArrowColorBuy=Blue; // Arrow color

	SetSymbol(SYMBOL);

	double op=0;
	     if (Price=="ask") {op=SymbolAsk();}
	else if (Price=="bid") {op=SymbolBid();}
	else if (Price=="mid") {op=(SymbolAsk()+SymbolBid())/2;}
	else if (Price=="dynamic") {op=_fResults(Result11);}
	op=op+toDigits(PriceOffset);

	double sll=0, slp=0, tpl=0, tpp=0;

	     if (StopLossMode=="fixed")        {slp=StopLossPips;}
	else if (StopLossMode=="dynamicPips")  {slp=_value(100);}
	else if (StopLossMode=="dynamicDigits"){slp=toPips(_value(0.0100),SYMBOL);}
	else if (StopLossMode=="dynamicLevel") {sll=_fResults(Result29);}

	     if (TakeProfitMode=="fixed")         {tpp=TakeProfitPips;}
	else if (TakeProfitMode=="dynamicPips")   {tpp=_fResults(Result26);}
	else if (TakeProfitMode=="dynamicDigits") {tpp=toPips(_value(0.0100),SYMBOL);}
	else if (TakeProfitMode=="dynamicLevel")  {tpl=_fResults(Result61);}

	if (StopLossMode == "percentTP") {
	   if (tpp > 0) {slp = tpp*StopLossPercentTP/100;}
	   if (tpl > 0) {slp = toPips(MathAbs(SymbolAsk(SYMBOL) - tpl), SYMBOL)*StopLossPercentTP/100;}
	}
	if (TakeProfitMode == "percentSL") {
	   if (slp > 0) {tpp = slp*TakeProfitPercentSL/100;}
	   if (sll > 0) {tpp = toPips(MathAbs(SymbolAsk(SYMBOL) - sll), SYMBOL)*TakeProfitPercentSL/100;}
	}

	double lots=0;
	double pre_sll=sll; if (pre_sll==0) {pre_sll=op;}
	double pre_sl_pips=toPips(op-(pre_sll-toDigits(slp,SYMBOL)));

	     if (VolumeMode=="fixed")             {lots=DynamicLots(VolumeMode, VolumeSize);}
	else if (VolumeMode=="block-equity")      {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="block-balance")     {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="block-freemargin")  {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="equity")            {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="balance")           {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="freemargin")        {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="equityRisk")        {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="balanceRisk")       {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="freemarginRisk")    {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="fixedRisk")         {lots=DynamicLots(VolumeMode, VolumeSizeRisk, pre_sl_pips);}
	else if (VolumeMode=="fixedRatio")        {lots=DynamicLots(VolumeMode, FixedRatioUnitSize, FixedRatioDelta);}
	else if (VolumeMode=="dynamic")           {lots=AlignLots(_value(0.1));}

	datetime exp=ExpirationTime(ExpMode,ExpDays,ExpHours,ExpMinutes,_time(0, 0, "00:00", 1, "", 0, 0, 0, 0, 12, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, true));

	int ticket=BuyLater(SYMBOL,lots,op,sll,tpl,slp,tpp,Slippage,exp,(MagicStart+(int)OrdersGroup),MyComment,ArrowColorBuy,CreateOCO);

	if (ticket>0) {/* Orange output */} else {/* Gray output */}
}
double _fResults(double fResult) {
	return(fResult);
}
double _value(double Value) {
	return(Value);
}
datetime _time(int ModeTime, int TimeSource, string TimeStamp, int TimeCandleID, string TimeMarket, int TimeCandleTimeframe, int TimeComponentYear, int TimeComponentMonth, int TimeComponentDay, int TimeComponentHour, int TimeComponentMinute, int TimeComponentSecond, int ModeTimeShift, int TimeShiftYears, int TimeShiftMonths, int TimeShiftWeeks, int TimeShiftDays, int TimeShiftHours, int TimeShiftMinutes, int TimeShiftSeconds, bool TimeSkipWeekdays) {
	static datetime retval=0, retval0=0;
	static int ModeTime0=0;
	static int smodeshift=0;

	if(ModeTime==0) {
	   if (TimeSource==1) {retval=TimeLocal();} else {retval=TimeCurrent();}
	}
	else if(ModeTime==1) {
	      retval=StringToTime(TimeStamp);
	      retval0=retval;
	}
	else if(ModeTime==2) {
	   retval = TimeFromComponents(TimeSource == 1, TimeComponentYear, TimeComponentMonth, TimeComponentDay, TimeComponentHour, TimeComponentMinute, TimeComponentSecond);
	}
	else if(ModeTime==3) {
	   if (TimeMarket=="") {TimeMarket=Symbol();}
	   retval=iTime(TimeMarket,TimeCandleTimeframe,TimeCandleID);
	}

	if (ModeTimeShift>0) {
	   int sh=1;
	   if (ModeTimeShift==1) {sh=-1;}

	   static int years0=0,months0=0;

	   if (
	      ModeTimeShift!=smodeshift
	      || TimeShiftYears!=years0 || TimeShiftMonths!=months0
	   )
	   {
	      years0=TimeShiftYears; months0=TimeShiftMonths;

	      if (TimeShiftYears>0 || TimeShiftMonths>0) {
	         int year=0,month=0,week=0,day=0,hour=0,minute=0,second=0;
	         if (ModeTime==3) {
	            year=TimeComponentYear; month=TimeComponentYear;    day=TimeComponentDay;
	            hour=TimeComponentHour; minute=TimeComponentMinute; second=TimeComponentSecond;
	         }
	         else {
	            year=TimeYear(retval); month=TimeMonth(retval);   day=TimeDay(retval);
	            hour=TimeHour(retval); minute=TimeMinute(retval); second=TimeSeconds(retval);
	         }

	         year  =year+TimeShiftYears*sh;
	         month =month+TimeShiftMonths*sh;
	         if (month<0) {month=12-month;}
	         else if (month>12) {month=month-12;}
	         retval=StrToTime(year+"."+month+"."+day+" "+hour+":"+minute+":"+second);
	      }
	   }

	   retval=retval+TimeShiftWeeks*604800*sh+TimeShiftDays*86400*sh+TimeShiftHours*3600*sh+TimeShiftMinutes*60*sh+TimeShiftSeconds*sh;

	   if (TimeSkipWeekdays==true) {
	      int weekday=TimeDayOfWeek(retval);

	      if (sh>0) { // forward
	         if (weekday==0) {retval=retval+86400;}
	         else if (weekday==6) {retval=retval+172800;}
	      }
	      else if (sh<0) { // back
	         if (weekday==0) {retval=retval-172800;}
	         else if (weekday==6) {retval=retval-86400;}
	      }
	   }
	}
	smodeshift=ModeTimeShift;
	ModeTime0=ModeTime;

	return(retval);
}

void block10(int _parent_=0)
{
	if (block10==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=10;

	string OrdersGroup=""; // Group # (empty=Default)
	string SYMBOL=CurrentSymbol(); // Market (empty=Current)
	string Price="dynamic"; // Open at price
	double PriceOffset=0; // Price offset
	string VolumeMode="fixed"; // Money management
	double VolumeSize=_FixedLotSizePips; // Lot size
	double VolumeSizeRisk=50; // Risk fixed amount of money
	double VolumeRisk=2.5; // Risk percent
	double VolumePercent=100; // Volume size
	double VolumeBlockPercent=3; // Block % of Balance
	double FixedRatioUnitSize=0.01; // Fixed Ratio: Unit size
	double FixedRatioDelta=20; // Fixed Ratio: Delta parameter
	string StopLossMode="dynamicLevel"; // Stop-Loss mode
	double StopLossPips=100; // in pips...
	double StopLossPercentTP=100; // % of Take-Profit
	string TakeProfitMode="dynamicLevel"; // Take-Profit mode
	double TakeProfitPips=100; // in pips...
	double TakeProfitPercentSL=100; // % of Stop-Loss
	string ExpMode="specified"; // Expiration mode
	int ExpDays=_PendingOrderExpirationDays; // Days
	int ExpHours=_PendingOrderExpirationHours; // Hours
	int ExpMinutes=_PendingOrderExpirationMinutes; // Minutes
	int CreateOCO=0; // Create OCO order
	double Slippage=4; // Slippage
	string MyComment="Short pending order"; // Comment
	color ArrowColorSell=Red; // Arrow color

	SetSymbol(SYMBOL);

	double op=0;
	     if (Price=="ask") {op=SymbolAsk();}
	else if (Price=="bid") {op=SymbolBid();}
	else if (Price=="mid") {op=(SymbolAsk()+SymbolBid())/2;}
	else if (Price=="dynamic") {op=_fResults(Result12);}
	op=op-toDigits(PriceOffset);

	double sll=0, slp=0, tpl=0, tpp=0;

	     if (StopLossMode=="fixed")        {slp=StopLossPips;}
	else if (StopLossMode=="dynamicPips")  {slp=_value(100);}
	else if (StopLossMode=="dynamicDigits"){slp=toPips(_value(0.0100),SYMBOL);}
	else if (StopLossMode=="dynamicLevel") {sll=_fResults(Result16);}

	     if (TakeProfitMode=="fixed")         {tpp=TakeProfitPips;}
	else if (TakeProfitMode=="dynamicPips")   {tpp=_fResults(Result27);}
	else if (TakeProfitMode=="dynamicDigits") {tpp=toPips(_value(0.0100),SYMBOL);}
	else if (TakeProfitMode=="dynamicLevel")  {tpl=_fResults(Result59);}

	if (StopLossMode == "percentTP") {
	   if (tpp > 0) {slp = tpp*StopLossPercentTP/100;}
	   if (tpl > 0) {slp = toPips(MathAbs(SymbolAsk(SYMBOL) - tpl), SYMBOL)*StopLossPercentTP/100;}
	}
	if (TakeProfitMode == "percentSL") {
	   if (slp > 0) {tpp = slp*TakeProfitPercentSL/100;}
	   if (sll > 0) {tpp = toPips(MathAbs(SymbolAsk(SYMBOL) - sll), SYMBOL)*TakeProfitPercentSL/100;}
	}

	double lots=0;
	double pre_sll=sll; if (pre_sll==0) {pre_sll=op;}
	double pre_sl_pips=toPips((pre_sll+toDigits(slp,SYMBOL))-op);

	     if (VolumeMode=="fixed")             {lots=DynamicLots(VolumeMode, VolumeSize);}
	else if (VolumeMode=="block-equity")      {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="block-balance")     {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="block-freemargin")  {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="equity")            {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="balance")           {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="freemargin")        {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="equityRisk")        {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="balanceRisk")       {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="freemarginRisk")    {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="fixedRisk")         {lots=DynamicLots(VolumeMode, VolumeSizeRisk, pre_sl_pips);}
	else if (VolumeMode=="fixedRatio")        {lots=DynamicLots(VolumeMode, FixedRatioUnitSize, FixedRatioDelta);}
	else if (VolumeMode=="dynamic")           {lots=AlignLots(_value(0.1));}

	datetime exp=ExpirationTime(ExpMode,ExpDays,ExpHours,ExpMinutes,_time(0, 0, "00:00", 1, "", 0, 0, 0, 0, 12, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, true));

	int ticket=SellLater(SYMBOL,lots,op,sll,tpl,slp,tpp,Slippage,exp,(MagicStart+(int)OrdersGroup),MyComment,ArrowColorSell,CreateOCO);

	if (ticket>0) {/* Orange output */} else {/* Gray output */}
}

void block11(int _parent_=0)
{
	if (block11==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=11;

	double Lo=_candles("iHigh", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_points(_PendingOrderOffsetPips, 1, CurrentSymbol());
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result11=(Lo + Ro);

	block13(11); block21(11);
}
double _points(double Value, int ModeValue, string SYMBOL) {
	double retval=0;
	     if (ModeValue==0) {retval=Value;}
	else if (ModeValue==1) {retval=Value*MarketInfo(SYMBOL,MODE_POINT)*PipValue(SYMBOL);}

	return(retval);
}

void block12(int _parent_=0)
{
	if (block12==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=12;

	double Lo=_candles("iLow", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_points(_PendingOrderOffsetPips, 1, CurrentSymbol());
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result12=(Lo - Ro);

	block15(12);
}

void block13(int _parent_=0)
{
	if (block13==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=13;

	double Lo=_fResults(Result11);
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_Spread(CurrentSymbol());
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result13=(Lo + Ro);

	block14(13);
}
double _Spread(string SYMBOL) {
	double retval=(MarketInfo(SYMBOL,MODE_ASK)-MarketInfo(SYMBOL,MODE_BID));
	retval=NormalizeDouble(retval,MarketInfo(SYMBOL,MODE_DIGITS));
	return(retval);
}

void block14(int _parent_=0)
{
	if (block14==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=14;

	double Lo=_candles("iLow", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_points(_AddPipsToSL, 1, CurrentSymbol());
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result14=(Lo - Ro);

	block29(14); block32(14);
}

void block15(int _parent_=0)
{
	if (block15==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=15;

	double Lo=_candles("iHigh", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_points(_AddPipsToSL, 1, CurrentSymbol());
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result15=(Lo + Ro);

	block16(15);
}

void block16(int _parent_=0)
{
	if (block16==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=16;

	double Lo=_fResults(Result15);
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_Spread(CurrentSymbol());
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result16=(Lo + Ro);

	block18(16);
}

void block17(int _parent_=0)
{
	if (block17==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=17;

	double Lo=_candles("iHigh", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_candles("iLow", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result17=(Lo - Ro);

	block26(17);
}

void block18(int _parent_=0)
{
	if (block18==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=18;

	double Lo=_candles("iHigh", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_candles("iLow", "id", 1, "00:00", CurrentSymbol(), CurrentTimeframe());
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result18=(Lo - Ro);

	block22(18); block28(18);
}

void block19(int _parent_=0)
{
	if (block19==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=19;

	double Lo=_fResults(Result28);
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_Spread(CurrentSymbol());
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result19=(Lo + Ro);

	block60(19);
}

void block21(int _parent_=0)
{
	if (block21==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=21;

	block14(21);
}

void block22(int _parent_=0)
{
	if (block22==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=22;

	block27(22);
}

void block23(int _parent_=0)
{
	if (block23==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=23;

	block2(23); block7(23);
}

void block24(int _parent_=0)
{
	if (block24==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=24;

	string OrdersGroup=""; // Group # (empty=Default)
	string SYMBOL=CurrentSymbol(); // Market (empty=Current)
	string Price="dynamic"; // Open at price
	double PriceOffset=0; // Price offset
	string VolumeMode="fixed"; // Money management
	double VolumeSize=_FixedLotSizePips; // Lot size
	double VolumeSizeRisk=50; // Risk fixed amount of money
	double VolumeRisk=2.5; // Risk percent
	double VolumePercent=100; // Volume size
	double VolumeBlockPercent=3; // Block % of Balance
	double FixedRatioUnitSize=0.01; // Fixed Ratio: Unit size
	double FixedRatioDelta=20; // Fixed Ratio: Delta parameter
	string StopLossMode="dynamicLevel"; // Stop-Loss mode
	double StopLossPips=100; // in pips...
	double StopLossPercentTP=100; // % of Take-Profit
	string TakeProfitMode="dynamicLevel"; // Take-Profit mode
	double TakeProfitPips=100; // in pips...
	double TakeProfitPercentSL=100; // % of Stop-Loss
	string ExpMode="specified"; // Expiration mode
	int ExpDays=_PendingOrderExpirationDays; // Days
	int ExpHours=_PendingOrderExpirationHours; // Hours
	int ExpMinutes=_PendingOrderExpirationMinutes; // Minutes
	int CreateOCO=0; // Create OCO order
	double Slippage=4; // Slippage
	string MyComment="Long pending order"; // Comment
	color ArrowColorBuy=Blue; // Arrow color

	SetSymbol(SYMBOL);

	double op=0;
	     if (Price=="ask") {op=SymbolAsk();}
	else if (Price=="bid") {op=SymbolBid();}
	else if (Price=="mid") {op=(SymbolAsk()+SymbolBid())/2;}
	else if (Price=="dynamic") {op=_fResults(Result13);}
	op=op+toDigits(PriceOffset);

	double sll=0, slp=0, tpl=0, tpp=0;

	     if (StopLossMode=="fixed")        {slp=StopLossPips;}
	else if (StopLossMode=="dynamicPips")  {slp=_value(100);}
	else if (StopLossMode=="dynamicDigits"){slp=toPips(_value(0.0100),SYMBOL);}
	else if (StopLossMode=="dynamicLevel") {sll=_fResults(Result14);}

	     if (TakeProfitMode=="fixed")         {tpp=TakeProfitPips;}
	else if (TakeProfitMode=="dynamicPips")   {tpp=_fResults(Result58);}
	else if (TakeProfitMode=="dynamicDigits") {tpp=toPips(_value(0.0100),SYMBOL);}
	else if (TakeProfitMode=="dynamicLevel")  {tpl=_fResults(Result58);}

	if (StopLossMode == "percentTP") {
	   if (tpp > 0) {slp = tpp*StopLossPercentTP/100;}
	   if (tpl > 0) {slp = toPips(MathAbs(SymbolAsk(SYMBOL) - tpl), SYMBOL)*StopLossPercentTP/100;}
	}
	if (TakeProfitMode == "percentSL") {
	   if (slp > 0) {tpp = slp*TakeProfitPercentSL/100;}
	   if (sll > 0) {tpp = toPips(MathAbs(SymbolAsk(SYMBOL) - sll), SYMBOL)*TakeProfitPercentSL/100;}
	}

	double lots=0;
	double pre_sll=sll; if (pre_sll==0) {pre_sll=op;}
	double pre_sl_pips=toPips(op-(pre_sll-toDigits(slp,SYMBOL)));

	     if (VolumeMode=="fixed")             {lots=DynamicLots(VolumeMode, VolumeSize);}
	else if (VolumeMode=="block-equity")      {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="block-balance")     {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="block-freemargin")  {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="equity")            {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="balance")           {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="freemargin")        {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="equityRisk")        {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="balanceRisk")       {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="freemarginRisk")    {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="fixedRisk")         {lots=DynamicLots(VolumeMode, VolumeSizeRisk, pre_sl_pips);}
	else if (VolumeMode=="fixedRatio")        {lots=DynamicLots(VolumeMode, FixedRatioUnitSize, FixedRatioDelta);}
	else if (VolumeMode=="dynamic")           {lots=AlignLots(_value(0.1));}

	datetime exp=ExpirationTime(ExpMode,ExpDays,ExpHours,ExpMinutes,_time(0, 0, "00:00", 1, "", 0, 0, 0, 0, 12, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, true));

	int ticket=BuyLater(SYMBOL,lots,op,sll,tpl,slp,tpp,Slippage,exp,(MagicStart+(int)OrdersGroup),MyComment,ArrowColorBuy,CreateOCO);

	if (ticket>0) {/* Orange output */} else {/* Gray output */}
}

void block25(int _parent_=0)
{
	if (block25==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=25;

	string OrdersGroup=""; // Group # (empty=Default)
	string SYMBOL=CurrentSymbol(); // Market (empty=Current)
	string Price="dynamic"; // Open at price
	double PriceOffset=0; // Price offset
	string VolumeMode="fixed"; // Money management
	double VolumeSize=_FixedLotSizePips; // Lot size
	double VolumeSizeRisk=50; // Risk fixed amount of money
	double VolumeRisk=2.5; // Risk percent
	double VolumePercent=100; // Volume size
	double VolumeBlockPercent=3; // Block % of Balance
	double FixedRatioUnitSize=0.01; // Fixed Ratio: Unit size
	double FixedRatioDelta=20; // Fixed Ratio: Delta parameter
	string StopLossMode="dynamicLevel"; // Stop-Loss mode
	double StopLossPips=100; // in pips...
	double StopLossPercentTP=100; // % of Take-Profit
	string TakeProfitMode="dynamicLevel"; // Take-Profit mode
	double TakeProfitPips=100; // in pips...
	double TakeProfitPercentSL=100; // % of Stop-Loss
	string ExpMode="specified"; // Expiration mode
	int ExpDays=_PendingOrderExpirationDays; // Days
	int ExpHours=_PendingOrderExpirationHours; // Hours
	int ExpMinutes=_PendingOrderExpirationMinutes; // Minutes
	int CreateOCO=0; // Create OCO order
	double Slippage=4; // Slippage
	string MyComment="Short pending order"; // Comment
	color ArrowColorSell=Red; // Arrow color

	SetSymbol(SYMBOL);

	double op=0;
	     if (Price=="ask") {op=SymbolAsk();}
	else if (Price=="bid") {op=SymbolBid();}
	else if (Price=="mid") {op=(SymbolAsk()+SymbolBid())/2;}
	else if (Price=="dynamic") {op=_fResults(Result12);}
	op=op-toDigits(PriceOffset);

	double sll=0, slp=0, tpl=0, tpp=0;

	     if (StopLossMode=="fixed")        {slp=StopLossPips;}
	else if (StopLossMode=="dynamicPips")  {slp=_value(100);}
	else if (StopLossMode=="dynamicDigits"){slp=toPips(_value(0.0100),SYMBOL);}
	else if (StopLossMode=="dynamicLevel") {sll=_fResults(Result16);}

	     if (TakeProfitMode=="fixed")         {tpp=TakeProfitPips;}
	else if (TakeProfitMode=="dynamicPips")   {tpp=_fResults(Result19);}
	else if (TakeProfitMode=="dynamicDigits") {tpp=toPips(_value(0.0100),SYMBOL);}
	else if (TakeProfitMode=="dynamicLevel")  {tpl=_fResults(Result60);}

	if (StopLossMode == "percentTP") {
	   if (tpp > 0) {slp = tpp*StopLossPercentTP/100;}
	   if (tpl > 0) {slp = toPips(MathAbs(SymbolAsk(SYMBOL) - tpl), SYMBOL)*StopLossPercentTP/100;}
	}
	if (TakeProfitMode == "percentSL") {
	   if (slp > 0) {tpp = slp*TakeProfitPercentSL/100;}
	   if (sll > 0) {tpp = toPips(MathAbs(SymbolAsk(SYMBOL) - sll), SYMBOL)*TakeProfitPercentSL/100;}
	}

	double lots=0;
	double pre_sll=sll; if (pre_sll==0) {pre_sll=op;}
	double pre_sl_pips=toPips((pre_sll+toDigits(slp,SYMBOL))-op);

	     if (VolumeMode=="fixed")             {lots=DynamicLots(VolumeMode, VolumeSize);}
	else if (VolumeMode=="block-equity")      {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="block-balance")     {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="block-freemargin")  {lots=DynamicLots(VolumeMode, VolumeBlockPercent);}
	else if (VolumeMode=="equity")            {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="balance")           {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="freemargin")        {lots=DynamicLots(VolumeMode, VolumePercent);}
	else if (VolumeMode=="equityRisk")        {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="balanceRisk")       {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="freemarginRisk")    {lots=DynamicLots(VolumeMode, VolumeRisk, pre_sl_pips);}
	else if (VolumeMode=="fixedRisk")         {lots=DynamicLots(VolumeMode, VolumeSizeRisk, pre_sl_pips);}
	else if (VolumeMode=="fixedRatio")        {lots=DynamicLots(VolumeMode, FixedRatioUnitSize, FixedRatioDelta);}
	else if (VolumeMode=="dynamic")           {lots=AlignLots(_value(0.1));}

	datetime exp=ExpirationTime(ExpMode,ExpDays,ExpHours,ExpMinutes,_time(0, 0, "00:00", 1, "", 0, 0, 0, 0, 12, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, true));

	int ticket=SellLater(SYMBOL,lots,op,sll,tpl,slp,tpp,Slippage,exp,(MagicStart+(int)OrdersGroup),MyComment,ArrowColorSell,CreateOCO);

	if (ticket>0) {/* Orange output */} else {/* Gray output */}
}

void block26(int _parent_=0)
{
	if (block26==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=26;

	double Lo=_fResults(Result17);
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_value(_TPFactorBasedOnCandle1Length);
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result26=(Lo * Ro);

	block58(26); block61(26);
}

void block27(int _parent_=0)
{
	if (block27==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=27;

	double Lo=_fResults(Result18);
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_value(_TPFactorBasedOnCandle1Length);
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result27=(Lo * Ro);

	block59(27);
}

void block28(int _parent_=0)
{
	if (block28==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=28;

	double Lo=_fResults(Result18);
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_value(_TPFactorBasedOnCandle1Length);
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result28=(Lo * Ro);

	block19(28);
}

void block29(int _parent_=0)
{
	if (block29==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=29;

	double Lo=_fResults(Result14);
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_Spread(CurrentSymbol());
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result29=(Lo - Ro);

	block17(29);
}

void block30(int _parent_=0)
{
	if (block30==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=30;

	block4(30); block23(30); block48(30);
}

void block31(int _parent_=0)
{
	if (block31==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=31;

	string ServerOrLocalTime="server"; // Server or local time
	string HoursFilter="disabled"; // Hours filter
	string CertainHour="09:15"; // Certain hour
	string StartHour="01:00"; // Start hour (from)
	string EndHour="08:00"; // End hour (to)

	static int day0=0;
	int day=0;
	static datetime time1;
	datetime time;
	bool next=false;
	bool local_time = false;

	if (ServerOrLocalTime=="local") {local_time = true; time=TimeLocal();}
	else if (ServerOrLocalTime=="server") {time=TimeCurrent();}
	day=TimeDay(time);

	if (day!=day0 || time>time1)
	{
	   if (HoursFilter=="disabled") {next=true;}
	   else {
	      if (HoursFilter=="hour") {
	         if (time>=TimeFromString(local_time, CertainHour) && time<TimeFromString(local_time, CertainHour)+60) {next=true;}
	      }
	      else
	      if (HoursFilter=="period") {
	         if (time>=TimeFromString(local_time, StartHour) && time<TimeFromString(local_time, EndHour)) {next=true;}
	      }
	   }
	}
	if (next==true) {
	   time1=time+86400;
	   day0=day;
	   block33(31); block35(31); block38(31); block44(31); block1666613(31); block1666615(31); block1666617(31); block1666619(31);
	} else {/* Yellow output */}
}

void block32(int _parent_=0)
{
	if (block32==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=32;

	block17(32);
}

void block33(int _parent_=0)
{
	if (block33==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=33;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_value(_TakeSpreadsIntoAccountTheCorrectWay);
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   bool Ro=_boolean(true);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo==Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro==Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block34(33);} else if (o2==true) {/* Yellow output */}
}
bool _boolean(bool Boolean) {
	return(Boolean);
}

void block34(int _parent_=0)
{
	if (block34==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=34;

	string BlockID="24,25"; // Block IDs to turn ON

	static string blocks_raw="";
	static string blocks[];
	static bool turns[];
	static int count=0;
	int i=0;

	if (blocks_raw!=BlockID) {
	   blocks_raw=BlockID;
	   StringExplode(",",BlockID,blocks);
	   count=ArraySize(blocks);
	   ArrayResize(turns,count);
	   ArrayInitialize(turns,false);
	   for (i=0; i<count; i++) {
	      blocks[i]=StringTrimLeft(blocks[i]);
	      blocks[i]=StringTrimRight(blocks[i]);
	   }
	}

	for (i=0; i<count; i++) {
	   if (turns[i]==false) {
	      Print("      EA: Block \""+blocks[i]+"\" goes ON");
	      turns[i]=true;
	   }
	   fxD_BlocksLookupTable(1,blocks[i],true);
	}
	/* Orange output */
}

void block35(int _parent_=0)
{
	if (block35==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=35;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_value(_TakeSpreadsIntoAccountTheMax_PipsWay);
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   bool Ro=_boolean(true);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo==Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro==Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block36(35);} else if (o2==true) {/* Yellow output */}
}

void block36(int _parent_=0)
{
	if (block36==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=36;

	string BlockID="9,10,21,29,22,27"; // Block IDs to turn ON

	static string blocks_raw="";
	static string blocks[];
	static bool turns[];
	static int count=0;
	int i=0;

	if (blocks_raw!=BlockID) {
	   blocks_raw=BlockID;
	   StringExplode(",",BlockID,blocks);
	   count=ArraySize(blocks);
	   ArrayResize(turns,count);
	   ArrayInitialize(turns,false);
	   for (i=0; i<count; i++) {
	      blocks[i]=StringTrimLeft(blocks[i]);
	      blocks[i]=StringTrimRight(blocks[i]);
	   }
	}

	for (i=0; i<count; i++) {
	   if (turns[i]==false) {
	      Print("      EA: Block \""+blocks[i]+"\" goes ON");
	      turns[i]=true;
	   }
	   fxD_BlocksLookupTable(1,blocks[i],true);
	}
	block37(36);
}

void block37(int _parent_=0)
{
	if (block37==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=37;

	string BlockID="13,32"; // Block ID to turn OFF

	static string blocks_raw="";
	static string blocks[];
	static bool turns[];
	static int count=0;
	int i=0;

	if (blocks_raw!=BlockID) {
	   blocks_raw=BlockID;
	   StringExplode(",",BlockID,blocks);
	   count=ArraySize(blocks);
	   ArrayResize(turns,count);
	   ArrayInitialize(turns,false);
	   for (i=0; i<count; i++) {
	      blocks[i]=StringTrimLeft(blocks[i]);
	      blocks[i]=StringTrimRight(blocks[i]);
	   }
	}

	for (i=0; i<count; i++) {
	   if (turns[i]==false) {
	      Print("      EA: Block \""+blocks[i]+"\" goes OFF");
	      turns[i]=true;
	   }
	   fxD_BlocksLookupTable(1,blocks[i],false);
	}
	/* Orange output */
}

void block38(int _parent_=0)
{
	if (block38==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=38;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_value(_UsePrevCandlesBearishBullishFilter);
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   bool Ro=_boolean(false);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo==Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro==Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block39(38);} else if (o2==true) {/* Yellow output */}
}

void block39(int _parent_=0)
{
	if (block39==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=39;

	string BlockID="23"; // Block IDs to turn ON

	static string blocks_raw="";
	static string blocks[];
	static bool turns[];
	static int count=0;
	int i=0;

	if (blocks_raw!=BlockID) {
	   blocks_raw=BlockID;
	   StringExplode(",",BlockID,blocks);
	   count=ArraySize(blocks);
	   ArrayResize(turns,count);
	   ArrayInitialize(turns,false);
	   for (i=0; i<count; i++) {
	      blocks[i]=StringTrimLeft(blocks[i]);
	      blocks[i]=StringTrimRight(blocks[i]);
	   }
	}

	for (i=0; i<count; i++) {
	   if (turns[i]==false) {
	      Print("      EA: Block \""+blocks[i]+"\" goes ON");
	      turns[i]=true;
	   }
	   fxD_BlocksLookupTable(1,blocks[i],true);
	}
	block40(39);
}

void block40(int _parent_=0)
{
	if (block40==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=40;

	string BlockID="4,48"; // Block ID to turn OFF

	static string blocks_raw="";
	static string blocks[];
	static bool turns[];
	static int count=0;
	int i=0;

	if (blocks_raw!=BlockID) {
	   blocks_raw=BlockID;
	   StringExplode(",",BlockID,blocks);
	   count=ArraySize(blocks);
	   ArrayResize(turns,count);
	   ArrayInitialize(turns,false);
	   for (i=0; i<count; i++) {
	      blocks[i]=StringTrimLeft(blocks[i]);
	      blocks[i]=StringTrimRight(blocks[i]);
	   }
	}

	for (i=0; i<count; i++) {
	   if (turns[i]==false) {
	      Print("      EA: Block \""+blocks[i]+"\" goes OFF");
	      turns[i]=true;
	   }
	   fxD_BlocksLookupTable(1,blocks[i],false);
	}
	/* Orange output */
}

void block41(int _parent_=0)
{
	if (block41==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=41;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_prices("BID", 0, CurrentSymbol());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_iMA(_MA1Period, 0, MODE_SMA, PRICE_CLOSE, CurrentSymbol(), CurrentTimeframe(), 0);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo>Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro>Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block47(41);} else if (o2==true) {/* Yellow output */}
}
double _prices(string Price, int TickID, string SYMBOL) {
	double retval=0;
	TickID=TickID+IndicatorMoreShift();
	if (Price=="ASK")       {retval=TicksData(SYMBOL,MODE_ASK,TickID);}
	else if (Price=="BID")  {retval=TicksData(SYMBOL,MODE_BID,TickID);}
	else if (Price=="MID")  {retval=((TicksData(SYMBOL,MODE_ASK,TickID)+TicksData(SYMBOL,MODE_BID,TickID))/2);}
	return(retval);
}
double _iMA(int MAperiod, int MAshift, int MAmethod, int AppliedPrice, string SYMBOL, int TIMEFRAME, int SHIFT) {
	SHIFT=SHIFT+IndicatorMoreShift();
	double retval=iMA(SYMBOL,TIMEFRAME,MAperiod,MAshift,MAmethod,AppliedPrice,SHIFT);
	SetLastIndicatorData(retval,SYMBOL,TIMEFRAME,SHIFT);
	return(retval);
}

void block42(int _parent_=0)
{
	if (block42==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=42;

	block41(42); block43(42); block49(42);
}

void block43(int _parent_=0)
{
	if (block43==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=43;

	block30(43);
}

void block44(int _parent_=0)
{
	if (block44==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=44;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_value(_UseMATrendFilter);
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   bool Ro=_boolean(true);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo==Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro==Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block45(44);} else if (o2==true) {/* Yellow output */}
}

void block45(int _parent_=0)
{
	if (block45==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=45;

	string BlockID="41,49"; // Block IDs to turn ON

	static string blocks_raw="";
	static string blocks[];
	static bool turns[];
	static int count=0;
	int i=0;

	if (blocks_raw!=BlockID) {
	   blocks_raw=BlockID;
	   StringExplode(",",BlockID,blocks);
	   count=ArraySize(blocks);
	   ArrayResize(turns,count);
	   ArrayInitialize(turns,false);
	   for (i=0; i<count; i++) {
	      blocks[i]=StringTrimLeft(blocks[i]);
	      blocks[i]=StringTrimRight(blocks[i]);
	   }
	}

	for (i=0; i<count; i++) {
	   if (turns[i]==false) {
	      Print("      EA: Block \""+blocks[i]+"\" goes ON");
	      turns[i]=true;
	   }
	   fxD_BlocksLookupTable(1,blocks[i],true);
	}
	block46(45);
}

void block46(int _parent_=0)
{
	if (block46==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=46;

	string BlockID="43"; // Block ID to turn OFF

	static string blocks_raw="";
	static string blocks[];
	static bool turns[];
	static int count=0;
	int i=0;

	if (blocks_raw!=BlockID) {
	   blocks_raw=BlockID;
	   StringExplode(",",BlockID,blocks);
	   count=ArraySize(blocks);
	   ArrayResize(turns,count);
	   ArrayInitialize(turns,false);
	   for (i=0; i<count; i++) {
	      blocks[i]=StringTrimLeft(blocks[i]);
	      blocks[i]=StringTrimRight(blocks[i]);
	   }
	}

	for (i=0; i<count; i++) {
	   if (turns[i]==false) {
	      Print("      EA: Block \""+blocks[i]+"\" goes OFF");
	      turns[i]=true;
	   }
	   fxD_BlocksLookupTable(1,blocks[i],false);
	}
	/* Orange output */
}

void block47(int _parent_=0)
{
	if (block47==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=47;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_prices("BID", 0, CurrentSymbol());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_iMA(_MA2Period, 0, MODE_SMA, PRICE_CLOSE, CurrentSymbol(), CurrentTimeframe(), 0);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo>Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro>Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block4(47);} else if (o2==true) {/* Yellow output */}
}

void block48(int _parent_=0)
{
	if (block48==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=48;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_candles("iClose", "id", 2, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_candles("iOpen", "id", 2, "00:00", CurrentSymbol(), CurrentTimeframe());
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo<Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro<Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {/* Orange output */} else if (o2==true) {block6(48);}
}

void block49(int _parent_=0)
{
	if (block49==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=49;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_prices("ASK", 0, CurrentSymbol());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_iMA(_MA1Period, 0, MODE_SMA, PRICE_CLOSE, CurrentSymbol(), CurrentTimeframe(), 0);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo<Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro<Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block55(49);} else if (o2==true) {/* Yellow output */}
}

void block55(int _parent_=0)
{
	if (block55==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=55;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_prices("ASK", 0, CurrentSymbol());
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   double Ro=_iMA(_MA2Period, 0, MODE_SMA, PRICE_CLOSE, CurrentSymbol(), CurrentTimeframe(), 0);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo<Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro<Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block48(55);} else if (o2==true) {/* Yellow output */}
}

void block57(int _parent_=0)
{
	if (block57==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=57;

	block62(57);
}

void block58(int _parent_=0)
{
	if (block58==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=58;

	double Lo=_fResults(Result13);
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_fResults(Result26);
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result58=(Lo + Ro);

	block63(58);
}

void block59(int _parent_=0)
{
	if (block59==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=59;

	double Lo=_fResults(Result12);
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_fResults(Result27);
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result59=(Lo - Ro);

	block66(59);
}

void block60(int _parent_=0)
{
	if (block60==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=60;

	double Lo=_fResults(Result12);
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_fResults(Result19);
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result60=(Lo - Ro);

	block64(60);
}

void block61(int _parent_=0)
{
	if (block61==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=61;

	double Lo=_fResults(Result11);
	if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	double Ro=_fResults(Result26);
	if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	Result61=(Lo + Ro);

	block65(61);
}

void block62(int _parent_=0)
{
	if (block62==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=62;

	string SYMBOL=CurrentSymbol(); // Market (empty=Current)
	int TIMEFRAME=CurrentTimeframe(); // Timeframe
	int PassMaxTimes=1; // Max. times to pass

	static int times = 0;
	static datetime time0;
	datetime time=iTime(SYMBOL,TIMEFRAME,0);
	if (time0<time)
	{
	   times++;
	   if (times >= PassMaxTimes)
	   {
	      time0=time;
	      times=0;
	   }

	   block42(62);
	}
	else {/* Yellow output */}
}

void block63(int _parent_=0)
{
	if (block63==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=63;

	string SYMBOL=CurrentSymbol(); // Market (empty=Current)
	int TIMEFRAME=CurrentTimeframe(); // Timeframe
	int PassMaxTimes=1; // Max. times to pass

	static int times = 0;
	static datetime time0;
	datetime time=iTime(SYMBOL,TIMEFRAME,0);
	if (time0<time)
	{
	   times++;
	   if (times >= PassMaxTimes)
	   {
	      time0=time;
	      times=0;
	   }

	   block1666607(63); block1666609(63);
	}
	else {/* Yellow output */}
}

void block64(int _parent_=0)
{
	if (block64==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=64;

	string SYMBOL=CurrentSymbol(); // Market (empty=Current)
	int TIMEFRAME=CurrentTimeframe(); // Timeframe
	int PassMaxTimes=1; // Max. times to pass

	static int times = 0;
	static datetime time0;
	datetime time=iTime(SYMBOL,TIMEFRAME,0);
	if (time0<time)
	{
	   times++;
	   if (times >= PassMaxTimes)
	   {
	      time0=time;
	      times=0;
	   }

	   block1666608(64); block1666612(64);
	}
	else {/* Yellow output */}
}

void block65(int _parent_=0)
{
	if (block65==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=65;

	string SYMBOL=CurrentSymbol(); // Market (empty=Current)
	int TIMEFRAME=CurrentTimeframe(); // Timeframe
	int PassMaxTimes=1; // Max. times to pass

	static int times = 0;
	static datetime time0;
	datetime time=iTime(SYMBOL,TIMEFRAME,0);
	if (time0<time)
	{
	   times++;
	   if (times >= PassMaxTimes)
	   {
	      time0=time;
	      times=0;
	   }

	   block1666607(65); block1666610(65);
	}
	else {/* Yellow output */}
}

void block66(int _parent_=0)
{
	if (block66==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=66;

	string SYMBOL=CurrentSymbol(); // Market (empty=Current)
	int TIMEFRAME=CurrentTimeframe(); // Timeframe
	int PassMaxTimes=1; // Max. times to pass

	static int times = 0;
	static datetime time0;
	datetime time=iTime(SYMBOL,TIMEFRAME,0);
	if (time0<time)
	{
	   times++;
	   if (times >= PassMaxTimes)
	   {
	      time0=time;
	      times=0;
	   }

	   block1666608(66); block1666611(66);
	}
	else {/* Yellow output */}
}

void block1666538(int _parent_=0)
{
	if (block1666538==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666538;

	Alert (Symbol()+": Sell Alert!");
	/* Orange output */
}

void block1666570(int _parent_=0)
{
	if (block1666570==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666570;

	SendNotification(Symbol()+": Sell Alert!");
	/* Orange output */
}

void block1666571(int _parent_=0)
{
	if (block1666571==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666571;

	SendMail(Symbol()+": Sell Alert!",Symbol()+": Sell Alert!");
	/* Orange output */
}

void block1666573(int _parent_=0)
{
	if (block1666573==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666573;

	Alert (Symbol()+": Buy Alert!");
	/* Orange output */
}

void block1666605(int _parent_=0)
{
	if (block1666605==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666605;

	SendNotification(Symbol()+": Buy Alert!");
	/* Orange output */
}

void block1666606(int _parent_=0)
{
	if (block1666606==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666606;

	SendMail(Symbol()+": Buy Alert!",Symbol()+": Buy Alert!");
	/* Orange output */
}

void block1666607(int _parent_=0)
{
	if (block1666607==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666607;

	block1666573(1666607); block1666605(1666607); block1666606(1666607);
}

void block1666608(int _parent_=0)
{
	if (block1666608==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666608;

	block1666538(1666608); block1666570(1666608); block1666571(1666608);
}

void block1666609(int _parent_=0)
{
	if (block1666609==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666609;

	block24(1666609);
}

void block1666610(int _parent_=0)
{
	if (block1666610==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666610;

	block9(1666610);
}

void block1666611(int _parent_=0)
{
	if (block1666611==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666611;

	block10(1666611);
}

void block1666612(int _parent_=0)
{
	if (block1666612==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666612;

	block25(1666612);
}

void block1666613(int _parent_=0)
{
	if (block1666613==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666613;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_value(__SendMT4Alerts);
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   bool Ro=_boolean(true);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo==Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro==Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block1666614(1666613);} else if (o2==true) {/* Yellow output */}
}

void block1666614(int _parent_=0)
{
	if (block1666614==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666614;

	string BlockID="1666573,1666538"; // Block IDs to turn ON

	static string blocks_raw="";
	static string blocks[];
	static bool turns[];
	static int count=0;
	int i=0;

	if (blocks_raw!=BlockID) {
	   blocks_raw=BlockID;
	   StringExplode(",",BlockID,blocks);
	   count=ArraySize(blocks);
	   ArrayResize(turns,count);
	   ArrayInitialize(turns,false);
	   for (i=0; i<count; i++) {
	      blocks[i]=StringTrimLeft(blocks[i]);
	      blocks[i]=StringTrimRight(blocks[i]);
	   }
	}

	for (i=0; i<count; i++) {
	   if (turns[i]==false) {
	      Print("      EA: Block \""+blocks[i]+"\" goes ON");
	      turns[i]=true;
	   }
	   fxD_BlocksLookupTable(1,blocks[i],true);
	}
	/* Orange output */
}

void block1666615(int _parent_=0)
{
	if (block1666615==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666615;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_value(__SendEmailAlerts);
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   bool Ro=_boolean(true);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo==Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro==Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block1666616(1666615);} else if (o2==true) {/* Yellow output */}
}

void block1666616(int _parent_=0)
{
	if (block1666616==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666616;

	string BlockID="1666606,1666571"; // Block IDs to turn ON

	static string blocks_raw="";
	static string blocks[];
	static bool turns[];
	static int count=0;
	int i=0;

	if (blocks_raw!=BlockID) {
	   blocks_raw=BlockID;
	   StringExplode(",",BlockID,blocks);
	   count=ArraySize(blocks);
	   ArrayResize(turns,count);
	   ArrayInitialize(turns,false);
	   for (i=0; i<count; i++) {
	      blocks[i]=StringTrimLeft(blocks[i]);
	      blocks[i]=StringTrimRight(blocks[i]);
	   }
	}

	for (i=0; i<count; i++) {
	   if (turns[i]==false) {
	      Print("      EA: Block \""+blocks[i]+"\" goes ON");
	      turns[i]=true;
	   }
	   fxD_BlocksLookupTable(1,blocks[i],true);
	}
	/* Orange output */
}

void block1666617(int _parent_=0)
{
	if (block1666617==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666617;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_value(__SendPushAlerts);
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   bool Ro=_boolean(true);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo==Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro==Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block1666618(1666617);} else if (o2==true) {/* Yellow output */}
}

void block1666618(int _parent_=0)
{
	if (block1666618==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666618;

	string BlockID="1666605,1666570"; // Block IDs to turn ON

	static string blocks_raw="";
	static string blocks[];
	static bool turns[];
	static int count=0;
	int i=0;

	if (blocks_raw!=BlockID) {
	   blocks_raw=BlockID;
	   StringExplode(",",BlockID,blocks);
	   count=ArraySize(blocks);
	   ArrayResize(turns,count);
	   ArrayInitialize(turns,false);
	   for (i=0; i<count; i++) {
	      blocks[i]=StringTrimLeft(blocks[i]);
	      blocks[i]=StringTrimRight(blocks[i]);
	   }
	}

	for (i=0; i<count; i++) {
	   if (turns[i]==false) {
	      Print("      EA: Block \""+blocks[i]+"\" goes ON");
	      turns[i]=true;
	   }
	   fxD_BlocksLookupTable(1,blocks[i],true);
	}
	/* Orange output */
}

void block1666619(int _parent_=0)
{
	if (block1666619==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666619;

	int crossover=0;
	int crosswidth=1;
	bool o1=false, o2=false;

	for (int i=0; i<=crossover; i++)
	{

	   IndicatorMoreShift(true,i*crosswidth);
	   double Lo=_value(_SendNotificationInsteadOfTrade);
	   if (MathAbs(Lo) == EMPTY_VALUE) {return;}

	   IndicatorMoreShift(true,i*crosswidth);
	   bool Ro=_boolean(true);
	   if (MathAbs(Ro) == EMPTY_VALUE) {return;}

	   if (Lo==Ro) {if(i==0){o1=true;}}else{if(i==0){o2=true;}else{o2=false;}}
	   if (crossover==1) {if (Ro==Lo) {if(i==0){o2=true;}}else{if(i==1){o1=false;}}}
	}
	IndicatorMoreShift(true,0); // reset

	if (o1==true) {block1666621(1666619);} else if (o2==true) {/* Yellow output */}
}

void block1666621(int _parent_=0)
{
	if (block1666621==false || FXD_BREAK==true) {return;}
	FXD_CURRENT_FUNCTION_ID=1666621;

	string BlockID="1666609,1666610,1666611,1666612"; // Block ID to turn OFF

	static string blocks_raw="";
	static string blocks[];
	static bool turns[];
	static int count=0;
	int i=0;

	if (blocks_raw!=BlockID) {
	   blocks_raw=BlockID;
	   StringExplode(",",BlockID,blocks);
	   count=ArraySize(blocks);
	   ArrayResize(turns,count);
	   ArrayInitialize(turns,false);
	   for (i=0; i<count; i++) {
	      blocks[i]=StringTrimLeft(blocks[i]);
	      blocks[i]=StringTrimRight(blocks[i]);
	   }
	}

	for (i=0; i<count; i++) {
	   if (turns[i]==false) {
	      Print("      EA: Block \""+blocks[i]+"\" goes OFF");
	      turns[i]=true;
	   }
	   fxD_BlocksLookupTable(1,blocks[i],false);
	}
	/* Orange output */
}

/************************************************************************************************************************/

/************************************************************************************************************************/

double AccountBalanceAtStart()
{

	static double memory=0;
   if (memory==0) {memory=AccountBalance();}
   return(memory);
}
double AlignLots(double lots, double lowerlots=0, double upperlots=0)
{
	string symbol=GetSymbol();

   double LotStep=MarketInfo(symbol,MODE_LOTSTEP);
   double LotSize=MarketInfo(symbol,MODE_LOTSIZE);
   double MinLots=MarketInfo(symbol,MODE_MINLOT);
   double MaxLots=MarketInfo(symbol,MODE_MAXLOT);
   double margin_required=MarketInfo(symbol,MODE_MARGINREQUIRED);

   lots=MathRound(lots/LotStep)*LotStep;

   if (lots<MinLots) {lots=MinLots;}
   if (lots>MaxLots) {lots=MaxLots;}

   if (lowerlots > 0)
   {
      lowerlots = MathRound(lowerlots/LotStep)*LotStep;
      if (lots < lowerlots) {lots = lowerlots;}
   }
   if (upperlots > 0)
   {
      upperlots = MathRound(upperlots/LotStep)*LotStep;
      if (lots > upperlots) {lots = upperlots;}
   }

   return (lots);
}
double AlignStopLoss(
   string symbol,
   int type,
   double price,
   double sll=0,
   double slp=0,
   bool consider_freezelevel=false
   )
{
   double sl=0;

   if (MathAbs(sll)==EMPTY_VALUE) {sll=0;}
   if (MathAbs(slp)==EMPTY_VALUE) {slp=0;}
   if (sll==0 && slp==0) {return(0);} // no sl - return 0
   if (price<=0) {Print("AlignStopLoss() error: No price entered");return(-1);}

   double point   =MarketInfo(symbol,MODE_POINT);
   double digits  =MarketInfo(symbol,MODE_DIGITS);
   slp=slp*PipValue(symbol)*point;

   int bs=1;
   if (
      type==OP_BUY
      || type==OP_BUYSTOP
      || type==OP_BUYLIMIT
      )
   {
      bs=1;
   }
   else if (
      type==OP_SELL
      || type==OP_SELLSTOP
      || type==OP_SELLLIMIT
      )
   {
      bs=-1;
   }

   double askbid=price;
   double bidask=price;

   if (type==OP_BUY || type==OP_SELL)
   {
      double ask =MarketInfo(symbol,MODE_ASK);
      double bid =MarketInfo(symbol,MODE_BID);

      askbid=ask;
      bidask=bid;
      if (bs<0) {
        askbid=bid;
        bidask=ask;
      }
   }

   if (sll==0 && slp!=0) {sll=price;}

   if (sll>0) {sl=sll-slp*bs;}

   if (sl<0) {return(-1);}

   sl=NormalizeDouble(sl,digits);

   double minstops=MarketInfo(symbol,MODE_STOPLEVEL);
   if (consider_freezelevel==true) {
      int freezelevel=MarketInfo(symbol,MODE_FREEZELEVEL);
      if (freezelevel>minstops) {minstops=freezelevel;}
   }
   minstops=NormalizeDouble(minstops*point,digits);

   double sllimit=bidask-minstops*bs; // SL min price level

   if (sl>0) {
      /*if (sl==askbid)
      {
         sl=0;
      }
      else */
      if ((bs>0 && sl>askbid) || (bs<0 && sl<askbid))
      {
         string abstr="";
         if (bs>0) {abstr="Ask";} else {abstr="Bid";}
         Print(
            "Error: Invalid SL requested (",
            DoubleToStr(sl,digits),
            " for ",abstr," price ",
            askbid,
            ")"
         );
         return(-1);
      }
      else if ((bs>0 && sl>sllimit) || (bs<0 && sl<sllimit))
      {
         if (USE_VIRTUAL_STOPS) {
            return(sl);
         }

         Print(
            "Warning: Too short SL requested (",
            DoubleToStr(sl,digits),
            " or ",
            DoubleToStr(MathAbs(sl-askbid)/point,0),
            " points), minimum will be taken (",
            DoubleToStr(sllimit,digits),
            " or ",
            DoubleToStr(MathAbs(askbid-sllimit)/point,0),
            " points)"
         );
         sl=sllimit;

         return(sl);
      }
   }
   return(sl);
}
double AlignTakeProfit(
   string symbol,
   int type,
   double price,
   double tpl=0,
   double tpp=0,
   bool consider_freezelevel=false
   )
{
   double tp=0;

   if (MathAbs(tpl)==EMPTY_VALUE) {tpl=0;}
   if (MathAbs(tpp)==EMPTY_VALUE) {tpp=0;}
   if (tpl==0 && tpp==0) {return(0);} // no tp - return 0
   if (price<=0) {Print("AlignTakeProfit() error: No price entered");return(-1);}

   double point   =MarketInfo(symbol,MODE_POINT);
   double digits  =MarketInfo(symbol,MODE_DIGITS);
   tpp=tpp*PipValue(symbol)*point;

   int bs=1;
   if (
      type==OP_BUY
      || type==OP_BUYSTOP
      || type==OP_BUYLIMIT
      )
   {
      bs=1;
   }
   else if (
      type==OP_SELL
      || type==OP_SELLSTOP
      || type==OP_SELLLIMIT
      )
   {
      bs=-1;
   }

   double askbid=price;
   double bidask=price;

   if (type==OP_BUY || type==OP_SELL)
   {
      double ask =MarketInfo(symbol,MODE_ASK);
      double bid =MarketInfo(symbol,MODE_BID);

      askbid=ask;
      bidask=bid;
      if (bs<0) {
        askbid=bid;
        bidask=ask;
      }
   }

   if (tpl==0 && tpp!=0) {tpl=price;}

   if (tpl>0) {tp=tpl+tpp*bs;}

   if (tp<0) {return(-1);}

   tp=NormalizeDouble(tp,digits);

   double minstops=MarketInfo(symbol,MODE_STOPLEVEL);
   if (consider_freezelevel==true) {
      int freezelevel=MarketInfo(symbol,MODE_FREEZELEVEL);
      if (freezelevel>minstops) {minstops=freezelevel;}
   }
   minstops=NormalizeDouble(minstops*point,digits);

   double tplimit=bidask+minstops*bs; // TP min price level

   if (tp>0) {
      /*if (tp==askbid)
      {
         tp=0;
      }
      else */
      if ((bs>0 && tp<askbid) || (bs<0 && tp>askbid))
      {
         string abstr="";
         if (bs>0) {abstr="Ask";} else {abstr="Bid";}
         Print(
            "Error: Invalid TP requested (",
            DoubleToStr(tp,digits),
            " for ",abstr," price ",
            askbid,
            ")"
            );
         return(-1);
      }
      else if ((bs>0 && tp<tplimit) || (bs<0 && tp>tplimit))
      {
         if (USE_VIRTUAL_STOPS) {
            return(tp);
         }

         Print(
            "Warning: Too short TP requested (",
            DoubleToStr(tp,digits),
            " or ",
            DoubleToStr(MathAbs(tp-askbid)/point,0),
            " points), minimum will be taken (",
            DoubleToStr(tplimit,digits),
            " or ",
            DoubleToStr(MathAbs(askbid-tplimit)/point,0),
            " points)"
         );
         tp=tplimit;
         return(tp);
      }
   }
   return(tp);
}
int ArraySearch(double &array[], double value)
{
   static bool founded; founded=false;
   static int index;    index=0;
   static int size;
   size=ArraySize(array);

   if (size>0)
   {
   	for (int i=0; i<size; i++)
      {
         if (array[i]==value)
         {
            founded=true;
            index=i;
            break;
         }  
   	}
   }

   if (founded==true) {return (index);} else {return (-1);}
}
int ArraySearch(int &array[], int value)
{
   static bool founded; founded=false;
   static int index;    index=0;
   static int size;
   size=ArraySize(array);

   if (size>0)
   {
      for (int i=0; i<size; i++)
      {
         if (array[i]==value)
         {
            founded=true;
            index=i;
            break;
         }  
   	}
   }

   if (founded==true) {return (index);} else {return (-1);}
}
int ArraySearch(string &array[], string value)
{
   static bool founded; founded=false;
   static int index;    index=0;
   static int size;
   size=ArraySize(array);

   if (size>0)
   {
      for (int i=0; i<size; i++)
      {
         if (array[i]==value)
         {
            founded=true;
            index=i;
            break;
         }  
   	}
   }

   if (founded==true) {return (index);} else {return (-1);}
}
bool ArrayStrip(double &array[], double value)
{
   bool stripped=false;
   int size=ArraySize(array);
   if (size>0)
   {
      int i=0; int x=0;
      for (i=0; i<size; i++)
      {
         if (array[i]!=value)
         {
            array[x]=array[i];
            x++;
         } else {
            stripped=true;  
         }
      }
      ArrayResize(array,x);
   }
   return (stripped);
}
bool ArrayStripKey(double &array[], double key)
{
   static bool stripped; stripped=false;
   static int size;
   size = ArraySize(array);
   if (size>0)
   {
      int i=0; int x=0;
      for (i=0; i<size; i++)
      {
         if (i!=key)
         {
            array[x]=array[i];
            x++;
         } else {
            stripped=true;  
         }
      }
      ArrayResize(array,x);
   }
   return (stripped);
}
bool ArrayStripKey(int &array[], int key)
{
   static bool stripped; stripped=false;
   static int size;
   size = ArraySize(array);
   if (size>0)
   {
      int i=0; int x=0;
      for (i=0; i<size; i++)
      {
         if (i!=key)
         {
            array[x]=array[i];
            x++;
         } else {
            stripped=true;  
         }
      }
      ArrayResize(array,x);
   }
   return (stripped);
}
bool ArrayStripKey(string &array[], string key)
{
   static bool stripped; stripped=false;
   static int size;
   size = ArraySize(array);
   if (size>0)
   {
      int i=0; int x=0;
      for (i=0; i<size; i++)
      {
         if (i!=key)
         {
            array[x]=array[i];
            x++;
         } else {
            stripped=true;  
         }
      }
      ArrayResize(array,x);
   }
   return (stripped);
}
bool ArrayValue(double &array[], double value)
{
   bool founded=false;
   int size=ArraySize(array);
   for (int i=0; i<size; i++) {
      if (array[i]==value) {founded=true; break;}
   }
   if (founded==false) {
      ArrayResize(array,size+1);
      array[size]=value;
      return (true);
   } else {
      return (false);
   }
}
bool ArrayValue(int &array[], int value)
{
   bool founded=false;
   int size=ArraySize(array);
   for (int i=0; i<size; i++) {
      if (array[i]==value) {founded=true; break;}
   }
   if (founded==false) {
      ArrayResize(array,size+1);
      array[size]=value;
      return (true);
   } else {
      return (false);
   }
}
bool ArrayValue(string &array[], string value)
{
   bool founded=false;
   int size=ArraySize(array);
   for (int i=0; i<size; i++) {
      if (array[i]==value) {founded=true; break;}
   }
   if (founded==false) {
      ArrayResize(array,size+1);
      array[size]=value;
      return (true);
   } else {
      return (false);  
   }
}
double attrClosePrice(string sel="")
{
   return(OrderClosePrice());
}
datetime attrCloseTime(string sel="")
{
   return(OrderCloseTime());
}
string attrComment(string sel="")
{
   return(OrderComment());
}
double attrCommission(string sel="")
{
   if (sel=="e" || sel=="event") {return(e_attrCommission());}
   return(OrderCommission());
}
datetime attrExpiration(string sel="")
{
   return(OrderExpiration());
}
double attrLots(string sel="")
{
   return(OrderLots());
}
int attrMagicNumber(string sel="")
{
   return(OrderMagicNumber());
}
double attrOpenPrice(string sel="")
{
   return(OrderOpenPrice());
}
datetime attrOpenTime(string sel="")
{
   return(OrderOpenTime());
}
double attrProfit(string sel="")
{
   return(OrderProfit());
}
double attrStopLoss()
{
   if (USE_VIRTUAL_STOPS) {return(VirtualStopsDriver("get sl",OrderTicket()));}
   return(OrderStopLoss());
}
double attrSwap(string sel="")
{
   return(OrderSwap());
}
string attrSymbol(string sel="")
{
   return(OrderSymbol());
}
double attrTakeProfit()
{
   if (USE_VIRTUAL_STOPS) {return(VirtualStopsDriver("get tp",OrderTicket()));}
   return(OrderTakeProfit());
}
int attrTicket()
{
   return(OrderTicket());
}
double attrType(string sel="")
{
   return(OrderType());
}
int BuyLater(
   string symbol,
   double lots,
   double price,
   double sll=0, // SL level
   double tpl=0, // TO level
   double slp=0, // SL adjust in points
   double tpp=0, // TP adjust in points
   double slippage=0,
   datetime expiration=0,
   int magic=0,
   string comment="",
   color arrowcolor=CLR_NONE,
   bool oco = false
   )
{
   double ask=MarketInfo(symbo

Показано первые 50% кода (символов: 136180)

Открыть по тарифу

Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.

Разовая покупка файла

На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.

Чтобы оформить заказ, введите email и перейдите к оплате.

Стоимость полного кода
13 618₽ ≈ $166.44