#property copyright "Copyright © 2008, Zen Success Pte Ltd" #property link "www.ForexZen.com" extern string StrategySettings = "********** Strategy Settings **********"; extern bool EntryByStrategy = TRUE; extern bool BuyCycle = TRUE; extern bool SellCycle = TRUE; extern bool Contrarian = FALSE; extern int BuyStrategySelector = 4; extern int SellStrategySelector = 4; extern double ManualBuyPositionLevel = 0.0; extern int ManualBuySpacing = 20; extern double ManualSellPositionLevel = 0.0; extern int ManualSellSpacing = 20; extern bool ManualShutdown = FALSE; extern bool TimeHibernation = FALSE; extern bool EquityHibernation = TRUE; extern double EquityTarget = 30000.0; extern int PivotFirstSpacing = 20; extern int PivotSecondSpacing = 20; extern string PivotTimeFrame = "D1"; extern int PivotShift = 1; extern string BoxStartTime = "00:00"; extern string BoxEndTime = "05:30"; extern int BoxFirstSpacing = 15; extern int BoxSecondSpacing = 30; extern string PriceChannelTimeFrame = "H1"; extern int PriceChannelPeriod = 4; extern int PriceChannelShift = 2; extern string CandleStickPatternTimeFrame = "H1"; extern string FractalTimeFrame = "H1"; extern int FractalShift = 1; extern int FractalFirstSpacing = 20; extern int FractalSecondSpacing = 20; extern int FibFirstSpacing = 15; extern int FibSecondSpacing = 30; extern int CamBFirstSpacing = 15; extern int CamBSecondSpacing = 30; extern string SDRTimeFrame = "H1"; extern int SDRPeriod = 24; extern double SDRBuyLevelPercent = 20.0; extern double SDRSellLevelPercent = 20.0; extern double SDRBuyStopPercent = 20.0; extern double SDRSellStopPercent = 20.0; extern double SDRBuyTakeProfitPercent = 100.0; extern double SDRSellTakeProfitPercent = 100.0; extern int StrongLevelFirstSpacing = 0; extern int StrongLevelSecondSpacing = 20; extern string TradingStartTime = "00:00"; extern string TradingEndTime = "23:45"; extern bool TradeOnMonday = TRUE; extern bool TradeOnTuesday = TRUE; extern bool TradeOnWednesday = TRUE; extern bool TradeOnThursday = TRUE; extern bool TradeOnFriday = TRUE; extern string EntryPeriodTimeFrame = "M15"; extern string ExitPeriodTimeFrame = "M15"; extern string MajorTrendTimeFrame = "H1"; extern int MajorTrendIndicator = 3; extern string MinorTrendTimeFrame = "M15"; extern int MinorTrendIndicator = 1; extern string ExitSignalTimeFrame = "M15"; extern int ExitSignalIndicator = 1; extern int Delay = 1; extern string ExposureManagement = "********** Active Exposure Management **********"; extern bool ActiveExposureManagement = TRUE; extern double MaxStakePercent = 100.0; extern int TakeProfitRange = 100; extern double BuyTargetProfitPercent = 0.5; extern double SellTargetProfitPercent = 0.5; extern double WinModifierPercent = 50.0; extern double WinWeightagePercent = 3.0; extern double LossModifierPercent = -50.0; extern double LossWeightagePercent = -3.0; extern int ExposureModifier = 0; extern int StreakNullifier = 5; extern bool Compound = TRUE; extern int BuyTakeProfit = 100; extern int BuyStopLoss = 100; extern int SellTakeProfit = 100; extern int SellStopLoss = 100; extern int ProfitBuffer = 100; extern int LossBuffer = 60; extern int ProfitBufferModifier = 0; extern int LossBufferModifier = 0; extern int BreakEvenCount = 100; extern int BreakEvenStop = 30; extern double BreakEvenBiasPercent = 0.1; extern bool SignalSecureProfit = FALSE; extern bool SignalSecureLoss = FALSE; extern bool SoftTakeProfit = TRUE; extern bool SoftStopLoss = FALSE; extern bool AutoTakeProfit = FALSE; extern bool AutoStopLoss = TRUE; extern bool DynamicTakeProfit = FALSE; extern bool DynamicStopLoss = FALSE; extern bool ExitByEndHour = FALSE; extern bool ExitByEndofWeek = FALSE; extern bool DeletePendingOrder = TRUE; extern bool LossLimiter = FALSE; extern double DesignLimitPercent = 5.0; extern int MaxLossCount = 20; extern string AccountManagement = "********** Account and Capital Management **********"; extern double Capital = 5000.0; extern double EquityFacility = 0.0; extern int SpreadLimit = 0; extern double MinLotSize = 0.0; extern double MaxLotSize = 0.0; extern double LotStep = 0.0; extern double CurrencyLotSize = 0.0; extern int Slippage = 3; extern string SymbolSuffix = "m"; extern bool ResetCapital = FALSE; extern int SeedMagicNumber = 2121; extern string TabID = ""; extern string DisplayAndCommentary = "********** Commentary and Display **********"; extern bool DisplayCommentary = TRUE; extern bool DisplayArrows = TRUE; extern bool DisplayIndicators = FALSE; extern bool DeleteObjects = FALSE; int g_magic_720; int g_magic_724; int g_magic_728; int g_magic_732; bool gi_736 = TRUE; double gd_740 = 30000.0; int gi_748 = 60; int gi_752 = 0; int gi_756 = 0; double gd_760; int gi_768 = 0; int gi_772 = 0; int gi_776 = 0; int gi_780 = 0; double gda_784[][6]; bool g_spread_788; double gd_792; double gd_800; double gd_808; int gi_816; int gi_820; int gi_824; int gi_828; double gd_832; double gd_840; bool gi_848 = TRUE; int g_file_852; int g_count_860; int g_count_864; int gi_868; int gi_872; int g_period_876 = 6; int gi_880 = 15; double gd_884 = 2.0; int g_period_892 = 20; double gd_896 = 2.0; int init() { g_magic_720 = SeedMagicNumber; g_magic_724 = SeedMagicNumber + 1; g_magic_728 = SeedMagicNumber + 2; g_magic_732 = SeedMagicNumber + 3; if (Symbol() == "USDJPY" || Symbol() == "USDJPY" + SymbolSuffix || Symbol() == "EURJPY" || Symbol() == "EURJPY" + SymbolSuffix || Symbol() == "GBPJPY" || Symbol() == "GBPJPY" + SymbolSuffix || Symbol() == "CHFJPY" || Symbol() == "CHFJPY" + SymbolSuffix || Symbol() == "AUDJPY" || Symbol() == "AUDJPY" + SymbolSuffix || Symbol() == "NZDJPY" || Symbol() == "NZDJPY" + SymbolSuffix) { if (MarketInfo(Symbol(), MODE_DIGITS) == 3.0) { gd_760 = 10.0 * MarketInfo(Symbol(), MODE_POINT); Slippage = 10 * Slippage; } } if (Symbol() == "EURUSD" || Symbol() == "EURUSD" + SymbolSuffix || Symbol() == "GBPUSD" || Symbol() == "GBPUSD" + SymbolSuffix || Symbol() == "USDCHF" || Symbol() == "USDCHF" + SymbolSuffix || Symbol() == "USDCAD" || Symbol() == "USDCAD" + SymbolSuffix || Symbol() == "AUDUSD" || Symbol() == "AUDUSD" + SymbolSuffix || Symbol() == "NZDUSD" || Symbol() == "NZDUSD" + SymbolSuffix || Symbol() == "EURGBP" || Symbol() == "EURGBP" + SymbolSuffix || Symbol() == "EURCHF" || Symbol() == "EURCHF" + SymbolSuffix || Symbol() == "EURCAD" || Symbol() == "EURCAD" + SymbolSuffix || Symbol() == "EURAUD" || Symbol() == "EURAUD" + SymbolSuffix || Symbol() == "GBPCHF" || Symbol() == "GBPCHF" + SymbolSuffix || Symbol() == "AUDNZD" || Symbol() == "AUDNZD" + SymbolSuffix || Symbol() == "AUDCAD" || Symbol() == "AUDCAD" + SymbolSuffix) { if (MarketInfo(Symbol(), MODE_DIGITS) == 5.0) { gd_760 = 10.0 * MarketInfo(Symbol(), MODE_POINT); Slippage = 10 * Slippage; } } if (ScanLastAccountBalance() > 0.0) gd_840 = ScanLastAccountBalance(); if (MarketInfo(Symbol(), MODE_DIGITS) == 2.0 || MarketInfo(Symbol(), MODE_DIGITS) == 4.0) { gd_760 = 1.0 * MarketInfo(Symbol(), MODE_POINT); Slippage = 1 * Slippage; } if (SignalSecureProfit == FALSE || SignalSecureLoss == FALSE || SoftTakeProfit == FALSE || SoftStopLoss == FALSE || ExitByEndHour == FALSE) { gi_768 = BuyTakeProfit; gi_772 = BuyStopLoss; gi_776 = SellTakeProfit; gi_780 = SellStopLoss; } if (SignalSecureProfit == TRUE || SignalSecureLoss == TRUE || SoftTakeProfit == TRUE || SoftStopLoss == TRUE || ExitByEndHour == TRUE) { gi_768 = BuyTakeProfit; gi_772 = BuyStopLoss; gi_776 = SellTakeProfit; gi_780 = SellStopLoss; } if (ObjectFind("Version") != 0) ObjectDelete("Version"); if (ObjectFind("ODMM") != 0) ObjectDelete("ODMM"); if (ObjectFind("H1 Line") != 0) ObjectDelete("H1 Line"); if (ObjectFind("H1 Label") != 0) ObjectDelete("H1 Label"); if (ObjectFind("H2 Line") != 0) ObjectDelete("H2 Line"); if (ObjectFind("H2 Label") != 0) ObjectDelete("H2 Label"); if (ObjectFind("L1 Line") != 0) ObjectDelete("L1 Line"); if (ObjectFind("L1 Label") != 0) ObjectDelete("L1 Label"); if (ObjectFind("L2 Line") != 0) ObjectDelete("L2 Line"); if (ObjectFind("L2 Label") != 0) ObjectDelete("L2 Label"); if (ObjectFind("Expert") != 0) ObjectDelete("Expert"); if (ObjectFind("Authorization") != 0) ObjectDelete("Authorization"); if (ObjectFind("Instrument") != 0) ObjectDelete("Instrument"); if (ObjectFind("DemoAuthorization") != 0) ObjectDelete("DemoAuthorization"); if (ObjectFind("DesignLimit") != 0) ObjectDelete("DesignLimit"); if (ObjectFind("TotalProfit") != 0) ObjectDelete("TotalProfit"); if (ObjectFind("LastProfit") != 0) ObjectDelete("LastProfit"); if (ObjectFind("BuyStake") != 0) ObjectDelete("BuyStake"); if (ObjectFind("SellStake") != 0) ObjectDelete("SellStake"); if (ObjectFind("CurrentPerformance") != 0) ObjectDelete("CurrentPerformance"); if (ObjectFind("CurrentDD") != 0) ObjectDelete("CurrentDD"); if (ObjectFind("Hibernation") != 0) ObjectDelete("Hibernation"); if (ObjectFind("EquityTargetBalance") != 0) ObjectDelete("EquityTargetBalance"); if (ObjectFind("EquityCapBalance") != 0) ObjectDelete("EquityCapBalance"); if (ObjectFind("ManualShut") != 0) ObjectDelete("ManualShut"); if (ObjectFind("CharacterLength") != 0) ObjectDelete("CharacterLength"); gi_848 = TRUE; return (0); } int deinit() { if (DeleteObjects) { ObjectDelete("Expert"); ObjectDelete("Authorization"); ObjectDelete("Instrument"); ObjectDelete("DemoAuthorization"); ObjectDelete("DesignLimit"); ObjectDelete("TotalProfit"); ObjectDelete("LastProfit"); ObjectDelete("BuyStake"); ObjectDelete("SellStake"); ObjectDelete("CurrentPerformance"); ObjectDelete("CurrentDD"); ObjectDelete("Hibernation"); ObjectDelete("EquityTargetBalance"); ObjectDelete("EquityCapBalance"); ObjectDelete("H1 Line"); ObjectDelete("H1 Label"); ObjectDelete("H2 Line"); ObjectDelete("H2 Label"); ObjectDelete("L1 Line"); ObjectDelete("L1 Label"); ObjectDelete("L2 Line"); ObjectDelete("L2 Label"); ObjectDelete("ODMM"); ObjectDelete("Version"); ObjectDelete("ManualShut"); ObjectDelete("CharacterLength"); } if (gi_768 == 0) gi_768 = BuyTakeProfit; if (gi_772 == 0) gi_772 = BuyStopLoss; if (gi_776 == 0) gi_776 = SellTakeProfit; if (gi_780 == 0) gi_780 = SellStopLoss; return (0); } int start() { if (CheckInstrument() != 1) { DisplayText("Instrument", "System does not support this currency pair", "Vernada", 14, Red, 300, 50); if (gi_848) Alert("System does not support this currency pair."); gi_848 = FALSE; return; } if (EntryByStrategy) { if (gi_848) { if (CheckBuyStrategy() != 1) { Alert("Please select a valid BUY Strategy."); return; } if (CheckSellStrategy() != 1) { Alert("Please select a valid SELL Strategy."); return; } } gi_848 = FALSE; } if (LossLimiter) { if (CurrentDrawdownPercent() <= DesignLimitPercent) { DisplayText("DesignLimit", "Drawdown design limit exceeded.", "Vernada", 14, Red, 300, 50); return; } } if (TimeHibernation) { if (ScanBuyOrders() + ScanSellOrders() + ScanBuyPendingOrders() + ScanSellPendingOrders() + ScanConvertedBuyOrders() + ScanConvertedSellOrders() == 0) { DisplayText("Hibernation", "System in hibernation mode.", "Vernada", 14, Red, 300, 50); return; } } if (EquityHibernation) { if (AccountBalance() >= EquityTarget) { DisplayText("EquityTargetBalance", "Equity limit breached. Trading suspended.", "Vernada", 14, Red, 300, 50); return; } } if (gi_736) { if (AccountBalance() >= gd_740) { DisplayText("EquityCapBalance", "Equity Cap limit breached. Trading suspended.", "Vernada", 14, Red, 300, 50); return; } } if (ManualShutdown) { EmergencyExit(); DisplayText("ManualShut", "Manual shutdown activated.", "Vernada", 14, Red, 275, 15); return; } if (ResetCapital) ResetAccountBalance(); if (StringLen(TabID) > 31) { DisplayText("CharacterLength", "Please reduce the number of characters in the TabID field.", "Vernada", 14, Red, 275, 15); return; } if (ScanConsecutiveWinLoss(1) >= BreakEvenCount) { if (CumulativePerformance() + CurrentDrawdownPercent() >= 0.0 && ExitPeriodFilter() == 1) MoveStop(); if (CumulativePerformance() + CurrentDrawdownPercent() >= BreakEvenBiasPercent && ExitPeriodFilter() == 1) CloseDirectOrders(); } if (DeletePendingOrder) if (ScanBuyPendingOrders() != ScanSellPendingOrders()) ClosePendingOrders(); if (CurrentTime() == TradingEndTime) ClosePendingOrders(); if (ExitByEndHour) { if (CurrentTime() == TradingEndTime) { CloseDirectOrders(); CloseConvertedDirectOrders(); } } if (ExitByEndofWeek) { if (DayOfWeek() == 5 && CurrentTime() == "22:00") { CloseDirectOrders(); CloseConvertedDirectOrders(); } } if (ManualBuyPositionLevel > 0.0) { SetLevel("H1", ManualBuyPositionLevel, Blue, STYLE_SOLID, 1, Time[5], Blue); SetLevel("H2", ManualBuyPositionLevel + ManualBuySpacing * gd_760, Blue, STYLE_SOLID, 1, Time[5], Blue); } if (ManualSellPositionLevel > 0.0) { SetLevel("L1", ManualSellPositionLevel, Red, STYLE_SOLID, 1, Time[5], Red); SetLevel("L2", ManualSellPositionLevel - ManualSellSpacing * gd_760, Red, STYLE_SOLID, 1, Time[5], Red); } if (DisplayIndicators) HideTestIndicators(FALSE); else HideTestIndicators(TRUE); if (!EntryByStrategy) { if (!Contrarian) { if (ScanConsecutiveWinLoss(2) == 0) { if (ScanLastOrderType() == 1) { BuyCycle = TRUE; SellCycle = FALSE; } if (ScanLastOrderType() == 0) { BuyCycle = FALSE; SellCycle = TRUE; } } } if (Contrarian) { if (ScanConsecutiveWinLoss(2) > 0) { if (ScanLastOrderType() == 1) { BuyCycle = TRUE; SellCycle = FALSE; } if (ScanLastOrderType() == 0) { BuyCycle = FALSE; SellCycle = TRUE; } } } } if (BuyCycle && !SellCycle) { if (ScanBuyOrders() + ScanSellOrders() + ScanBuyPendingOrders() + ScanSellPendingOrders() + ScanConvertedBuyOrders() + ScanConvertedSellOrders() == 0) { g_file_852 = FileOpen(Symbol() + AccountNumber() + TabID + ".csv", FILE_CSV|FILE_WRITE, ";"); if (ActiveExposureManagement) { if (g_file_852 > 0) { FileWrite(g_file_852, MathMax(gd_840, MaxAccountBalance())); FileClose(g_file_852); } } if (!ActiveExposureManagement) { if (g_file_852 > 0) { FileWrite(g_file_852, AccountBalance()); FileClose(g_file_852); } } if (Symbol() == "EURUSD" || Symbol() == "EURUSD" + SymbolSuffix || Symbol() == "GBPUSD" || Symbol() == "GBPUSD" + SymbolSuffix || Symbol() == "USDCHF" || Symbol() == "USDCHF" + SymbolSuffix || Symbol() == "USDCAD" || Symbol() == "USDCAD" + SymbolSuffix || Symbol() == "AUDUSD" || Symbol() == "AUDUSD" + SymbolSuffix || Symbol() == "NZDUSD" || Symbol() == "NZDUSD" + SymbolSuffix || Symbol() == "EURGBP" || Symbol() == "EURGBP" + SymbolSuffix || Symbol() == "EURCHF" || Symbol() == "EURCHF" + SymbolSuffix || Symbol() == "EURCAD" || Symbol() == "EURCAD" + SymbolSuffix || Symbol() == "EURAUD" || Symbol() == "EURAUD" + SymbolSuffix || Symbol() == "GBPCHF" || Symbol() == "GBPCHF" + SymbolSuffix || Symbol() == "AUDNZD" || Symbol() == "AUDNZD" + SymbolSuffix || Symbol() == "AUDCAD" || Symbol() == "AUDCAD" + SymbolSuffix || Symbol() == "USDJPY" || Symbol() == "USDJPY" + SymbolSuffix || Symbol() == "EURJPY" || Symbol() == "EURJPY" + SymbolSuffix || Symbol() == "GBPJPY" || Symbol() == "GBPJPY" + SymbolSuffix || Symbol() == "CHFJPY" || Symbol() == "CHFJPY" + SymbolSuffix || Symbol() == "AUDJPY" || Symbol() == "AUDJPY" + SymbolSuffix || Symbol() == "NZDJPY" || Symbol() == "NZDJPY" + SymbolSuffix) OpenBuyOrder(); } } if (SignalSecureProfit) { if (EntryByStrategy == FALSE || (EntryByStrategy == TRUE && BuyStrategySelector == 0 || BuyStrategySelector == 1 || BuyStrategySelector == 2 || BuyStrategySelector == 3 || BuyStrategySelector == 4 || BuyStrategySelector == 5 || BuyStrategySelector == 6 || BuyStrategySelector == 7 || BuyStrategySelector == 8 || BuyStrategySelector == 9 || BuyStrategySelector == 10 || BuyStrategySelector == 11 || BuyStrategySelector == 12 || BuyStrategySelector == 13 || BuyStrategySelector == 15 || BuyStrategySelector == 16)) { if (ScanBuyOpenPrice() > 0.0 && GetPrice(1, 0, 0) - Buffer(1) * gd_760 >= ScanBuyOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_BUY && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) if (ExitSignal(ExitSignalTimeFrame) == 2) CloseDirectOrders(); } if (EntryByStrategy == TRUE && BuyStrategySelector == 14) { if (ScanConvertedBuyOpenPrice() > 0.0 && GetPrice(1, 0, 0) - Buffer(1) * gd_760 >= ScanConvertedBuyOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_BUY && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) if (ExitSignal(ExitSignalTimeFrame) == 2) CloseConvertedDirectOrders(); } } if (SoftTakeProfit) { if (EntryByStrategy == FALSE || (EntryByStrategy == TRUE && BuyStrategySelector == 0 || BuyStrategySelector == 1 || BuyStrategySelector == 2 || BuyStrategySelector == 3 || BuyStrategySelector == 4 || BuyStrategySelector == 5 || BuyStrategySelector == 6 || BuyStrategySelector == 7 || BuyStrategySelector == 8 || BuyStrategySelector == 9 || BuyStrategySelector == 10 || BuyStrategySelector == 11 || BuyStrategySelector == 12 || BuyStrategySelector == 13 || BuyStrategySelector == 15 || BuyStrategySelector == 16)) if (ScanBuyOpenPrice() > 0.0 && GetPrice(1, 0, 0) - Buffer(1) * gd_760 >= ScanBuyOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_BUY && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) CloseDirectOrders(); if (EntryByStrategy == TRUE && BuyStrategySelector == 14) { if (ScanConvertedBuyOpenPrice() > 0.0 && GetPrice(1, 0, 0) - Buffer(1) * gd_760 >= ScanConvertedBuyOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_BUY && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) CloseConvertedDirectOrders(); } } if (SignalSecureLoss) { if (EntryByStrategy == FALSE || (EntryByStrategy == TRUE && BuyStrategySelector == 0 || BuyStrategySelector == 1 || BuyStrategySelector == 2 || BuyStrategySelector == 3 || BuyStrategySelector == 4 || BuyStrategySelector == 5 || BuyStrategySelector == 6 || BuyStrategySelector == 7 || BuyStrategySelector == 8 || BuyStrategySelector == 9 || BuyStrategySelector == 10 || BuyStrategySelector == 11 || BuyStrategySelector == 12 || BuyStrategySelector == 13 || BuyStrategySelector == 15 || BuyStrategySelector == 16)) { if (ScanBuyOpenPrice() > 0.0 && GetPrice(1, 0, 0) + Buffer(2) * gd_760 <= ScanBuyOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_BUY && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) if (ExitSignal(ExitSignalTimeFrame) == 2) CloseDirectOrders(); } if (EntryByStrategy == TRUE && BuyStrategySelector == 14) { if (ScanConvertedBuyOpenPrice() > 0.0 && GetPrice(1, 0, 0) + Buffer(2) * gd_760 <= ScanConvertedBuyOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_BUY && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) if (ExitSignal(ExitSignalTimeFrame) == 2) CloseConvertedDirectOrders(); } } if (SoftStopLoss) { if (EntryByStrategy == FALSE || (EntryByStrategy == TRUE && BuyStrategySelector == 0 || BuyStrategySelector == 1 || BuyStrategySelector == 2 || BuyStrategySelector == 3 || BuyStrategySelector == 4 || BuyStrategySelector == 5 || BuyStrategySelector == 6 || BuyStrategySelector == 7 || BuyStrategySelector == 8 || BuyStrategySelector == 9 || BuyStrategySelector == 10 || BuyStrategySelector == 11 || BuyStrategySelector == 12 || BuyStrategySelector == 13 || BuyStrategySelector == 15 || BuyStrategySelector == 16)) if (ScanBuyOpenPrice() > 0.0 && GetPrice(1, 0, 0) + Buffer(2) * gd_760 <= ScanBuyOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_BUY && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) CloseDirectOrders(); if (EntryByStrategy == TRUE && BuyStrategySelector == 14) { if (ScanConvertedBuyOpenPrice() > 0.0 && GetPrice(1, 0, 0) + Buffer(2) * gd_760 <= ScanConvertedBuyOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_BUY && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) CloseConvertedDirectOrders(); } } if (SellCycle && !BuyCycle) { if (ScanBuyOrders() + ScanSellOrders() + ScanBuyPendingOrders() + ScanSellPendingOrders() + ScanConvertedBuyOrders() + ScanConvertedSellOrders() == 0) { g_file_852 = FileOpen(Symbol() + AccountNumber() + TabID + ".csv", FILE_CSV|FILE_WRITE, ";"); if (ActiveExposureManagement) { if (g_file_852 > 0) { FileWrite(g_file_852, MathMax(gd_840, MaxAccountBalance())); FileClose(g_file_852); } } if (!ActiveExposureManagement) { if (g_file_852 > 0) { FileWrite(g_file_852, AccountBalance()); FileClose(g_file_852); } } if (Symbol() == "EURUSD" || Symbol() == "EURUSD" + SymbolSuffix || Symbol() == "GBPUSD" || Symbol() == "GBPUSD" + SymbolSuffix || Symbol() == "USDCHF" || Symbol() == "USDCHF" + SymbolSuffix || Symbol() == "USDCAD" || Symbol() == "USDCAD" + SymbolSuffix || Symbol() == "AUDUSD" || Symbol() == "AUDUSD" + SymbolSuffix || Symbol() == "NZDUSD" || Symbol() == "NZDUSD" + SymbolSuffix || Symbol() == "EURGBP" || Symbol() == "EURGBP" + SymbolSuffix || Symbol() == "EURCHF" || Symbol() == "EURCHF" + SymbolSuffix || Symbol() == "EURCAD" || Symbol() == "EURCAD" + SymbolSuffix || Symbol() == "EURAUD" || Symbol() == "EURAUD" + SymbolSuffix || Symbol() == "GBPCHF" || Symbol() == "GBPCHF" + SymbolSuffix || Symbol() == "AUDNZD" || Symbol() == "AUDNZD" + SymbolSuffix || Symbol() == "AUDCAD" || Symbol() == "AUDCAD" + SymbolSuffix || Symbol() == "USDJPY" || Symbol() == "USDJPY" + SymbolSuffix || Symbol() == "EURJPY" || Symbol() == "EURJPY" + SymbolSuffix || Symbol() == "GBPJPY" || Symbol() == "GBPJPY" + SymbolSuffix || Symbol() == "CHFJPY" || Symbol() == "CHFJPY" + SymbolSuffix || Symbol() == "AUDJPY" || Symbol() == "AUDJPY" + SymbolSuffix || Symbol() == "NZDJPY" || Symbol() == "NZDJPY" + SymbolSuffix) OpenSellOrder(); } } if (SignalSecureProfit) { if (EntryByStrategy == FALSE || (EntryByStrategy == TRUE && SellStrategySelector == 0 || SellStrategySelector == 1 || SellStrategySelector == 2 || SellStrategySelector == 3 || SellStrategySelector == 4 || SellStrategySelector == 5 || SellStrategySelector == 6 || SellStrategySelector == 7 || SellStrategySelector == 8 || SellStrategySelector == 9 || SellStrategySelector == 10 || SellStrategySelector == 11 || SellStrategySelector == 12 || SellStrategySelector == 13 || SellStrategySelector == 15 || SellStrategySelector == 16)) { if (ScanSellOpenPrice() > 0.0 && GetPrice(2, 0, 0) + Buffer(1) * gd_760 <= ScanSellOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_SELL && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) if (ExitSignal(ExitSignalTimeFrame) == 1) CloseDirectOrders(); } if (EntryByStrategy == TRUE && SellStrategySelector == 14) { if (ScanConvertedSellOpenPrice() > 0.0 && GetPrice(2, 0, 0) + Buffer(1) * gd_760 <= ScanConvertedSellOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_SELL && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) if (ExitSignal(ExitSignalTimeFrame) == 1) CloseConvertedDirectOrders(); } } if (SoftTakeProfit) { if (EntryByStrategy == FALSE || (EntryByStrategy == TRUE && SellStrategySelector == 0 || SellStrategySelector == 1 || SellStrategySelector == 2 || SellStrategySelector == 3 || SellStrategySelector == 4 || SellStrategySelector == 5 || SellStrategySelector == 6 || SellStrategySelector == 7 || SellStrategySelector == 8 || SellStrategySelector == 9 || SellStrategySelector == 10 || SellStrategySelector == 11 || SellStrategySelector == 12 || SellStrategySelector == 13 || SellStrategySelector == 15 || SellStrategySelector == 16)) if (ScanSellOpenPrice() > 0.0 && GetPrice(2, 0, 0) + Buffer(1) * gd_760 <= ScanSellOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_SELL && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) CloseDirectOrders(); if (EntryByStrategy == TRUE && SellStrategySelector == 14) { if (ScanConvertedSellOpenPrice() > 0.0 && GetPrice(2, 0, 0) + Buffer(1) * gd_760 <= ScanConvertedSellOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_SELL && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) CloseConvertedDirectOrders(); } } if (SignalSecureLoss) { if (EntryByStrategy == FALSE || (EntryByStrategy == TRUE && SellStrategySelector == 0 || SellStrategySelector == 1 || SellStrategySelector == 2 || SellStrategySelector == 3 || SellStrategySelector == 4 || SellStrategySelector == 5 || SellStrategySelector == 6 || SellStrategySelector == 7 || SellStrategySelector == 8 || SellStrategySelector == 9 || SellStrategySelector == 10 || SellStrategySelector == 11 || SellStrategySelector == 12 || SellStrategySelector == 13 || SellStrategySelector == 15 || SellStrategySelector == 16)) { if (ScanSellOpenPrice() > 0.0 && GetPrice(2, 0, 0) - Buffer(2) * gd_760 >= ScanSellOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_SELL && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) if (ExitSignal(ExitSignalTimeFrame) == 1) CloseDirectOrders(); } if (EntryByStrategy == TRUE && SellStrategySelector == 14) { if (ScanConvertedSellOpenPrice() > 0.0 && GetPrice(2, 0, 0) - Buffer(2) * gd_760 >= ScanConvertedSellOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_SELL && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) if (ExitSignal(ExitSignalTimeFrame) == 1) CloseConvertedDirectOrders(); } } if (SoftStopLoss) { if (EntryByStrategy == FALSE || (EntryByStrategy == TRUE && SellStrategySelector == 0 || SellStrategySelector == 1 || SellStrategySelector == 2 || SellStrategySelector == 3 || SellStrategySelector == 4 || SellStrategySelector == 5 || SellStrategySelector == 6 || SellStrategySelector == 7 || SellStrategySelector == 8 || SellStrategySelector == 9 || SellStrategySelector == 10 || SellStrategySelector == 11 || SellStrategySelector == 12 || SellStrategySelector == 13 || SellStrategySelector == 15 || SellStrategySelector == 16)) if (ScanSellOpenPrice() > 0.0 && GetPrice(2, 0, 0) - Buffer(2) * gd_760 >= ScanSellOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_SELL && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) CloseDirectOrders(); if (EntryByStrategy == TRUE && SellStrategySelector == 14) { if (ScanConvertedSellOpenPrice() > 0.0 && GetPrice(2, 0, 0) - Buffer(2) * gd_760 >= ScanConvertedSellOpenPrice() && ExitPeriodFilter() == 1 && OrderType() == OP_SELL && StrToTime(CurrentTime()) - ScanOrderOpenTime() >= 60 * Delay) CloseConvertedDirectOrders(); } } if (BuyCycle && SellCycle) { if (ScanBuyOrders() + ScanSellOrders() + ScanBuyPendingOrders() + ScanSellPendingOrders() + ScanConvertedBuyOrders() + ScanConvertedSellOrders() == 0) { g_file_852 = FileOpen(Symbol() + AccountNumber() + TabID + ".csv", FILE_CSV|FILE_WRITE, ";"); if (ActiveExposureManagement) { if (g_file_852 > 0) { FileWrite(g_file_852, MathMax(gd_840, MaxAccountBalance())); FileClose(g_file_852); } } if (!ActiveExposureManagement) { if (g_file_852 > 0) { FileWrite(g_file_852, AccountBalance()); FileClose(g_file_852); } } if (Symbol() == "EURUSD" || Symbol() == "EURUSD" + SymbolSuffix || Symbol() == "GBPUSD" || Symbol() == "GBPUSD" + SymbolSuffix || Symbol() == "USDCHF" || Symbol() == "USDCHF" + SymbolSuffix || Symbol() == "USDCAD" || Symbol() == "USDCAD" + SymbolSuffix || Symbol() == "AUDUSD" || Symbol() == "AUDUSD" + SymbolSuffix || Symbol() == "NZDUSD" || Symbol() == "NZDUSD" + SymbolSuffix || Symbol() == "EURGBP" || Symbol() == "EURGBP" + SymbolSuffix || Symbol() == "EURCHF" || Symbol() == "EURCHF" + SymbolSuffix || Symbol() == "EURCAD" || Symbol() == "EURCAD" + SymbolSuffix || Symbol() == "EURAUD" || Symbol() == "EURAUD" + SymbolSuffix || Symbol() == "GBPCHF" || Symbol() == "GBPCHF" + SymbolSuffix || Symbol() == "AUDNZD" || Symbol() == "AUDNZD" + SymbolSuffix || Symbol() == "AUDCAD" || Symbol() == "AUDCAD" + SymbolSuffix || Symbol() == "USDJPY" || Symbol() == "USDJPY" + SymbolSuffix || Symbol() == "EURJPY" || Symbol() == "EURJPY" + SymbolSuffix || Symbol() == "GBPJPY" || Symbol() == "GBPJPY" + SymbolSuffix || Symbol() == "CHFJPY" || Symbol() == "CHFJPY" + SymbolSuffix || Symbol() == "AUDJPY" || Symbol() == "AUDJPY" + SymbolSuffix || Symbol() == "NZDJPY" || Symbol() == "NZDJPY" + SymbolSuffix) { if (EntryByStrategy == FALSE || (EntryByStrategy == TRUE && BuyStrategySelector == 0 || BuyStrategySelector == 1 || BuyStrategySelector == 2 || BuyStrategySelector == 3 || BuyStrategySelector == 4 || BuyStrategySelector == 5 || BuyStrategySelector == 6 || BuyStrategySelector == 7 || BuyStrategySelector == 8 || BuyStrategySelector == 9 || BuyStrategySelector == 10 || BuyStrategySelector == 11 || BuyStrategySelector == 12 || BuyStrategySelector == 13 || BuyStrategySelector == 15 || BuyStrategySelector == 16)) if (ScanBuyOrders() + ScanSellOrders() + ScanBuyPendingOrders() + ScanSellPendingOrders() + ScanConvertedBuyOrders() + ScanConvertedSellOrders() == 0) OpenBuyOrder(); if (EntryByStrategy == FALSE || (EntryByStrategy == TRUE && SellStrategySelector == 0 || SellStrategySelector == 1 || SellStrategySelector == 2 || SellStrategySelector == 3 || SellStrategySelector == 4 || SellStrategySelector == 5 || SellStrategySelector == 6 || SellStrategySelector == 7 || SellStrategySelector == 8 || SellStrategySelector == 9 || SellStrategySelector == 10 || SellStrategySelector == 11 || SellStrategySelector == 12 || SellStrategySelector == 13 || SellStrategySelector == 15 || SellStrategySelector == 16)) if (ScanBuyOrders() + ScanSellOrders() + ScanBuyPendingOrders() + ScanSellPendingOrders() + ScanConvertedBuyOrders() + ScanConvertedSellOrders() == 0) OpenSellOrder(); if (EntryByStrategy == TRUE && BuyStrategySelector == 14) { if (ScanBuyOrders() + ScanSellOrders() + ScanBuyPendingOrders() + ScanSellPendingOrders() + ScanConvertedBuyOrders() + ScanConvertedSellOrders() == 0) { OpenBuyPendingOrder(); OpenSellPendingOrder(); } } } } } Comments(); return (0); } int CheckInstrument() { bool li_ret_0 = FALSE; if (Symbol() == "EURUSD" || Symbol() == "EURUSD" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "GBPUSD" || Symbol() == "GBPUSD" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "USDCHF" || Symbol() == "USDCHF" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "USDJPY" || Symbol() == "USDJPY" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "EURJPY" || Symbol() == "EURJPY" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "GBPJPY" || Symbol() == "GBPJPY" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "AUDJPY" || Symbol() == "AUDJPY" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "NZDJPY" || Symbol() == "NZDJPY" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "CHFJPY" || Symbol() == "CHFJPY" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "USDCAD" || Symbol() == "USDCAD" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "AUDCAD" || Symbol() == "AUDCAD" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "AUDUSD" || Symbol() == "AUDUSD" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "NZDUSD" || Symbol() == "NZDUSD" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "EURGBP" || Symbol() == "EURGBP" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "EURCAD" || Symbol() == "EURCAD" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "EURAUD" || Symbol() == "EURAUD" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "EURCHF" || Symbol() == "EURCHF" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "GBPCHF" || Symbol() == "GBPCHF" + SymbolSuffix) li_ret_0 = TRUE; if (Symbol() == "AUDCAD" || Symbol() == "AUDCAD" + SymbolSuffix) li_ret_0 = TRUE; return (li_ret_0); } int CheckBuyStrategy() { bool li_ret_0 = FALSE; if (BuyStrategySelector == 0) li_ret_0 = TRUE; if (BuyStrategySelector == 1) li_ret_0 = TRUE; if (BuyStrategySelector == 2) li_ret_0 = TRUE; if (BuyStrategySelector == 3) li_ret_0 = TRUE; if (BuyStrategySelector == 4) li_ret_0 = TRUE; if (BuyStrategySelector == 5) li_ret_0 = TRUE; if (BuyStrategySelector == 6) li_ret_0 = TRUE; if (BuyStrategySelector == 7) li_ret_0 = TRUE; if (BuyStrategySelector == 8) li_ret_0 = TRUE; if (BuyStrategySelector == 9) li_ret_0 = TRUE; if (BuyStrategySelector == 10) li_ret_0 = TRUE; if (BuyStrategySelector == 11) li_ret_0 = TRUE; if (BuyStrategySelector == 14) li_ret_0 = TRUE; if (BuyStrategySelector == 15) li_ret_0 = TRUE; if (BuyStrategySelector == 16) li_ret_0 = TRUE; return (li_ret_0); } int CheckSellStrategy() { bool li_ret_0 = FALSE; if (SellStrategySelector == 0) li_ret_0 = TRUE; if (SellStrategySelector == 1) li_ret_0 = TRUE; if (SellStrategySelector == 2) li_ret_0 = TRUE; if (SellStrategySelector == 3) li_ret_0 = TRUE; if (SellStrategySelector == 4) li_ret_0 = TRUE; if (SellStrategySelector == 5) li_ret_0 = TRUE; if (SellStrategySelector == 6) li_ret_0 = TRUE; if (SellStrategySelector == 7) li_ret_0 = TRUE; if (SellStrategySelector == 8) li_ret_0 = TRUE; if (SellStrategySelector == 9) li_ret_0 = TRUE; if (SellStrategySelector == 10) li_ret_0 = TRUE; if (SellStrategySelector == 11) li_ret_0 = TRUE; if (SellStrategySelector == 14) li_ret_0 = TRUE; if (SellStrategySelector == 15) li_ret_0 = TRUE; if (SellStrategySelector == 16) li_ret_0 = TRUE; return (li_ret_0); } int CheckTradingDays() { bool li_ret_0 = FALSE; if (TradeOnMonday && DayOfWeek() == 1) li_ret_0 = TRUE; if (TradeOnTuesday && DayOfWeek() == 2) li_ret_0 = TRUE; if (TradeOnWednesday && DayOfWeek() == 3) li_ret_0 = TRUE; if (TradeOnThursday && DayOfWeek() == 4) li_ret_0 = TRUE; if (TradeOnFriday && DayOfWeek() == 5) li_ret_0 = TRUE; return (li_ret_0); } int SpreadLimit() { if (MarketInfo(Symbol(), MODE_DIGITS) == 3.0 || MarketInfo(Symbol(), MODE_DIGITS) == 5.0) { if (SpreadLimit <= 0) { if (Symbol() == "EURUSD" || Symbol() == "EURUSD" + SymbolSuffix) return (30); if (Symbol() == "USDJPY" || Symbol() == "USDJPY" + SymbolSuffix) return (40); if (Symbol() == "GBPUSD" || Symbol() == "GBPUSD" + SymbolSuffix) return (50); if (Symbol() == "USDCHF" || Symbol() == "USDCHF" + SymbolSuffix) return (50); if (Symbol() == "USDCAD" || Symbol() == "USDCAD" + SymbolSuffix) return (70); if (Symbol() == "AUDUSD" || Symbol() == "AUDUSD" + SymbolSuffix) return (70); if (Symbol() == "NZDUSD" || Symbol() == "NZDUSD" + SymbolSuffix) return (70); if (Symbol() == "EURGBP" || Symbol() == "EURGBP" + SymbolSuffix) return (40); if (Symbol() == "EURJPY" || Symbol() == "EURJPY" + SymbolSuffix) return (100); if (Symbol() == "EURCHF" || Symbol() == "EURCHF" + SymbolSuffix) return (70); if (Symbol() == "EURCAD" || Symbol() == "EURCAD" + SymbolSuffix) return (120); if (Symbol() == "EURAUD" || Symbol() == "EURAUD" + SymbolSuffix) return (120); if (Symbol() == "GBPCHF" || Symbol() == "GBPCHF" + SymbolSuffix) return (120); if (Symbol() == "GBPJPY" || Symbol() == "GBPJPY" + SymbolSuffix) return (100); if (Symbol() == "NZDJPY" || Symbol() == "NZDJPY" + SymbolSuffix) return (100); if (Symbol() == "AUDNZD" || Symbol() == "AUDNZD" + SymbolSuffix) return (100); if (Symbol() == "AUDCAD" || Symbol() == "AUDCAD" + SymbolSuffix) return (80); if (Symbol() == "AUDJPY" || Symbol() == "AUDJPY" + SymbolSuffix) return (80); if (Symbol() == "CHFJPY" || Symbol() == "CHFJPY" + SymbolSuffix) return (60); } } if (MarketInfo(Symbol(), MODE_DIGITS) == 2.0 || MarketInfo(Symbol(), MODE_DIGITS) == 4.0) { if (SpreadLimit <= 0) { if (Symbol() == "EURUSD" || Symbol() == "EURUSD" + SymbolSuffix) return (3); if (Symbol() == "USDJPY" || Symbol() == "USDJPY" + SymbolSuffix) return (4); if (Symbol() == "GBPUSD" || Symbol() == "GBPUSD" + SymbolSuffix) return (5); if (Symbol() == "USDCHF" || Symbol() == "USDCHF" + SymbolSuffix) return (5); if (Symbol() == "USDCAD" || Symbol() == "USDCAD" + SymbolSuffix) return (7); if (Symbol() == "AUDUSD" || Symbol() == "AUDUSD" + SymbolSuffix) return (7); if (Symbol() == "NZDUSD" || Symbol() == "NZDUSD" + SymbolSuffix) return (7); if (Symbol() == "EURGBP" || Symbol() == "EURGBP" + SymbolSuffix) return (4); if (Symbol() == "EURJPY" || Symbol() == "EURJPY" + SymbolSuffix) return (10); if (Symbol() == "EURCHF" || Symbol() == "EURCHF" + SymbolSuffix) return (7); if (Symbol() == "EURCAD" || Symbol() == "EURCAD" + SymbolSuffix) return (12); if (Symbol() == "EURAUD" || Symbol() == "EURAUD" + SymbolSuffix) return (12); if (Symbol() == "GBPCHF" || Symbol() == "GBPCHF" + SymbolSuffix) return (12); if (Symbol() == "GBPJPY" || Symbol() == "GBPJPY" + SymbolSuffix) return (10); if (Symbol() == "NZDJPY" || Symbol() == "NZDJPY" + SymbolSuffix) return (10); if (Symbol() == "AUDNZD" || Symbol() == "AUDNZD" + SymbolSuffix) return (10); if (Symbol() == "AUDCAD" || Symbol() == "AUDCAD" + SymbolSuffix) return (8); if (Symbol() == "AUDJPY" || Symbol() == "AUDJPY" + SymbolSuffix) return (8); if (Symbol() == "CHFJPY" || Symbol() == "CHFJPY" + SymbolSuffix) return (6); } } if (SpreadLimit >= 0) return (SpreadLimit); return (SpreadLimit); } int Buffer(int ai_0) { gi_868 = 0; gi_872 = 0; if (ScanConsecutiveWinLoss(1) > 0) { gi_868 = ProfitBuffer + ScanConsecutiveWinLoss(1) * ProfitBufferModifier; gi_872 = LossBuffer + ScanConsecutiveWinLoss(1) * LossBufferModifier; } else { gi_868 = ProfitBuffer - ScanConsecutiveWinLoss(2) * ProfitBufferModifier; gi_872 = LossBuffer - ScanConsecutiveWinLoss(2) * LossBufferModifier; } switch (ai_0) { case 1: return (gi_868); case 2: return (gi_872); } return (0); } int txt2tf(string as_0) { if (as_0 == "m1" || as_0 == "M1") return (1); if (as_0 == "m5" || as_0 == "M5") return (5); if (as_0 == "m15" || as_0 == "M15") return (15); if (as_0 == "m30" || as_0 == "M30") return (30); if (as_0 == "h1" || as_0 == "H1") return (60); if (as_0 == "h4" || as_0 == "H4") return (240); if (as_0 == "d1" || as_0 == "D1") return (1440); if (as_0 == "w1" || as_0 == "W1") return (10080); if (as_0 == "mn" || as_0 == "MN" || as_0 == "mN" || as_0 == "Mn") return (43200); return (0); } void DisplayText(string a_name_0, string a_text_8, string a_fontname_16, int a_fontsize_24, color a_color_28, int a_x_32, int a_y_36) { ObjectCreate(a_name_0, OBJ_LABEL, 0, 0, 0); ObjectSetText(a_name_0, a_text_8, a_fontsize_24, a_fontname_16, a_color_28); ObjectSet(a_name_0, OBJPROP_CORNER, 0); ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_32); ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_36); } double ScanBuyOpenPrice() { double l_ord_open_price_0; for (int l_ord_total_8 = OrdersTotal(); l_ord_total_8 >= 0; l_ord_total_8--) { OrderSelect(l_ord_total_8, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_BUY && OrderMagicNumber() == g_magic_720 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_open_price_0 = OrderOpenPrice(); } return (l_ord_open_price_0); } double ScanSellOpenPrice() { double l_ord_open_price_0; for (int l_ord_total_8 = OrdersTotal(); l_ord_total_8 >= 0; l_ord_total_8--) { OrderSelect(l_ord_total_8, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_SELL && OrderMagicNumber() == g_magic_724 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_open_price_0 = OrderOpenPrice(); } return (l_ord_open_price_0); } double ScanConvertedBuyOpenPrice() { double l_ord_open_price_0; for (int l_ord_total_8 = OrdersTotal(); l_ord_total_8 >= 0; l_ord_total_8--) { OrderSelect(l_ord_total_8, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_BUY && OrderMagicNumber() == g_magic_728 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_open_price_0 = OrderOpenPrice(); } return (l_ord_open_price_0); } double ScanConvertedSellOpenPrice() { double l_ord_open_price_0; for (int l_ord_total_8 = OrdersTotal(); l_ord_total_8 >= 0; l_ord_total_8--) { OrderSelect(l_ord_total_8, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_SELL && OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_open_price_0 = OrderOpenPrice(); } return (l_ord_open_price_0); } void CloseDirectOrders() { color l_color_0; color l_color_4; int l_cmd_16; bool l_ord_close_20; if (DisplayArrows) { l_color_0 = ForestGreen; l_color_4 = OrangeRed; } else { l_color_0 = CLR_NONE; l_color_4 = CLR_NONE; } int l_ord_total_8 = OrdersTotal(); for (int l_pos_12 = l_ord_total_8 - 1; l_pos_12 >= 0; l_pos_12--) { OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES); l_cmd_16 = OrderType(); l_ord_close_20 = FALSE; switch (l_cmd_16) { case OP_BUY: if (OrderMagicNumber() == g_magic_720 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_close_20 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), Slippage, l_color_0); break; case OP_SELL: if (OrderMagicNumber() == g_magic_724 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_close_20 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), Slippage, l_color_4); } if (l_ord_close_20 == 0) Sleep(3000); } } void CloseConvertedDirectOrders() { color l_color_0; int li_unused_4; int l_cmd_16; bool l_ord_close_20; if (DisplayArrows) { l_color_0 = ForestGreen; li_unused_4 = 17919; } else { l_color_0 = CLR_NONE; li_unused_4 = -1; } int l_ord_total_8 = OrdersTotal(); for (int l_pos_12 = l_ord_total_8 - 1; l_pos_12 >= 0; l_pos_12--) { OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES); l_cmd_16 = OrderType(); l_ord_close_20 = FALSE; switch (l_cmd_16) { case OP_BUY: if (OrderMagicNumber() == g_magic_728 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_close_20 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), Slippage, l_color_0); break; case OP_SELL: if (OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_close_20 = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), Slippage, l_color_0); } if (l_ord_close_20 == 0) Sleep(3000); } } void ClosePendingOrders() { int li_unused_0; int li_unused_4; int l_cmd_16; bool l_ord_delete_20; if (DisplayArrows) { li_unused_0 = 2263842; li_unused_4 = 17919; } else { li_unused_0 = -1; li_unused_4 = -1; } int l_ord_total_8 = OrdersTotal(); for (int l_pos_12 = l_ord_total_8 - 1; l_pos_12 >= 0; l_pos_12--) { OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES); l_cmd_16 = OrderType(); l_ord_delete_20 = FALSE; switch (l_cmd_16) { case OP_BUYSTOP: if (OrderMagicNumber() == g_magic_728 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_delete_20 = OrderDelete(OrderTicket()); break; case OP_SELLSTOP: if (OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_delete_20 = OrderDelete(OrderTicket()); break; case OP_BUYLIMIT: if (OrderMagicNumber() == g_magic_728 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_delete_20 = OrderDelete(OrderTicket()); break; case OP_SELLLIMIT: if (OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_ord_delete_20 = OrderDelete(OrderTicket()); } if (l_ord_delete_20 == 0) Sleep(3000); } } void EmergencyExit() { if (ScanBuyOrders() + ScanSellOrders() + ScanBuyPendingOrders() + ScanSellPendingOrders() + ScanConvertedBuyOrders() + ScanConvertedSellOrders() > 0) { while (ScanBuyOrders() + ScanSellOrders() + ScanBuyPendingOrders() + ScanSellPendingOrders() + ScanConvertedBuyOrders() + ScanConvertedSellOrders() > 0) { CloseDirectOrders(); CloseConvertedDirectOrders(); ClosePendingOrders(); } } } string CurrentTime() { string ls_ret_0 = StringConcatenate(DoubleToStr(Hour(), 0), ":", DoubleToStr(Minute(), 0)); if (Hour() < 10) ls_ret_0 = "0" + ls_ret_0; if (Minute() == 0) ls_ret_0 = StringSubstr(ls_ret_0, 0, 2) + ":0" + StringSubstr(ls_ret_0, 3); return (ls_ret_0); } double ActivePerformance() { double ld_ret_0; for (int l_pos_8 = 0; l_pos_8 <= OrdersTotal(); l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS); if (OrderMagicNumber() == g_magic_720 || OrderMagicNumber() == g_magic_724 || OrderMagicNumber() == g_magic_728 || OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL && OrderComment() == TabID) ld_ret_0 = NormalizeDouble(100.0 * (ScanOrderProfit() / (AccountBalance() + EquityFacility)), 2); } return (ld_ret_0); } double CumulativePerformance() { double ld_ret_0; for (int l_pos_8 = 0; l_pos_8 <= OrdersTotal(); l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS); if (OrderMagicNumber() == g_magic_720 || OrderMagicNumber() == g_magic_724 || OrderMagicNumber() == g_magic_728 || OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL && OrderComment() == TabID) ld_ret_0 = NormalizeDouble(100.0 * (ScanOrderProfit() / (ScanLastAccountBalance() + EquityFacility)), 2); } return (ld_ret_0); } double CurrentDrawdown() { double ld_ret_0 = AccountBalance() - ScanLastAccountBalance(); return (ld_ret_0); } double CurrentDrawdownPercent() { double ld_0; ld_0 = NormalizeDouble(100.0 * (CurrentDrawdown() / ScanLastAccountBalance()), 2); return (ld_0); } double ScanLastProfit() { double l_ord_profit_0; for (int l_pos_8 = 0; l_pos_8 <= OrdersHistoryTotal(); l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS, MODE_HISTORY); if (OrderMagicNumber() == g_magic_720 || OrderMagicNumber() == g_magic_724 || OrderMagicNumber() == g_magic_728 || OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL) l_ord_profit_0 = OrderProfit(); } return (l_ord_profit_0); } double ScanOrderProfit() { double ld_ret_0; for (int l_pos_8 = 0; l_pos_8 <= OrdersTotal(); l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES); if (OrderMagicNumber() == g_magic_720 || OrderMagicNumber() == g_magic_724 || OrderMagicNumber() == g_magic_728 || OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL && OrderComment() == TabID) ld_ret_0 += OrderProfit(); } return (ld_ret_0); } int ScanOrderCloseTime() { double l_datetime_0; for (int l_pos_8 = 0; l_pos_8 <= OrdersHistoryTotal(); l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS, MODE_HISTORY); if (OrderMagicNumber() == g_magic_720 || OrderMagicNumber() == g_magic_724 || OrderMagicNumber() == g_magic_728 || OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL) l_datetime_0 = OrderCloseTime(); } return (l_datetime_0); } int ScanOrderOpenTime() { double l_datetime_0; for (int l_pos_8 = 0; l_pos_8 <= OrdersTotal(); l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES); if (OrderMagicNumber() == g_magic_720 || OrderMagicNumber() == g_magic_724 || OrderMagicNumber() == g_magic_728 || OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL && OrderComment() == TabID) l_datetime_0 = OrderOpenTime(); } return (l_datetime_0); } int ScanConsecutiveWinLoss(int ai_0) { g_count_860 = 0; g_count_864 = 0; for (int l_pos_4 = 0; l_pos_4 < OrdersHistoryTotal(); l_pos_4++) { OrderSelect(l_pos_4, SELECT_BY_POS, MODE_HISTORY); if (OrderMagicNumber() == g_magic_724 || OrderMagicNumber() == g_magic_720 || OrderMagicNumber() == g_magic_732 || OrderMagicNumber() == g_magic_728 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL) { if (OrderProfit() >= 0.0) { g_count_860 = 0; g_count_864++; } else { g_count_860++; g_count_864 = 0; } } } switch (ai_0) { case 1: return (g_count_860); case 2: return (g_count_864); } return (0); } int ScanBuyOrders() { int l_ord_total_0 = OrdersTotal(); int l_count_4 = 0; for (int l_pos_8 = 0; l_pos_8 <= l_ord_total_0; l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_BUY && OrderMagicNumber() == g_magic_720 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_count_4++; } return (l_count_4); } int ScanSellOrders() { int l_ord_total_0 = OrdersTotal(); int l_count_4 = 0; for (int l_pos_8 = 0; l_pos_8 <= l_ord_total_0; l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_SELL && OrderMagicNumber() == g_magic_724 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_count_4++; } return (l_count_4); } int ScanBuyPendingOrders() { int l_ord_total_0 = OrdersTotal(); int l_count_4 = 0; for (int l_pos_8 = 0; l_pos_8 <= l_ord_total_0; l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_BUYSTOP || OrderType() == OP_BUYLIMIT && OrderMagicNumber() == g_magic_728 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_count_4++; } return (l_count_4); } int ScanSellPendingOrders() { int l_ord_total_0 = OrdersTotal(); int l_count_4 = 0; for (int l_pos_8 = 0; l_pos_8 <= l_ord_total_0; l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_SELLSTOP || OrderType() == OP_SELLLIMIT && OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderComment() == TabID) l_count_4++; } return (l_count_4); } int ScanConvertedBuyOrders() { int l_ord_total_0 = OrdersTotal(); int l_count_4 = 0; for (int l_pos_8 = 0; l_pos_8 <= l_ord_total_0; l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_728 && OrderComment() == TabID) l_count_4++; } return (l_count_4); } int ScanConvertedSellOrders() { int l_ord_total_0 = OrdersTotal(); int l_count_4 = 0; for (int l_pos_8 = 0; l_pos_8 <= l_ord_total_0; l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_728 || OrderMagicNumber() == g_magic_732 && OrderComment() == TabID) l_count_4++; } return (l_count_4); } int ScanLastOrderType() { int l_cmd_0; for (int l_pos_4 = 0; l_pos_4 <= OrdersHistoryTotal(); l_pos_4++) { OrderSelect(l_pos_4, SELECT_BY_POS, MODE_HISTORY); if (OrderMagicNumber() == g_magic_720 || OrderMagicNumber() == g_magic_724 || OrderMagicNumber() == g_magic_728 || OrderMagicNumber() == g_magic_732 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL) l_cmd_0 = OrderType(); } return (l_cmd_0); } double GetPrice(int ai_0, int a_timeframe_4, int ai_8) { switch (ai_0) { case 1: return (MarketInfo(Symbol(), MODE_ASK)); case 2: return (MarketInfo(Symbol(), MODE_BID)); case 3: return (iClose(Symbol(), a_timeframe_4, ai_8)); case 4: return (iHigh(Symbol(), a_timeframe_4, ai_8)); case 5: return (iLow(Symbol(), a_timeframe_4, ai_8)); case 6: return (iOpen(Symbol(), a_timeframe_4, ai_8)); } return (0.0); } double MaxAccountBalance() { if (AccountBalance() > gd_832) gd_832 = AccountBalance(); return (gd_832); } void ResetAccountBalance() { g_spread_788 = FALSE; gd_792 = 0; gd_800 = 0; gd_808 = 0; gi_816 = 0; gi_820 = 0; gi_824 = 0; gi_828 = 0; gd_832 = AccountBalance(); gd_840 = AccountBalance(); g_file_852 = FileOpen(Symbol() + AccountNumber() + TabID + ".csv", FILE_CSV|FILE_WRITE, ";"); if (g_file_852 > 0) { FileWrite(g_file_852, AccountBalance()); FileClose(g_file_852); } } double ScanLastAccountBalance() { double ld_ret_0; int l_file_8 = FileOpen(Symbol() + AccountNumber() + TabID + ".csv", FILE_CSV); if (l_file_8 > 0) { ld_ret_0 = FileReadNumber(l_file_8); FileClose(l_file_8); } return (ld_ret_0); } double BuyAutoLotSize() { double ld_48; double ld_56; int li_0 = 0; int l_leverage_4 = 0; double ld_ret_8 = 0; if (ScanConsecutiveWinLoss(1) > gi_824) gi_824 = ScanConsecutiveWinLoss(1); if (ScanConsecutiveWinLoss(2) > gi_828) gi_828 = ScanConsecutiveWinLoss(2); double ld_16 = GetPrice(1, 0, 0); l_leverage_4 = AccountLeverage(); if (MinLotSize <= 0.0) MinLotSize = MarketInfo(Symbol(), MODE_MINLOT); if (LotStep <= 0.0) LotStep = MarketInfo(Symbol(), MODE_LOTSTEP); if (CurrencyLotSize <= 0.0) CurrencyLotSize = MarketInfo(Symbol(), MODE_LOTSIZE); if (Compound) ld_56 = BuyTargetProfitPercent / 100.0 * AccountEquity(); else ld_56 = BuyTargetProfitPercent / 100.0 * Capital; if (LotStep == 0.001) li_0 = 3; if (LotStep == 0.01) li_0 = 2; if (LotStep == 0.1) li_0 = 1; double ld_32 = ScanLastAccountBalance() - AccountBalance(); double ld_40 = MathMax(ld_32 + ld_56, ld_56); int li_72 = TakeProfitRange; if (li_72 <= gi_748) li_72 = gi_748; if (CurrentDrawdownPercent() < 0.0) { ld_48 = MathMax(((LossModifierPercent + ScanConsecutiveWinLoss(1) * LossWeightagePercent) / 100.0 + 1.0) * ld_40, 0); gi_828 = 0; if (gi_824 >= 1) li_72 = TakeProfitRange + (gi_824 - ScanConsecutiveWinLoss(2)) * ExposureModifier; else li_72 = TakeProfitRange; } if (CurrentDrawdownPercent() >= 0.0 || ScanConsecutiveWinLoss(2) >= StreakNullifier) { ld_48 = MathMax(((WinModifierPercent + ScanConsecutiveWinLoss(2) * WinWeightagePercent) / 100.0 + 1.0) * ld_40, 0); li_72 = MathMax(TakeProfitRange, gi_748); gi_824 = 0; } double ld_24 = ld_48 / li_72; if (Symbol() == "EURUSD" || Symbol() == "EURUSD" + SymbolSuffix || Symbol() == "GBPUSD" || Symbol() == "GBPUSD" + SymbolSuffix || Symbol() == "AUDUSD" || Symbol() == "AUDUSD" + SymbolSuffix || Symbol() == "NZDUSD" || Symbol() == "NZDUSD" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURJPY" || Symbol() == "GBPJPY" || Symbol() == "CHFJPY" || Symbol() == "AUDJPY" || Symbol() == "NZDJPY") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDJPY", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURJPY" + SymbolSuffix || Symbol() == "GBPJPY" + SymbolSuffix || Symbol() == "CHFJPY" + SymbolSuffix || Symbol() == "AUDJPY" + SymbolSuffix || Symbol() == "NZDJPY" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDJPY" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "GBPCHF" || Symbol() == "EURCHF") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDCHF", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "GBPCHF" + SymbolSuffix || Symbol() == "EURCHF" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDCHF" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "AUDCAD") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDCAD", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "AUDCAD" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDCAD" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "AUDNZD") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("NZDUSD", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "AUDNZD" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("NZDUSD" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURGBP") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("GBPUSD", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURGBP" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("GBPUSD" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURAUD") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("AUDUSD", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURAUD" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("AUDUSD" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "USDCHF" || Symbol() == "USDJPY" || Symbol() == "USDCAD" || Symbol() == "USDCHF" + SymbolSuffix || Symbol() == "USDJPY" + SymbolSuffix || Symbol() == "USDCAD" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (CurrencyLotSize * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } double ld_64 = NormalizeDouble(AccountEquity() * (MaxStakePercent / 100.0) / (CurrencyLotSize / l_leverage_4), li_0); if (ld_ret_8 < MinLotSize) ld_ret_8 = MinLotSize; if (ld_ret_8 > ld_64) ld_ret_8 = ld_64; return (ld_ret_8); } double SellAutoLotSize() { double ld_48; double ld_56; int li_0 = 0; int l_leverage_4 = 0; double ld_ret_8 = 0; if (ScanConsecutiveWinLoss(1) > gi_824) gi_824 = ScanConsecutiveWinLoss(1); if (ScanConsecutiveWinLoss(2) > gi_828) gi_828 = ScanConsecutiveWinLoss(2); double ld_16 = GetPrice(2, 0, 0); l_leverage_4 = AccountLeverage(); if (MinLotSize <= 0.0) MinLotSize = MarketInfo(Symbol(), MODE_MINLOT); if (LotStep <= 0.0) LotStep = MarketInfo(Symbol(), MODE_LOTSTEP); if (CurrencyLotSize <= 0.0) CurrencyLotSize = MarketInfo(Symbol(), MODE_LOTSIZE); if (Compound) ld_56 = SellTargetProfitPercent / 100.0 * AccountBalance(); else ld_56 = SellTargetProfitPercent / 100.0 * Capital; if (LotStep == 0.001) li_0 = 3; if (LotStep == 0.01) li_0 = 2; if (LotStep == 0.1) li_0 = 1; double ld_32 = ScanLastAccountBalance() - AccountEquity(); double ld_40 = MathMax(ld_32 + ld_56, ld_56); int li_72 = TakeProfitRange; if (li_72 <= gi_748) li_72 = gi_748; if (CurrentDrawdownPercent() < 0.0) { ld_48 = MathMax(((LossModifierPercent + ScanConsecutiveWinLoss(1) * LossWeightagePercent) / 100.0 + 1.0) * ld_40, 0); gi_828 = 0; if (gi_824 >= 1) li_72 = TakeProfitRange + (gi_824 - ScanConsecutiveWinLoss(2)) * ExposureModifier; else li_72 = TakeProfitRange; } if (CurrentDrawdownPercent() >= 0.0 || ScanConsecutiveWinLoss(2) >= StreakNullifier) { ld_48 = MathMax(((WinModifierPercent + ScanConsecutiveWinLoss(2) * WinWeightagePercent) / 100.0 + 1.0) * ld_40, 0); li_72 = MathMax(TakeProfitRange, gi_748); gi_824 = 0; } double ld_24 = ld_48 / li_72; if (Symbol() == "EURUSD" || Symbol() == "EURUSD" + SymbolSuffix || Symbol() == "GBPUSD" || Symbol() == "GBPUSD" + SymbolSuffix || Symbol() == "AUDUSD" || Symbol() == "AUDUSD" + SymbolSuffix || Symbol() == "NZDUSD" || Symbol() == "NZDUSD" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURJPY" || Symbol() == "GBPJPY" || Symbol() == "CHFJPY" || Symbol() == "AUDJPY" || Symbol() == "NZDJPY") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDJPY", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURJPY" + SymbolSuffix || Symbol() == "GBPJPY" + SymbolSuffix || Symbol() == "CHFJPY" + SymbolSuffix || Symbol() == "AUDJPY" + SymbolSuffix || Symbol() == "NZDJPY" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDJPY" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "GBPCHF" || Symbol() == "EURCHF") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDCHF", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "GBPCHF" + SymbolSuffix || Symbol() == "EURCHF" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDCHF" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "AUDCAD") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDCAD", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "AUDCAD" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize / iMA("USDCAD" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "AUDNZD") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("NZDUSD", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "AUDNZD" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("NZDUSD" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURGBP") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("GBPUSD", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURGBP" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("GBPUSD" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURAUD") { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("AUDUSD", txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "EURAUD" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (ld_16 * CurrencyLotSize * iMA("AUDUSD" + SymbolSuffix, txt2tf(EntryPeriodTimeFrame), 1, 0, MODE_EMA, PRICE_CLOSE, 0) * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } if (Symbol() == "USDCHF" || Symbol() == "USDJPY" || Symbol() == "USDCAD" || Symbol() == "USDCHF" + SymbolSuffix || Symbol() == "USDJPY" + SymbolSuffix || Symbol() == "USDCAD" + SymbolSuffix) { ld_ret_8 = 1.0 * ld_24 / (CurrencyLotSize * ((ld_16 + 1.0 * gd_760) / ld_16 - 1.0)); ld_ret_8 = NormalizeDouble(MathAbs(ld_ret_8), li_0); } double ld_64 = NormalizeDouble(AccountEquity() * (MaxStakePercent / 100.0) / (CurrencyLotSize / l_leverage_4), li_0); if (ld_ret_8 < MinLotSize) ld_ret_8 = MinLotSize; if (ld_ret_8 > ld_64) ld_ret_8 = ld_64; return (ld_ret_8); } int OpenBuyPendingOrder() { int li_0; double ld_4; color l_color_12; double ld_24; double ld_32; double ld_40; double ld_48; double ld_56; double ld_64; double ld_72; double ld_80; double ld_88; double ld_96; double ld_104; double l_price_112; double l_price_120; double l_icustom_128; double l_icustom_136; double l_icustom_144; double l_icustom_152; double l_icustom_160; double l_icustom_168; double l_icustom_176; double ld_184; ComputePCPositions(l_icustom_128, l_icustom_136, l_icustom_144, l_icustom_152, l_icustom_160, l_icustom_168, l_icustom_176, ld_184); ComputeSDR(ld_24, ld_32, ld_40, ld_48, ld_56, ld_64, ld_72, ld_80, ld_88, ld_96); string l_comment_16 = TabID; if (DisplayArrows) l_color_12 = Black; else l_color_12 = CLR_NONE; if (MaxLotSize == 0.0) MaxLotSize = MarketInfo(Symbol(), MODE_MAXLOT); if (LotStep == 0.0) LotStep = MarketInfo(Symbol(), MODE_LOTSTEP); if (LotStep == 0.001) li_0 = 3; if (LotStep == 0.01) li_0 = 2; if (LotStep == 0.1) li_0 = 1; if (ScanBuyOrders() + ScanSellOrders() + ScanConvertedBuyOrders() + ScanConvertedSellOrders() + ScanBuyPendingOrders() == 0) { if (MarketInfo(Symbol(), MODE_SPREAD) <= SpreadLimit() && EntryPeriodFilter() == 1 && ScanConsecutiveWinLoss(1) <= MaxLossCount && CheckTradingDays() && StrToTime(CurrentTime()) == StrToTime(TradingStartTime) && StrToTime(CurrentTime()) < StrToTime(TradingEndTime)) { ld_4 = BuyAutoLotSize(); if (BuyStrategySelector == 14) { ld_104 = ld_72; l_price_112 = ld_56; l_price_120 = ld_88; } if (ld_4 <= MaxLotSize) { RefreshRates(); OrderSend(Symbol(), OP_BUYSTOP, NormalizeDouble(ld_4, li_0), NormalizeDouble(ld_104, 12), Slippage, l_price_112, l_price_120, l_comment_16, g_magic_728, 0, l_color_12); } else { if (ld_4 > MaxLotSize) { RefreshRates(); OrderSend(Symbol(), OP_BUYSTOP, NormalizeDouble((ld_4 / MaxLotSize - MathFloor(ld_4 / MaxLotSize)) * MaxLotSize, li_0), NormalizeDouble(ld_104, 12), Slippage, l_price_112, l_price_120, l_comment_16, g_magic_728, 0, l_color_12); for (int l_count_192 = 0; l_count_192 < MathFloor(ld_4 / MaxLotSize); l_count_192++) { RefreshRates(); OrderSend(Symbol(), OP_BUYSTOP, MaxLotSize, NormalizeDouble(ld_104, 12), Slippage, l_price_112, l_price_120, l_comment_16, g_magic_728, 0, l_color_12); } } } } } return (0); } int OpenSellPendingOrder() { int li_0; double ld_4; color l_color_12; double ld_24; double ld_32; double ld_40; double ld_48; double ld_56; double ld_64; double ld_72; double ld_80; double ld_88; double ld_96; double ld_104; double l_price_112; double l_price_120; double l_icustom_128; double l_icustom_136; double l_icustom_144; double l_icustom_152; double l_icustom_160; double l_icustom_168; double l_icustom_176; double ld_184; ComputePCPositions(l_icustom_128, l_icustom_136, l_icustom_144, l_icustom_152, l_icustom_160, l_icustom_168, l_icustom_176, ld_184); ComputeSDR(ld_24, ld_32, ld_40, ld_48, ld_56, ld_64, ld_72, ld_80, ld_88, ld_96); string l_comment_16 = TabID; if (DisplayArrows) l_color_12 = Maroon; else l_color_12 = CLR_NONE; if (MaxLotSize == 0.0) MaxLotSize = MarketInfo(Symbol(), MODE_MAXLOT); if (LotStep == 0.0) LotStep = MarketInfo(Symbol(), MODE_LOTSTEP); if (LotStep == 0.001) li_0 = 3; if (LotStep == 0.01) li_0 = 2; if (LotStep == 0.1) li_0 = 1; if (ScanBuyOrders() + ScanSellOrders() + ScanConvertedBuyOrders() + ScanConvertedSellOrders() + ScanSellPendingOrders() == 0) { if (MarketInfo(Symbol(), MODE_SPREAD) <= SpreadLimit() && EntryPeriodFilter() == 1 && ScanConsecutiveWinLoss(1) <= MaxLossCount && CheckTradingDays() && StrToTime(CurrentTime()) == StrToTime(TradingStartTime)) { ld_4 = SellAutoLotSize(); if (SellStrategySelector == 14) { ld_104 = ld_80; l_price_112 = ld_64; l_price_120 = ld_96; } if (ld_4 <= MaxLotSize) { RefreshRates(); OrderSend(Symbol(), OP_SELLSTOP, NormalizeDouble(ld_4, li_0), NormalizeDouble(ld_104, 12), Slippage, l_price_112, l_price_120, l_comment_16, g_magic_732, 0, l_color_12); } else { if (ld_4 > MaxLotSize) { RefreshRates(); OrderSend(Symbol(), OP_SELLSTOP, NormalizeDouble((ld_4 / MaxLotSize - MathFloor(ld_4 / MaxLotSize)) * MaxLotSize, li_0), NormalizeDouble(ld_104, 12), Slippage, l_price_112, l_price_120, l_comment_16, g_magic_732, 0, l_color_12); for (int l_count_192 = 0; l_count_192 < MathFloor(ld_4 / MaxLotSize); l_count_192++) { RefreshRates(); OrderSend(Symbol(), OP_SELLSTOP, MaxLotSize, NormalizeDouble(ld_104, 12), Slippage, l_price_112, l_price_120, l_comment_16, g_magic_732, 0, l_color_12); } } } } } return (0); } int OpenBuyOrder() { int li_0; double ld_4; double l_price_20; double l_price_28; color l_color_36; double ld_48; double ld_56; double ld_64; double ld_72; double ld_80; double ld_88; double ld_96; double ld_104; double ld_112; double ld_120; double ld_128; double ld_136; double ld_144; double ld_152; double ld_160; double ld_168; double ld_176; double ld_184; double ld_192; double ld_200; double ld_208; double ld_216; double ld_224; double ld_232; double ld_240; double ld_248; double ld_256; double ld_264; double ld_272; double ld_280; double ld_288; double ld_296; double l_high_304; double l_low_312; double ld_320; double ld_328; double ld_336; double ld_344; double ld_352; double ld_360; double ld_368; double ld_376; double ld_384; double ld_392; double ld_400; double ld_408; double ld_416; double l_icustom_424; double l_icustom_432; double l_icustom_440; double l_icustom_448; double l_icustom_456; double l_icustom_464; double l_icustom_472; double ld_480; double ld_488; double ld_496; double ld_504; double ld_512; double ld_520; double ld_528; double ld_536; double ld_544; double ld_552; double ld_560; double l_ihigh_568; double l_ilow_576; double ld_584; double l_icustom_608; double l_icustom_616; double ld_624; double ld_632; double ld_640; double ld_648; double ld_656; double ld_664; double ld_672; double ld_680; double ld_688; double ld_696; double ld_704; double ld_712; double ld_720; double ld_728; double ld_736; ComputeMMLValues(ld_632, ld_640, ld_648, ld_656, ld_664, ld_672, ld_680, ld_688, ld_696, ld_704, ld_712, ld_720, ld_728, ld_736); double l_icustom_592 = iCustom(Symbol(), 0, "Waddah_Attar_Strong_Level", 3, 0); double l_icustom_600 = iCustom(Symbol(), 0, "Waddah_Attar_Strong_Level", 0, 0); ComputeTeaBreak(l_ihigh_568, l_ilow_576, ld_584); ComputeFractal(l_icustom_608, l_icustom_616, ld_624); ComputePCPositions(l_icustom_424, l_icustom_432, l_icustom_440, l_icustom_448, l_icustom_456, l_icustom_464, l_icustom_472, ld_480); double l_price_12 = GetPrice(2, 0, 0); ComputePivotPositions(ld_48, ld_56, ld_64, ld_72, ld_80); ComputeFiboPositions(ld_88, ld_96, ld_104, ld_112, ld_120, ld_128, ld_136, ld_144, ld_152, ld_160, ld_168, ld_176, ld_184, ld_192, ld_200, ld_208, ld_216, ld_224, ld_232, ld_240, ld_248, ld_256, ld_264, ld_272, ld_280, ld_288, ld_296); ComputeBoxPositions(l_high_304, l_low_312, ld_320, ld_328, ld_336, ld_344); ComputeCamarilla(ld_352, ld_360, ld_368, ld_376, ld_384, ld_392, ld_400, ld_408, ld_416); ComputeSDR(ld_488, ld_496, ld_504, ld_512, ld_520, ld_528, ld_536, ld_544, ld_552, ld_560); string l_comment_40 = TabID; if (DisplayArrows) l_color_36 = Black; else l_color_36 = CLR_NONE; if (MaxLotSize == 0.0) MaxLotSize = MarketInfo(Symbol(), MODE_MAXLOT); if (LotStep == 0.0) LotStep = MarketInfo(Symbol(), MODE_LOTSTEP); if (LotStep == 0.001) li_0 = 3; if (LotStep == 0.01) li_0 = 2; if (LotStep == 0.1) li_0 = 1; if (BuyCycle == TRUE) { if (EntryByStrategy == FALSE && ScanBuyOrders() + ScanSellOrders() == 0) gi_752 = TRUE; if (EntryByStrategy == TRUE && ScanBuyOrders() + ScanSellOrders() == 0) { if (BuyStrategySelector == 0) { if (ManualBuyPositionLevel > 0.0 && l_price_12 >= ManualBuyPositionLevel && l_price_12 <= ManualBuyPositionLevel + ManualBuySpacing * gd_760) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 1) { if (l_price_12 >= ld_64 && l_price_12 <= ld_56 && MajorTrend(MajorTrendTimeFrame) == 1 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 2) { if (l_price_12 >= ld_352 + CamBFirstSpacing * gd_760 && l_price_12 <= ld_352 + (CamBFirstSpacing + CamBSecondSpacing) * gd_760 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 3) { if (l_price_12 >= ld_328 && l_price_12 <= ld_320 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(BoxEndTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 4) { if (l_price_12 >= l_ihigh_568 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(BoxEndTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 5) { if (l_price_12 >= l_icustom_424 && MajorTrend(MajorTrendTimeFrame) == 1 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 6) { if (l_price_12 >= ld_536 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 7) { if (MinorTrend(MinorTrendTimeFrame) == 1 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 8) { if (l_price_12 >= ld_168 + FibFirstSpacing * gd_760 && l_price_12 <= ld_168 + (FibFirstSpacing + FibSecondSpacing) * gd_760 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 9) { if (MinorTrend(MinorTrendTimeFrame) == 1 && MajorTrend(MajorTrendTimeFrame) == 1 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 10) { if (l_price_12 >= l_icustom_592 + StrongLevelFirstSpacing * gd_760 && l_price_12 <= l_icustom_592 + (StrongLevelFirstSpacing + StrongLevelSecondSpacing) * gd_760 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 11) { if (l_price_12 >= l_icustom_608 + FractalFirstSpacing * gd_760 && l_price_12 <= l_icustom_608 + (FractalFirstSpacing + FractalSecondSpacing) * gd_760 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 15) { if (MinorTrend(MinorTrendTimeFrame) == 1 && CandleStickPattern(CandleStickPatternTimeFrame) == 1 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } else { if (BuyStrategySelector == 16) { if (ComputeFlipCoin() == 1 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_752 = TRUE; else gi_752 = FALSE; } } } } } } } } } } } } } } } } if (gi_752 == TRUE && EntryPeriodFilter() == 1 && ScanConsecutiveWinLoss(1) <= MaxLossCount) { if (MarketInfo(Symbol(), MODE_SPREAD) <= SpreadLimit()) { l_price_12 = GetPrice(1, 0, 0); if (!AutoTakeProfit) { if (gi_768 == 0) l_price_28 = 0; if (!DynamicTakeProfit) if (gi_768 != 0) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; if (DynamicTakeProfit) l_price_28 = l_price_12 + Buffer(1) * gd_760; } if (AutoTakeProfit) { if (gi_768 == 0) l_price_28 = 0; if (gi_768 != 0) { if (EntryByStrategy) { if (BuyStrategySelector == 0) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else { if (BuyStrategySelector == 1) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else { if (BuyStrategySelector == 2) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else { if (BuyStrategySelector == 3) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else { if (BuyStrategySelector == 4) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else { if (BuyStrategySelector == 5) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else { if (BuyStrategySelector == 6) l_price_28 = ld_552; else { if (BuyStrategySelector == 7) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else { if (BuyStrategySelector == 8) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else { if (BuyStrategySelector == 9) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else { if (BuyStrategySelector == 10) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else { if (BuyStrategySelector == 11) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else { if (BuyStrategySelector == 16) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; else l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; } } } } } } } } } } } } } if (!EntryByStrategy) l_price_28 = l_price_12 + MathAbs(gi_768) * gd_760; } } if (!AutoStopLoss) { if (gi_772 == 0) l_price_20 = 0; if (!DynamicStopLoss) if (gi_772 != 0) l_price_20 = l_price_12 - MathAbs(gi_772) * gd_760; if (DynamicStopLoss) l_price_20 = l_price_12 - Buffer(2) * gd_760; } if (AutoStopLoss) { if (gi_772 == 0) l_price_20 = 0; if (gi_772 != 0) { if (EntryByStrategy) { if (BuyStrategySelector == 0) l_price_20 = l_price_12 - MathAbs(gi_772) * gd_760; else { if (BuyStrategySelector == 1) l_price_20 = ld_80; else { if (BuyStrategySelector == 2) l_price_20 = ld_384; else { if (BuyStrategySelector == 3) l_price_20 = l_low_312; else { if (BuyStrategySelector == 4) l_price_20 = l_ilow_576; else { if (BuyStrategySelector == 5) l_price_20 = l_icustom_472; else { if (BuyStrategySelector == 6) l_price_20 = ld_520; else { if (BuyStrategySelector == 8) l_price_20 = ld_176; else { if (BuyStrategySelector == 9) l_price_20 = l_price_12 - MathAbs(gi_772) * gd_760; else { if (BuyStrategySelector == 10) l_price_20 = l_price_12 - MathAbs(gi_772) * gd_760; else { if (BuyStrategySelector == 11) l_price_20 = l_price_12 - MathAbs(gi_772) * gd_760; else { if (BuyStrategySelector == 15) l_price_20 = l_price_12 - MathAbs(gi_772) * gd_760; else { if (BuyStrategySelector == 16) l_price_20 = l_price_12 - MathAbs(gi_772) * gd_760; else l_price_20 = l_price_12 - MathAbs(gi_772) * gd_760; } } } } } } } } } } } } } if (!EntryByStrategy) l_price_20 = l_price_12 - MathAbs(gi_772) * gd_760; } } ld_4 = BuyAutoLotSize(); if (ld_4 <= MaxLotSize) { RefreshRates(); OrderSend(Symbol(), OP_BUY, NormalizeDouble(ld_4, li_0), l_price_12, Slippage, l_price_20, l_price_28, l_comment_40, g_magic_720, 0, l_color_36); } else { if (ld_4 > MaxLotSize) { RefreshRates(); OrderSend(Symbol(), OP_BUY, NormalizeDouble((ld_4 / MaxLotSize - MathFloor(ld_4 / MaxLotSize)) * MaxLotSize, li_0), l_price_12, Slippage, l_price_20, l_price_28, l_comment_40, g_magic_720, 0, l_color_36); for (int l_count_744 = 0; l_count_744 < MathFloor(ld_4 / MaxLotSize); l_count_744++) { RefreshRates(); OrderSend(Symbol(), OP_BUY, MaxLotSize, l_price_12, Slippage, l_price_20, l_price_28, l_comment_40, g_magic_720, 0, l_color_36); } } } } } return (0); } int OpenSellOrder() { int li_0; double ld_4; double l_price_20; double l_price_28; color l_color_36; double ld_48; double ld_56; double ld_64; double ld_72; double ld_80; double ld_88; double ld_96; double ld_104; double ld_112; double ld_120; double ld_128; double ld_136; double ld_144; double ld_152; double ld_160; double ld_168; double ld_176; double ld_184; double ld_192; double ld_200; double ld_208; double ld_216; double ld_224; double ld_232; double ld_240; double ld_248; double ld_256; double ld_264; double ld_272; double ld_280; double ld_288; double ld_296; double l_high_304; double l_low_312; double ld_320; double ld_328; double ld_336; double ld_344; double ld_352; double ld_360; double ld_368; double ld_376; double ld_384; double ld_392; double ld_400; double ld_408; double ld_416; double l_icustom_424; double l_icustom_432; double l_icustom_440; double l_icustom_448; double l_icustom_456; double l_icustom_464; double l_icustom_472; double ld_480; double ld_488; double ld_496; double ld_504; double ld_512; double ld_520; double ld_528; double ld_536; double ld_544; double ld_552; double ld_560; double l_ihigh_568; double l_ilow_576; double ld_584; double l_icustom_608; double l_icustom_616; double ld_624; double ld_632; double ld_640; double ld_648; double ld_656; double ld_664; double ld_672; double ld_680; double ld_688; double ld_696; double ld_704; double ld_712; double ld_720; double ld_728; double ld_736; ComputeMMLValues(ld_632, ld_640, ld_648, ld_656, ld_664, ld_672, ld_680, ld_688, ld_696, ld_704, ld_712, ld_720, ld_728, ld_736); double l_icustom_592 = iCustom(Symbol(), 0, "Waddah_Attar_Strong_Level", 3, 0); double l_icustom_600 = iCustom(Symbol(), 0, "Waddah_Attar_Strong_Level", 0, 0); ComputeTeaBreak(l_ihigh_568, l_ilow_576, ld_584); ComputeFractal(l_icustom_608, l_icustom_616, ld_624); ComputePCPositions(l_icustom_424, l_icustom_432, l_icustom_440, l_icustom_448, l_icustom_456, l_icustom_464, l_icustom_472, ld_480); double l_price_12 = GetPrice(1, 0, 0); ComputePivotPositions(ld_48, ld_56, ld_64, ld_72, ld_80); ComputeFiboPositions(ld_88, ld_96, ld_104, ld_112, ld_120, ld_128, ld_136, ld_144, ld_152, ld_160, ld_168, ld_176, ld_184, ld_192, ld_200, ld_208, ld_216, ld_224, ld_232, ld_240, ld_248, ld_256, ld_264, ld_272, ld_280, ld_288, ld_296); ComputeBoxPositions(l_high_304, l_low_312, ld_320, ld_328, ld_336, ld_344); ComputeCamarilla(ld_352, ld_360, ld_368, ld_376, ld_384, ld_392, ld_400, ld_408, ld_416); ComputeSDR(ld_488, ld_496, ld_504, ld_512, ld_520, ld_528, ld_536, ld_544, ld_552, ld_560); string l_comment_40 = TabID; if (DisplayArrows) l_color_36 = Maroon; else l_color_36 = CLR_NONE; if (MaxLotSize == 0.0) MaxLotSize = MarketInfo(Symbol(), MODE_MAXLOT); if (LotStep == 0.0) LotStep = MarketInfo(Symbol(), MODE_LOTSTEP); if (LotStep == 0.001) li_0 = 3; if (LotStep == 0.01) li_0 = 2; if (LotStep == 0.1) li_0 = 1; if (SellCycle == TRUE) { if (EntryByStrategy == FALSE && ScanBuyOrders() + ScanSellOrders() == 0) gi_756 = TRUE; if (EntryByStrategy == TRUE && ScanBuyOrders() + ScanSellOrders() == 0) { if (SellStrategySelector == 0) { if (ManualSellPositionLevel > 0.0 && l_price_12 <= ManualSellPositionLevel && l_price_12 >= ManualSellPositionLevel - ManualSellSpacing * gd_760) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 1) { if (l_price_12 <= ld_72 && l_price_12 >= ld_80 && MajorTrend(MajorTrendTimeFrame) == 2 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 2) { if (l_price_12 <= ld_416 - CamBFirstSpacing * gd_760 && l_price_12 >= ld_416 - (CamBFirstSpacing + CamBSecondSpacing) * gd_760 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 3) { if (l_price_12 <= ld_336 && l_price_12 >= ld_344 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(BoxEndTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 4) { if (l_price_12 <= l_ilow_576 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(BoxEndTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 5) { if (l_price_12 <= l_icustom_472 && MajorTrend(MajorTrendTimeFrame) == 2 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 6) { if (l_price_12 <= ld_544 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 7) { if (MinorTrend(MinorTrendTimeFrame) == 2 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 8) { if (l_price_12 <= ld_216 - FibFirstSpacing * gd_760 && l_price_12 >= ld_216 - (FibFirstSpacing + FibSecondSpacing) * gd_760 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 9) { if (MajorTrend(MajorTrendTimeFrame) == 2 && MinorTrend(MinorTrendTimeFrame) == 2 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 10) { if (l_price_12 <= l_icustom_592 - StrongLevelFirstSpacing * gd_760 && l_price_12 >= l_icustom_592 - (StrongLevelFirstSpacing + StrongLevelSecondSpacing) * gd_760 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 11) { if (l_price_12 <= l_icustom_616 - FractalFirstSpacing * gd_760 && l_price_12 >= l_icustom_616 - (FractalFirstSpacing + FractalSecondSpacing) * gd_760 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 15) { if (MinorTrend(MinorTrendTimeFrame) == 2 && CandleStickPattern(CandleStickPatternTimeFrame) == 2 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } else { if (SellStrategySelector == 16) { if (ComputeFlipCoin() == 2 && CheckTradingDays() && StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) gi_756 = TRUE; else gi_756 = FALSE; } } } } } } } } } } } } } } } } if (gi_756 == TRUE && EntryPeriodFilter() == 1 && ScanConsecutiveWinLoss(1) <= MaxLossCount) { if (MarketInfo(Symbol(), MODE_SPREAD) <= SpreadLimit()) { l_price_12 = GetPrice(2, 0, 0); if (!AutoTakeProfit) { if (gi_776 == 0) l_price_28 = 0; if (gi_776 != 0) if (!DynamicTakeProfit) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; if (DynamicTakeProfit) l_price_28 = l_price_12 - Buffer(1) * gd_760; } if (AutoTakeProfit) { if (gi_776 == 0) l_price_28 = 0; if (gi_776 != 0) { if (EntryByStrategy) { if (SellStrategySelector == 0) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 1) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 2) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 3) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 4) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 5) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 6) l_price_28 = ld_560; else { if (SellStrategySelector == 7) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 8) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 9) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 10) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 11) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 15) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else { if (SellStrategySelector == 16) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; else l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; } } } } } } } } } } } } } } if (!EntryByStrategy) l_price_28 = l_price_12 - MathAbs(gi_776) * gd_760; } } if (!AutoStopLoss) { if (gi_780 == 0) l_price_20 = 0; if (gi_780 != 0) { if (!DynamicStopLoss) l_price_20 = l_price_12 + MathAbs(gi_780) * gd_760; if (DynamicStopLoss) l_price_20 = l_price_12 + Buffer(2) * gd_760; } } if (AutoStopLoss) { if (gi_780 == 0) l_price_20 = 0; if (gi_780 != 0) { if (EntryByStrategy) { if (SellStrategySelector == 0) l_price_20 = l_price_12 + MathAbs(gi_780) * gd_760; else { if (SellStrategySelector == 1) l_price_20 = ld_56; else { if (SellStrategySelector == 2) l_price_20 = ld_384; else { if (SellStrategySelector == 3) l_price_20 = l_high_304; else { if (SellStrategySelector == 4) l_price_20 = l_ihigh_568; else { if (SellStrategySelector == 5) l_price_20 = l_icustom_424; else { if (SellStrategySelector == 6) l_price_20 = ld_528; else { if (SellStrategySelector == 8) l_price_20 = ld_208; else { if (SellStrategySelector == 10) l_price_20 = l_price_12 + MathAbs(gi_780) * gd_760; else { if (SellStrategySelector == 11) l_price_20 = l_price_12 + MathAbs(gi_780) * gd_760; else { if (SellStrategySelector == 15) l_price_20 = l_price_12 + MathAbs(gi_780) * gd_760; else { if (SellStrategySelector == 16) l_price_20 = l_price_12 + MathAbs(gi_780) * gd_760; else l_price_20 = l_price_12 + MathAbs(gi_780) * gd_760; } } } } } } } } } } } } if (!EntryByStrategy) l_price_20 = l_price_12 + MathAbs(gi_780) * gd_760; } } ld_4 = SellAutoLotSize(); if (ld_4 <= MaxLotSize) { RefreshRates(); OrderSend(Symbol(), OP_SELL, NormalizeDouble(ld_4, li_0), l_price_12, Slippage, l_price_20, l_price_28, l_comment_40, g_magic_724, 0, l_color_36); } else { if (ld_4 > MaxLotSize) { RefreshRates(); OrderSend(Symbol(), OP_SELL, NormalizeDouble((ld_4 / MaxLotSize - MathFloor(ld_4 / MaxLotSize)) * MaxLotSize, li_0), l_price_12, Slippage, l_price_20, l_price_28, l_comment_40, g_magic_724, 0, l_color_36); for (int l_count_744 = 0; l_count_744 < MathFloor(ld_4 / MaxLotSize); l_count_744++) { RefreshRates(); OrderSend(Symbol(), OP_SELL, MaxLotSize, l_price_12, Slippage, l_price_20, l_price_28, l_comment_40, g_magic_724, 0, l_color_36); } } } } } return (0); } void Comments() { string ls_0 = ""; if (MarketInfo(Symbol(), MODE_SPREAD) > g_spread_788) g_spread_788 = MarketInfo(Symbol(), MODE_SPREAD); if (AccountEquity() - MaxAccountBalance() < gd_792) { gd_792 = AccountEquity() - MaxAccountBalance(); gd_808 = 100.0 * (gd_792 / MaxAccountBalance()); } if (100.0 * ((AccountEquity() - MaxAccountBalance()) / MaxAccountBalance()) < gd_800) gd_800 = 100.0 * ((AccountEquity() - MaxAccountBalance()) / MaxAccountBalance()); if (ScanConsecutiveWinLoss(1) > gi_816) gi_816 = ScanConsecutiveWinLoss(1); if (ScanConsecutiveWinLoss(2) > gi_820) gi_820 = ScanConsecutiveWinLoss(2); double ld_8 = AccountBalance() - Capital; double ld_16 = 100.0 * (ld_8 / Capital); DisplayText("Expert", "KaiZen Multi-Trader Expert", "ArialBold", 16, Gold, 5, 10); DisplayText("Build", " - " + "KMT029", "ArialBold", 9, Gold, 260, 17); DisplayText("ODMM", "Powered by ODMM™", "ArialBold", 9, MediumSpringGreen, 10, 30); DisplayText("TotalProfit", "Overall Profit: " + "$" + DoubleToStr(ld_8, 2) + " (" + DoubleToStr(ld_16, 2) + "%)", "ArialBold", 14, White, 5, 50); DisplayText("LastProfit", "Last Profit: " + "$" + DoubleToStr(ScanLastProfit(), 2) + " @ " + TimeToStr(ScanOrderCloseTime(), TIME_MINUTES) + "hr", "ArialBold", 10, Yellow, 10, 75); DisplayText("BuyStake", "Buy: " + DoubleToStr(BuyAutoLotSize(), 2) + " lot", "ArialBold", 10, Blue, 10, 90); DisplayText("SellStake", "Sell: " + DoubleToStr(SellAutoLotSize(), 2) + " lot", "ArialBold", 10, Red, 110, 90); DisplayText("CurrentPerformance", "Current Performance: " + "$" + DoubleToStr(ScanOrderProfit(), 2) + " (" + DoubleToStr(ActivePerformance(), 2) + "%)", "ArialBold", 14, Orange, 5, 110); DisplayText("CurrentDD", "Current Drawdown: " + "$" + DoubleToStr(CurrentDrawdown(), 2) + " (" + DoubleToStr(CurrentDrawdownPercent(), 2) + "%)", "ArialBold", 14, Orange, 5, 135); ls_0 = ls_0 + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n"; ls_0 = ls_0 + " " + "Creator: Zen Success Pte Ltd" + "\n" + " " + "Email: info@forexzen.com" + "\n"; ls_0 = ls_0 + " " + "Server Date & Time: " + Year() + "." + Month() + "." + Day() + " " + CurrentTime() + "\n"; ls_0 = ls_0 + " " + "Equity Cap Limit: " + "$" + DoubleToStr(gd_740, 0) + "\n"; if (DisplayCommentary) { ls_0 = ls_0 + " " + "--------------------------------------------------------------------------" + "\n" + " " + "Trading Instrument: " + Symbol() + "\n" + " " + "Tab ID: " + TabID + "\n" + " " + "--------------------------------------------------------------------------" + "\n" + " " + "Leverage: " + AccountLeverage() + " " + " " + "Spread: " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD), 0) + " (Max: " + DoubleToStr(g_spread_788, 0) + ")" + "\n" + " " + "Swap Long: " + "$" + DoubleToStr(MarketInfo(Symbol(), MODE_SWAPLONG), 2) + "/lot" + " " + " " + "Swap Short: " + "$" + DoubleToStr(MarketInfo(Symbol(), MODE_SWAPSHORT), 2) + "/lot" + "\n" + " " + "--------------------------------------------------------------------------" + "\n" + " " + "Account Number: " + AccountNumber() + "\n" + " " + "--------------------------------------------------------------------------" + "\n" + " " + "Account Balance: " + "$" + DoubleToStr(AccountBalance(), 2) + "\n" + " " + "Account Equity: " + "$" + DoubleToStr(AccountEquity(), 2) + "\n" + " " + "Account Margin Used: " + "$" + DoubleToStr(AccountMargin(), 2) + "\n" + " " + "Account Free Margin: " + "$" + DoubleToStr(AccountFreeMargin(), 2) + "\n" + "\n" + " " + "Maximum Drawdown: " + "$" + DoubleToStr(gd_792, 2) + "\n" + " " + "Drawdown Percent: " + "Abs:" + DoubleToStr(gd_808, 2) + "%" + " " + "Rel: " + DoubleToStr(gd_800, 2) + "%" + "\n" + " " + "Consecutive Losses: " + ScanConsecutiveWinLoss(1) + " (Max: " + DoubleToStr(gi_816, 0) + ")" + "\n" + " " + "Streak Losses: " + gi_824 + "\n" + " " + "Consecutive Wins: " + ScanConsecutiveWinLoss(2) + " (Max: " + DoubleToStr(gi_820, 0) + ")" + "\n" + " " + "Streak Wins: " + gi_828 + "\n" + "\n" + " " + "Dynamic Take-Profit: " + Buffer(1) + " " + "Dynamic Stop-Loss: " + Buffer(2) + "\n"; ls_0 = ls_0 + " " + "--------------------------------------------------------------------------" + "\n"; } Comment(ls_0); } int EntryPeriodFilter() { if (EntryPeriodTimeFrame == "m1" || EntryPeriodTimeFrame == "M1") { if (Minute() == 0 || Minute() == 2 || Minute() == 3 || Minute() == 4 || Minute() == 5 || Minute() == 6 || Minute() == 7 || Minute() == 8 || Minute() == 9 || Minute() == 10 || Minute() == 11 || Minute() == 12 || Minute() == 13 || Minute() == 14 || Minute() == 15 || Minute() == 16 || Minute() == 17 || Minute() == 18 || Minute() == 19 || Minute() == 20 || Minute() == 21 || Minute() == 22 || Minute() == 23 || Minute() == 24 || Minute() == 25 || Minute() == 26 || Minute() == 27 || Minute() == 28 || Minute() == 29 || Minute() == 30 || Minute() == 31 || Minute() == 32 || Minute() == 33 || Minute() == 34 || Minute() == 35 || Minute() == 36 || Minute() == 37 || Minute() == 36 || Minute() == 39 || Minute() == 40 || Minute() == 41 || Minute() == 42 || Minute() == 43 || Minute() == 44 || Minute() == 45 || Minute() == 46 || Minute() == 47 || Minute() == 48 || Minute() == 49 || Minute() == 50 || Minute() == 51 || Minute() == 52 || Minute() == 53 || Minute() == 54 || Minute() == 55 || Minute() == 56 || Minute() == 57 || Minute() == 58 || Minute() == 59) return (1); } if (EntryPeriodTimeFrame == "m5" || EntryPeriodTimeFrame == "M5") { if (!(Minute() == 0 || Minute() == 5 || Minute() == 10 || Minute() == 15 || Minute() == 20 || Minute() == 25 || Minute() == 30 || Minute() == 35 || Minute() == 40 || Minute() == 45 || Minute() == 50 || Minute() == 55)) return (0); return (1); } if (EntryPeriodTimeFrame == "m15" || EntryPeriodTimeFrame == "M15") { if (!(Minute() == 0 || Minute() == 15 || Minute() == 30 || Minute() == 45)) return (0); return (1); } if (EntryPeriodTimeFrame == "m30" || EntryPeriodTimeFrame == "M30") { if (!(Minute() == 0 || Minute() == 30)) return (0); return (1); } if (EntryPeriodTimeFrame == "h1" || EntryPeriodTimeFrame == "H1") { if (Minute() != 0) return (0); return (1); } if (EntryPeriodTimeFrame == "h4" || EntryPeriodTimeFrame == "H4") { if (!(Hour() == 0 || Hour() == 4 || Hour() == 8 || Hour() == 12 || Hour() == 16 || Hour() == 20 && Minute() == 0)) return (0); return (1); } if (EntryPeriodTimeFrame == "d1" || EntryPeriodTimeFrame == "D1") { if (!(Hour() == 0 && Minute() == 0)) return (0); return (1); } if (Minute() == 0 || Minute() == 15 || Minute() == 30 || Minute() == 45) return (1); return (0); } int ExitPeriodFilter() { if (ExitPeriodTimeFrame == "m1" || ExitPeriodTimeFrame == "M1") { if (Minute() == 0 || Minute() == 2 || Minute() == 3 || Minute() == 4 || Minute() == 5 || Minute() == 6 || Minute() == 7 || Minute() == 8 || Minute() == 9 || Minute() == 10 || Minute() == 11 || Minute() == 12 || Minute() == 13 || Minute() == 14 || Minute() == 15 || Minute() == 16 || Minute() == 17 || Minute() == 18 || Minute() == 19 || Minute() == 20 || Minute() == 21 || Minute() == 22 || Minute() == 23 || Minute() == 24 || Minute() == 25 || Minute() == 26 || Minute() == 27 || Minute() == 28 || Minute() == 29 || Minute() == 30 || Minute() == 31 || Minute() == 32 || Minute() == 33 || Minute() == 34 || Minute() == 35 || Minute() == 36 || Minute() == 37 || Minute() == 36 || Minute() == 39 || Minute() == 40 || Minute() == 41 || Minute() == 42 || Minute() == 43 || Minute() == 44 || Minute() == 45 || Minute() == 46 || Minute() == 47 || Minute() == 48 || Minute() == 49 || Minute() == 50 || Minute() == 51 || Minute() == 52 || Minute() == 53 || Minute() == 54 || Minute() == 55 || Minute() == 56 || Minute() == 57 || Minute() == 58 || Minute() == 59) return (1); } if (ExitPeriodTimeFrame == "m5" || ExitPeriodTimeFrame == "M5") { if (!(Minute() == 0 || Minute() == 5 || Minute() == 10 || Minute() == 15 || Minute() == 20 || Minute() == 25 || Minute() == 30 || Minute() == 35 || Minute() == 40 || Minute() == 45 || Minute() == 50 || Minute() == 55)) return (0); return (1); } if (ExitPeriodTimeFrame == "m15" || ExitPeriodTimeFrame == "M15") { if (!(Minute() == 0 || Minute() == 15 || Minute() == 30 || Minute() == 45)) return (0); return (1); } if (ExitPeriodTimeFrame == "m30" || ExitPeriodTimeFrame == "M30") { if (!(Minute() == 0 || Minute() == 30)) return (0); return (1); } if (ExitPeriodTimeFrame == "h1" || ExitPeriodTimeFrame == "H1") { if (Minute() != 0) return (0); return (1); } if (ExitPeriodTimeFrame == "h4" || ExitPeriodTimeFrame == "H4") { if (!(Hour() == 0 || Hour() == 4 || Hour() == 8 || Hour() == 12 || Hour() == 16 || Hour() == 20 && Minute() == 0)) return (0); return (1); } if (ExitPeriodTimeFrame == "d1" || ExitPeriodTimeFrame == "D1") { if (!(Hour() == 0 && Minute() == 0)) return (0); return (1); } if (Minute() == 0 || Minute() == 15 || Minute() == 30 || Minute() == 45) return (1); return (0); } void MoveStop() { for (int l_ord_total_0 = OrdersTotal(); l_ord_total_0 >= 0; l_ord_total_0--) { OrderSelect(l_ord_total_0, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol()) { if (OrderType() == OP_SELL && OrderMagicNumber() == g_magic_724 || OrderMagicNumber() == g_magic_732) { if (BreakEvenStop <= 0) continue; if (OrderOpenPrice() - GetPrice(1, 0, 0) < BreakEvenStop * gd_760) continue; if (OrderStopLoss() <= GetPrice(1, 0, 0) + gd_760 * BreakEvenStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), GetPrice(1, 0, 0) + gd_760 * BreakEvenStop, OrderTakeProfit(), 0, Purple); return; } if (OrderType() == OP_BUY && OrderMagicNumber() == g_magic_720 || OrderMagicNumber() == g_magic_728) { if (BreakEvenStop > 0) { if (GetPrice(2, 0, 0) - OrderOpenPrice() >= BreakEvenStop * gd_760) { if (OrderStopLoss() < GetPrice(2, 0, 0) - gd_760 * BreakEvenStop) { OrderModify(OrderTicket(), OrderOpenPrice(), GetPrice(2, 0, 0) - gd_760 * BreakEvenStop, OrderTakeProfit(), 0, Yellow); return; } } } } } } } void Volatility_Screen(string as_0, double &a_ima_8, double &ad_16, double &ad_24, double &a_ima_32, double &ad_40, double &ad_48) { a_ima_8 = iMA(Symbol(), txt2tf(as_0), g_period_876, 0, MODE_EMA, PRICE_CLOSE, 0); ad_16 = a_ima_8 + gd_884 * atr(txt2tf(as_0), gi_880); ad_24 = a_ima_8 - gd_884 * atr(txt2tf(as_0), gi_880); a_ima_32 = iMA(Symbol(), txt2tf(as_0), g_period_892, 0, MODE_SMA, PRICE_CLOSE, 0); ad_40 = a_ima_32 + bb(txt2tf(as_0), g_period_892, gd_896, a_ima_32); ad_48 = a_ima_32 - bb(txt2tf(as_0), g_period_892, gd_896, a_ima_32); } double atr(string as_0, int ai_8) { double ld_12 = 0; int li_20 = 0; if (iBars(Symbol(), txt2tf(as_0)) <= ai_8) return (0); for (li_20 = ai_8 - 1; li_20 >= 0; li_20--) { ld_12 += MathMax(iHigh(Symbol(), txt2tf(as_0), li_20), iClose(Symbol(), txt2tf(as_0), li_20 + 1)) - MathMin(iLow(Symbol(), txt2tf(as_0), li_20), iClose(Symbol(), txt2tf(as_0), li_20 + 1)); } return (ld_12 / ai_8); } double bb(string as_0, int ai_8, int ai_12, double ad_16) { double ld_36; double ld_24 = 0.0; int li_32 = 0; if (iBars(Symbol(), txt2tf(as_0)) <= ai_8) return (0); for (li_32 = ai_8 - 1; li_32 >= 0; li_32--) { ld_36 = iClose(Symbol(), txt2tf(as_0), li_32) - ad_16; ld_24 += ld_36 * ld_36; } return (ai_12 * MathSqrt(ld_24 / ai_8)); } void ComputePCPositions(double &a_icustom_0, double &a_icustom_8, double &a_icustom_16, double &a_icustom_24, double &a_icustom_32, double &a_icustom_40, double &a_icustom_48, double &ad_56) { a_icustom_0 = iCustom(Symbol(), txt2tf(PriceChannelTimeFrame), "FiboPriceChannel", PriceChannelPeriod, 0, PriceChannelShift); a_icustom_8 = iCustom(Symbol(), txt2tf(PriceChannelTimeFrame), "FiboPriceChannel", PriceChannelPeriod, 3, PriceChannelShift); a_icustom_16 = iCustom(Symbol(), txt2tf(PriceChannelTimeFrame), "FiboPriceChannel", PriceChannelPeriod, 4, PriceChannelShift); a_icustom_24 = iCustom(Symbol(), txt2tf(PriceChannelTimeFrame), "FiboPriceChannel", PriceChannelPeriod, 2, PriceChannelShift); a_icustom_32 = iCustom(Symbol(), txt2tf(PriceChannelTimeFrame), "FiboPriceChannel", PriceChannelPeriod, 5, PriceChannelShift); a_icustom_40 = iCustom(Symbol(), txt2tf(PriceChannelTimeFrame), "FiboPriceChannel", PriceChannelPeriod, 6, PriceChannelShift); a_icustom_48 = iCustom(Symbol(), txt2tf(PriceChannelTimeFrame), "FiboPriceChannel", PriceChannelPeriod, 1, PriceChannelShift); ad_56 = a_icustom_0 - a_icustom_48; } void ComputePivotPositions(double &ad_0, double &ad_8, double &ad_16, double &ad_24, double &ad_32) { ad_0 = (iHigh(Symbol(), txt2tf(PivotTimeFrame), PivotShift) + iLow(Symbol(), txt2tf(PivotTimeFrame), PivotShift) + iClose(Symbol(), txt2tf(PivotTimeFrame), PivotShift)) / 3.0; ad_8 = ad_0 + (PivotFirstSpacing + PivotSecondSpacing) * gd_760; ad_16 = ad_0 + PivotFirstSpacing * gd_760; ad_24 = ad_0 - PivotFirstSpacing * gd_760; ad_32 = ad_0 - (PivotFirstSpacing + PivotSecondSpacing) * gd_760; } void ComputeFiboPositions(double &ad_0, double &ad_8, double &ad_16, double &ad_24, double &ad_32, double &ad_40, double &ad_48, double &ad_56, double &ad_64, double &ad_72, double &ad_80, double &ad_88, double &ad_96, double &ad_104, double &ad_112, double &ad_120, double &ad_128, double &ad_136, double &ad_144, double &ad_152, double &ad_160, double &ad_168, double &ad_176, double &ad_184, double &ad_192, double &ad_200, double &ad_208) { double ld_216 = iHigh(Symbol(), PERIOD_D1, 1) - iLow(Symbol(), PERIOD_D1, 1); ad_0 = iLow(Symbol(), PERIOD_D1, 1) + 4.0 * ld_216; ad_8 = iLow(Symbol(), PERIOD_D1, 1) + 3.5 * ld_216; ad_16 = iLow(Symbol(), PERIOD_D1, 1) + 3.0 * ld_216; ad_24 = iLow(Symbol(), PERIOD_D1, 1) + 2.5 * ld_216; ad_32 = iLow(Symbol(), PERIOD_D1, 1) + 2.0 * ld_216; ad_40 = iLow(Symbol(), PERIOD_D1, 1) + 1.764 * ld_216; ad_48 = iLow(Symbol(), PERIOD_D1, 1) + 1.618 * ld_216; ad_56 = iLow(Symbol(), PERIOD_D1, 1) + 1.5 * ld_216; ad_64 = iLow(Symbol(), PERIOD_D1, 1) + 1.382 * ld_216; ad_72 = iLow(Symbol(), PERIOD_D1, 1) + 1.236 * ld_216; ad_80 = iLow(Symbol(), PERIOD_D1, 1) + 1.0 * ld_216; ad_88 = iLow(Symbol(), PERIOD_D1, 1) + 0.764 * ld_216; ad_96 = iLow(Symbol(), PERIOD_D1, 1) + 0.618 * ld_216; ad_104 = iLow(Symbol(), PERIOD_D1, 1) + ld_216 / 2.0; ad_112 = iLow(Symbol(), PERIOD_D1, 1) + ld_216 / 2.0; ad_120 = iLow(Symbol(), PERIOD_D1, 1) + 0.236 * ld_216; ad_128 = iLow(Symbol(), PERIOD_D1, 1) + 0.0 * ld_216; ad_136 = iLow(Symbol(), PERIOD_D1, 1) - 0.236 * ld_216; ad_144 = iLow(Symbol(), PERIOD_D1, 1) - ld_216 / 2.0; ad_152 = iLow(Symbol(), PERIOD_D1, 1) - ld_216 / 2.0; ad_160 = iLow(Symbol(), PERIOD_D1, 1) - 0.618 * ld_216; ad_168 = iLow(Symbol(), PERIOD_D1, 1) - 0.764 * ld_216; ad_176 = iLow(Symbol(), PERIOD_D1, 1) - 1.0 * ld_216; ad_184 = iLow(Symbol(), PERIOD_D1, 1) - 1.5 * ld_216; ad_192 = iLow(Symbol(), PERIOD_D1, 1) - 2.0 * ld_216; ad_200 = iLow(Symbol(), PERIOD_D1, 1) - 2.5 * ld_216; ad_208 = iLow(Symbol(), PERIOD_D1, 1) - 3.0 * ld_216; } void ComputeBoxPositions(double &a_high_0, double &a_low_8, double &ad_16, double &ad_24, double &ad_32, double &ad_40) { double ld_56 = iHigh(Symbol(), PERIOD_D1, 1) - iLow(Symbol(), PERIOD_D1, 1); int l_shift_48 = iBarShift(Symbol(), 0, StrToTime(BoxStartTime)); int l_shift_52 = iBarShift(Symbol(), 0, StrToTime(BoxEndTime)); a_high_0 = High[iHighest(Symbol(), 0, MODE_HIGH, l_shift_48 - l_shift_52, l_shift_52)]; a_low_8 = Low[iLowest(Symbol(), 0, MODE_LOW, l_shift_48 - l_shift_52, l_shift_52)]; ad_16 = a_high_0 + (BoxFirstSpacing + BoxSecondSpacing) / 100.0 * ld_56; ad_24 = a_high_0 + BoxFirstSpacing / 100.0 * ld_56; ad_32 = a_low_8 - BoxFirstSpacing / 100.0 * ld_56; ad_40 = a_low_8 - (BoxFirstSpacing + BoxSecondSpacing) / 100.0 * ld_56; } void ComputeFractal(double &a_icustom_0, double &a_icustom_8, double &ad_16) { a_icustom_0 = iCustom(Symbol(), txt2tf(FractalTimeFrame), "FractalChannel", 0, FractalShift); a_icustom_8 = iCustom(Symbol(), txt2tf(FractalTimeFrame), "FractalChannel", 1, FractalShift); ad_16 = a_icustom_0 - a_icustom_8; } void ComputeCamarilla(double &ad_0, double &ad_8, double &ad_16, double &ad_24, double &ad_32, double &ad_40, double &ad_48, double &ad_56, double &ad_64) { double l_ihigh_72 = iHigh(Symbol(), PERIOD_D1, 1); double l_ilow_80 = iLow(Symbol(), PERIOD_D1, 1); double l_iclose_88 = iClose(Symbol(), PERIOD_D1, 1); ad_0 = 0.55 * (l_ihigh_72 - l_ilow_80) + l_iclose_88; ad_8 = l_iclose_88 + 1.1 * (l_ihigh_72 - l_ilow_80) / 4.0; ad_16 = l_iclose_88 + 1.1 * (l_ihigh_72 - l_ilow_80) / 6.0; ad_24 = l_iclose_88 + 1.1 * (l_ihigh_72 - l_ilow_80) / 12.0; ad_32 = (l_ihigh_72 + l_ilow_80 + l_iclose_88) / 3.0; ad_40 = l_iclose_88 - 1.1 * (l_ihigh_72 - l_ilow_80) / 12.0; ad_48 = l_iclose_88 - 1.1 * (l_ihigh_72 - l_ilow_80) / 6.0; ad_56 = l_iclose_88 - 1.1 * (l_ihigh_72 - l_ilow_80) / 4.0; ad_64 = l_iclose_88 - 0.55 * (l_ihigh_72 - l_ilow_80); } void ComputeTeaBreak(double &a_ihigh_0, double &a_ilow_8, double &ad_16) { a_ihigh_0 = iHigh(Symbol(), PERIOD_H4, 1); a_ilow_8 = iLow(Symbol(), PERIOD_H4, 1); ad_16 = a_ihigh_0 - a_ilow_8; } int ComputeFlipCoin() { int li_ret_0; MathSrand(TimeLocal()); if (MathRand() % 2 == 1) li_ret_0 = 1; else li_ret_0 = 2; return (li_ret_0); } void ComputeSDR(double &ad_0, double &ad_8, double &ad_16, double &ad_24, double &ad_32, double &ad_40, double &ad_48, double &ad_56, double &ad_64, double &ad_72) { if (StrToTime(CurrentTime()) >= StrToTime(TradingStartTime) && StrToTime(CurrentTime()) <= StrToTime(TradingEndTime)) { ArrayCopyRates(gda_784, Symbol(), txt2tf(SDRTimeFrame)); ad_0 = gda_784[0][1]; ad_8 = 0; ad_16 = 100000; for (int li_80 = SDRPeriod; li_80 >= 1; li_80--) { ad_8 = MathMax(ad_8, gda_784[li_80][3]); ad_16 = MathMin(ad_16, gda_784[li_80][2]); } ad_24 = ad_8 - ad_16; ad_32 = ad_0 - SDRBuyStopPercent * ad_24 / 100.0; ad_40 = ad_0 + SDRSellStopPercent * ad_24 / 100.0; ad_48 = ad_0 + ad_24 * SDRBuyLevelPercent / 100.0 + MarketInfo(Symbol(), MODE_SPREAD) * gd_760; ad_56 = ad_0 - ad_24 * SDRSellLevelPercent / 100.0 - MarketInfo(Symbol(), MODE_SPREAD) * gd_760; ad_64 = ad_48 + SDRBuyTakeProfitPercent * ad_24 / 100.0; ad_72 = ad_56 - SDRSellTakeProfitPercent * ad_24 / 100.0; } } int MajorTrend(string as_0) { double ld_64; double l_ima_168; double ld_176; double ld_184; double l_ima_192; double ld_200; double ld_208; Volatility_Screen(txt2tf(as_0), l_ima_168, ld_176, ld_184, l_ima_192, ld_200, ld_208); double l_isar_8 = iSAR(Symbol(), txt2tf(as_0), 0.02, 0.2, 0); double l_iadx_16 = iADX(Symbol(), txt2tf(as_0), 14, PRICE_CLOSE, MODE_MAIN, 0); double l_iadx_24 = iADX(Symbol(), txt2tf(as_0), 14, PRICE_CLOSE, MODE_PLUSDI, 0); double l_iadx_32 = iADX(Symbol(), txt2tf(as_0), 14, PRICE_CLOSE, MODE_MINUSDI, 0); double l_imacd_40 = iMACD(Symbol(), txt2tf(as_0), 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0); double l_imacd_48 = iMACD(Symbol(), txt2tf(as_0), 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0); double l_irvi_56 = iRVI(Symbol(), txt2tf(as_0), 10, MODE_MAIN, 0); l_irvi_56 = iRVI(Symbol(), txt2tf(as_0), 10, MODE_SIGNAL, 0); double l_ima_72 = iMA(Symbol(), txt2tf(as_0), 100, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_80 = iMA(Symbol(), txt2tf(as_0), 50, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_88 = iMA(Symbol(), txt2tf(as_0), 25, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_96 = iMA(Symbol(), txt2tf(as_0), 28, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_104 = iMA(Symbol(), txt2tf(as_0), 21, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_112 = iMA(Symbol(), txt2tf(as_0), 14, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_120 = iMA(Symbol(), txt2tf(as_0), 9, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_128 = iMA(Symbol(), txt2tf(as_0), 7, 0, MODE_EMA, PRICE_CLOSE, 0); double l_icustom_136 = iCustom(Symbol(), txt2tf(as_0), "FX5_MACD_Divergence_V1.1", 0, 2); double l_icustom_144 = iCustom(Symbol(), txt2tf(as_0), "FX5_MACD_Divergence_V1.1", 1, 2); double l_icustom_152 = iCustom(Symbol(), txt2tf(as_0), "FX5_Divergence_V2.1", 2, 2); double l_icustom_160 = iCustom(Symbol(), txt2tf(as_0), "FX5_Divergence_V2.1", 3, 2); if (MajorTrendIndicator == 1) { if (GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_isar_8) return (1); if (GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_isar_8) return (2); return (3); } if (MajorTrendIndicator == 2) { if (l_iadx_24 > l_iadx_32) return (1); if (l_iadx_24 < l_iadx_32) return (2); return (3); } if (MajorTrendIndicator == 3) { if (l_imacd_40 > l_imacd_48) return (1); if (l_imacd_40 < l_imacd_48) return (2); return (3); } if (MajorTrendIndicator == 4) { if (l_irvi_56 > ld_64) return (1); if (l_irvi_56 < ld_64) return (2); return (3); } if (MajorTrendIndicator == 5) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96) return (2); return (3); } if (MajorTrendIndicator == 6) { if (l_ima_120 > l_ima_112 && l_ima_112 > l_ima_104 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_ima_88) return (1); if (l_ima_120 < l_ima_112 && l_ima_112 < l_ima_104 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_ima_88) return (2); return (3); } if (MajorTrendIndicator == 7) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_ima_88) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_ima_88) return (2); return (3); } if (MajorTrendIndicator == 8) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_ima_80) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_ima_80) return (2); return (3); } if (MajorTrendIndicator == 9) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96 && l_ima_96 > l_ima_80 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_ima_72) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96 && l_ima_96 < l_ima_80 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_ima_72) return (2); return (3); } if (MajorTrendIndicator == 10) { if (l_icustom_136 != EMPTY_VALUE) return (1); if (l_icustom_144 != EMPTY_VALUE) return (2); return (3); } if (MajorTrendIndicator == 11) { if (l_icustom_152 != EMPTY_VALUE) return (1); if (l_icustom_160 != EMPTY_VALUE) return (2); return (3); } if (MajorTrendIndicator == 12) { if (CandleStickPattern(MajorTrendTimeFrame) == 1 && l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96) return (1); if (CandleStickPattern(MajorTrendTimeFrame) == 2 && l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96) return (2); return (3); } if (MajorTrendIndicator == 13) { if (ld_208 <= ld_184) return (1); if (ld_200 >= ld_176) return (2); return (3); } if (GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_isar_8) return (1); if (GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_isar_8) return (2); return (3); } int MinorTrend(string as_0) { double ld_64; double l_ima_168; double ld_176; double ld_184; double l_ima_192; double ld_200; double ld_208; Volatility_Screen(txt2tf(as_0), l_ima_168, ld_176, ld_184, l_ima_192, ld_200, ld_208); double l_isar_8 = iSAR(Symbol(), txt2tf(as_0), 0.02, 0.2, 0); double l_iadx_16 = iADX(Symbol(), txt2tf(as_0), 14, PRICE_CLOSE, MODE_MAIN, 0); double l_iadx_24 = iADX(Symbol(), txt2tf(as_0), 14, PRICE_CLOSE, MODE_PLUSDI, 0); double l_iadx_32 = iADX(Symbol(), txt2tf(as_0), 14, PRICE_CLOSE, MODE_MINUSDI, 0); double l_imacd_40 = iMACD(Symbol(), txt2tf(as_0), 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0); double l_imacd_48 = iMACD(Symbol(), txt2tf(as_0), 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0); double l_irvi_56 = iRVI(Symbol(), txt2tf(as_0), 10, MODE_MAIN, 0); l_irvi_56 = iRVI(Symbol(), txt2tf(as_0), 10, MODE_SIGNAL, 0); double l_ima_72 = iMA(Symbol(), txt2tf(as_0), 100, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_80 = iMA(Symbol(), txt2tf(as_0), 50, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_88 = iMA(Symbol(), txt2tf(as_0), 25, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_96 = iMA(Symbol(), txt2tf(as_0), 28, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_104 = iMA(Symbol(), txt2tf(as_0), 21, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_112 = iMA(Symbol(), txt2tf(as_0), 14, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_120 = iMA(Symbol(), txt2tf(as_0), 9, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_128 = iMA(Symbol(), txt2tf(as_0), 7, 0, MODE_EMA, PRICE_CLOSE, 0); double l_icustom_136 = iCustom(Symbol(), txt2tf(as_0), "FX5_MACD_Divergence_V1.1", 0, 2); double l_icustom_144 = iCustom(Symbol(), txt2tf(as_0), "FX5_MACD_Divergence_V1.1", 1, 2); double l_icustom_152 = iCustom(Symbol(), txt2tf(as_0), "FX5_Divergence_V2.1", 2, 2); double l_icustom_160 = iCustom(Symbol(), txt2tf(as_0), "FX5_Divergence_V2.1", 3, 2); if (MinorTrendIndicator == 1) { if (GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_isar_8) return (1); if (GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_isar_8) return (2); return (3); } if (MinorTrendIndicator == 2) { if (l_iadx_24 > l_iadx_32) return (1); if (l_iadx_24 < l_iadx_32) return (2); return (3); } if (MinorTrendIndicator == 3) { if (l_imacd_40 > l_imacd_48) return (1); if (l_imacd_40 < l_imacd_48) return (2); return (3); } if (MinorTrendIndicator == 4) { if (l_irvi_56 > ld_64) return (1); if (l_irvi_56 < ld_64) return (2); return (3); } if (MinorTrendIndicator == 5) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96) return (2); return (3); } if (MinorTrendIndicator == 6) { if (l_ima_120 > l_ima_112 && l_ima_112 > l_ima_104 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_ima_88) return (1); if (l_ima_120 < l_ima_112 && l_ima_112 < l_ima_104 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_ima_88) return (2); return (3); } if (MinorTrendIndicator == 7) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_ima_88) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_ima_88) return (2); return (3); } if (MinorTrendIndicator == 8) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_ima_80) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_ima_80) return (2); return (3); } if (MinorTrendIndicator == 9) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96 && l_ima_96 > l_ima_80 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_ima_72) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96 && l_ima_96 < l_ima_80 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_ima_72) return (2); return (3); } if (MinorTrendIndicator == 10) { if (l_icustom_136 != EMPTY_VALUE) return (1); if (l_icustom_144 != EMPTY_VALUE) return (2); return (3); } if (MinorTrendIndicator == 11) { if (l_icustom_152 != EMPTY_VALUE) return (1); if (l_icustom_160 != EMPTY_VALUE) return (2); return (3); } if (MinorTrendIndicator == 12) { if (CandleStickPattern(MinorTrendTimeFrame) == 1 && l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96) return (1); if (CandleStickPattern(MinorTrendTimeFrame) == 2 && l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96) return (2); return (3); } if (MinorTrendIndicator == 13) { if (ld_208 <= ld_184) return (1); if (ld_200 >= ld_176) return (2); return (3); } if (GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_isar_8) return (1); if (GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_isar_8) return (2); return (3); } int ExitSignal(string as_0) { double ld_64; double l_ima_168; double ld_176; double ld_184; double l_ima_192; double ld_200; double ld_208; Volatility_Screen(txt2tf(as_0), l_ima_168, ld_176, ld_184, l_ima_192, ld_200, ld_208); double l_isar_8 = iSAR(Symbol(), txt2tf(as_0), 0.02, 0.2, 0); double l_iadx_16 = iADX(Symbol(), txt2tf(as_0), 14, PRICE_CLOSE, MODE_MAIN, 0); double l_iadx_24 = iADX(Symbol(), txt2tf(as_0), 14, PRICE_CLOSE, MODE_PLUSDI, 0); double l_iadx_32 = iADX(Symbol(), txt2tf(as_0), 14, PRICE_CLOSE, MODE_MINUSDI, 0); double l_imacd_40 = iMACD(Symbol(), txt2tf(as_0), 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0); double l_imacd_48 = iMACD(Symbol(), txt2tf(as_0), 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0); double l_irvi_56 = iRVI(Symbol(), txt2tf(as_0), 10, MODE_MAIN, 0); l_irvi_56 = iRVI(Symbol(), txt2tf(as_0), 10, MODE_SIGNAL, 0); double l_ima_72 = iMA(Symbol(), txt2tf(as_0), 100, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_80 = iMA(Symbol(), txt2tf(as_0), 50, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_88 = iMA(Symbol(), txt2tf(as_0), 25, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_96 = iMA(Symbol(), txt2tf(as_0), 28, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_104 = iMA(Symbol(), txt2tf(as_0), 21, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_112 = iMA(Symbol(), txt2tf(as_0), 14, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_120 = iMA(Symbol(), txt2tf(as_0), 9, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_128 = iMA(Symbol(), txt2tf(as_0), 7, 0, MODE_EMA, PRICE_CLOSE, 0); double l_icustom_136 = iCustom(Symbol(), txt2tf(as_0), "FX5_MACD_Divergence_V1.1", 0, 2); double l_icustom_144 = iCustom(Symbol(), txt2tf(as_0), "FX5_MACD_Divergence_V1.1", 1, 2); double l_icustom_152 = iCustom(Symbol(), txt2tf(as_0), "FX5_Divergence_V2.1", 2, 2); double l_icustom_160 = iCustom(Symbol(), txt2tf(as_0), "FX5_Divergence_V2.1", 3, 2); if (ExitSignalIndicator == 1) { if (GetPrice(3, txt2tf(ExitSignalTimeFrame), 0) > l_isar_8) return (1); if (GetPrice(3, txt2tf(ExitSignalTimeFrame), 0) < l_isar_8) return (2); return (3); } if (ExitSignalIndicator == 2) { if (l_iadx_24 > l_iadx_32) return (1); if (l_iadx_24 < l_iadx_32) return (2); return (3); } if (ExitSignalIndicator == 3) { if (l_imacd_40 > l_imacd_48) return (1); if (l_imacd_40 < l_imacd_48) return (2); return (3); } if (ExitSignalIndicator == 4) { if (l_irvi_56 > ld_64) return (1); if (l_irvi_56 < ld_64) return (2); return (3); } if (ExitSignalIndicator == 5) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96) return (2); return (3); } if (ExitSignalIndicator == 6) { if (l_ima_120 > l_ima_112 && l_ima_112 > l_ima_104 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) > l_ima_88) return (1); if (l_ima_120 < l_ima_112 && l_ima_112 < l_ima_104 && GetPrice(3, txt2tf(EntryPeriodTimeFrame), 1) < l_ima_88) return (2); return (3); } if (ExitSignalIndicator == 7) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96 && GetPrice(3, txt2tf(ExitPeriodTimeFrame), 1) > l_ima_88) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96 && GetPrice(3, txt2tf(ExitPeriodTimeFrame), 1) < l_ima_88) return (2); return (3); } if (ExitSignalIndicator == 8) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96 && GetPrice(3, txt2tf(ExitPeriodTimeFrame), 1) > l_ima_80) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96 && GetPrice(3, txt2tf(ExitPeriodTimeFrame), 1) < l_ima_80) return (2); return (3); } if (ExitSignalIndicator == 9) { if (l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96 && l_ima_96 > l_ima_80 && GetPrice(3, txt2tf(ExitPeriodTimeFrame), 1) > l_ima_72) return (1); if (l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96 && l_ima_96 < l_ima_80 && GetPrice(3, txt2tf(ExitPeriodTimeFrame), 1) < l_ima_72) return (2); return (3); } if (ExitSignalIndicator == 10) { if (l_icustom_136 != EMPTY_VALUE) return (1); if (l_icustom_144 != EMPTY_VALUE) return (2); return (3); } if (ExitSignalIndicator == 11) { if (l_icustom_152 != EMPTY_VALUE) return (1); if (l_icustom_160 != EMPTY_VALUE) return (2); return (3); } if (ExitSignalIndicator == 12) { if (CandleStickPattern(ExitSignalTimeFrame) == 1 && l_ima_128 > l_ima_112 && l_ima_112 > l_ima_96) return (1); if (CandleStickPattern(ExitSignalTimeFrame) == 2 && l_ima_128 < l_ima_112 && l_ima_112 < l_ima_96) return (2); return (3); } if (ExitSignalIndicator == 13) { if (ld_208 <= ld_184) return (1); if (ld_200 >= ld_176) return (2); return (3); } if (GetPrice(3, txt2tf(ExitPeriodTimeFrame), 1) > l_isar_8) return (1); if (GetPrice(3, txt2tf(ExitPeriodTimeFrame), 1) < l_isar_8) return (2); return (3); } void SetLevel(string as_0, double a_price_8, color a_color_16, int a_style_20, int a_width_24, int a_datetime_28, color a_color_32) { string l_name_36 = as_0 + " Label"; string l_name_44 = as_0 + " Line"; if (ObjectFind(l_name_44) != 0) { ObjectCreate(l_name_44, OBJ_TREND, 0, a_datetime_28, a_price_8, Time[0], a_price_8); ObjectSet(l_name_44, OBJPROP_STYLE, a_style_20); ObjectSet(l_name_44, OBJPROP_COLOR, a_color_16); ObjectSet(l_name_44, OBJPROP_WIDTH, a_width_24); } else { ObjectMove(l_name_44, 1, Time[0], a_price_8); ObjectMove(l_name_44, 0, a_datetime_28, a_price_8); } if (ObjectFind(l_name_36) != 0) ObjectCreate(l_name_36, OBJ_TEXT, 0, MathMin(Time[0], a_datetime_28 + 60 * (Period() * 2)), a_price_8); else ObjectMove(l_name_36, 0, MathMin(Time[0], a_datetime_28 + 60 * (Period() * 2)), a_price_8); string l_text_52 = " " + as_0; if (StrToInteger(as_0) == 0) l_text_52 = l_text_52 + ": " + DoubleToStr(a_price_8, Digits); ObjectSetText(l_name_36, l_text_52, 9, "Arial", a_color_32); } void ComputeMMLValues(double &ad_0, double &ad_8, double &ad_16, double &ad_24, double &ad_32, double &ad_40, double &ad_48, double &ad_56, double &ad_64, double &ad_72, double &ad_80, double &ad_88, double &ad_96, double &ad_104) { int li_308; double ld_unused_112 = 0; double ld_120 = 0; double l_low_128 = 0; double l_high_136 = 0; double ld_144 = 0; double ld_152 = 0; double ld_160 = 0; double ld_168 = 0; double ld_176 = 0; double ld_184 = 0; double ld_192 = 0; double ld_200 = 0; double ld_208 = 0; double ld_216 = 0; double ld_224 = 0; double ld_232 = 0; double ld_240 = 0; double ld_248 = 0; double ld_256 = 0; double ld_264 = 0; double ld_272 = 0; double ld_280 = 0; double ld_288 = 0; int l_lowest_296 = 0; int l_highest_300 = 0; int li_unused_304 = 13; bool li_312 = FALSE; bool li_316 = FALSE; int li_unused_320 = 0; int li_unused_324 = 0; if (li_312 != Time[0] || li_316 != Period()) { if (Period() == PERIOD_D1 || 10080 || 43200) li_308 = 5; if (Period() == PERIOD_H4) li_308 = 30; if (Period() == PERIOD_H1) li_308 = 120; if (Period() == PERIOD_M30) li_308 = 240; if (Period() == PERIOD_M15) li_308 = 480; if (Period() == PERIOD_M5) li_308 = 1440; if (Period() == PERIOD_M1) li_308 = 7200; l_lowest_296 = iLowest(NULL, 0, MODE_LOW, li_308, 0); l_highest_300 = iHighest(NULL, 0, MODE_HIGH, li_308, 0); l_low_128 = Low[l_lowest_296]; l_high_136 = High[l_highest_300]; if (l_high_136 <= 250000.0 && l_high_136 > 25000.0) ld_264 = 100000; else { if (l_high_136 <= 25000.0 && l_high_136 > 2500.0) ld_264 = 10000; else { if (l_high_136 <= 2500.0 && l_high_136 > 250.0) ld_264 = 1000; else { if (l_high_136 <= 250.0 && l_high_136 > 25.0) ld_264 = 100; else { if (l_high_136 <= 25.0 && l_high_136 > 12.5) ld_264 = 12.5; else { if (l_high_136 <= 12.5 && l_high_136 > 6.25) ld_264 = 12.5; else { if (l_high_136 <= 6.25 && l_high_136 > 3.125) ld_264 = 6.25; else { if (l_high_136 <= 3.125 && l_high_136 > 1.5625) ld_264 = 3.125; else { if (l_high_136 <= 1.5625 && l_high_136 > 0.390625) ld_264 = 1.5625; else if (l_high_136 <= 0.390625 && l_high_136 > 0.0) ld_264 = 0.1953125; } } } } } } } } ld_272 = l_high_136 - l_low_128; ld_120 = MathFloor(MathLog(ld_264 / ld_272) / MathLog(2)); ld_256 = ld_264 * MathPow(0.5, ld_120); ld_144 = MathFloor(l_low_128 / ld_256) * ld_256; if (ld_144 + ld_256 > l_high_136) ld_152 = ld_144 + ld_256; else ld_152 = ld_144 + 2.0 * ld_256; if (l_low_128 >= 3.0 * (ld_152 - ld_144) / 16.0 + ld_144 && l_high_136 <= 9.0 * (ld_152 - ld_144) / 16.0 + ld_144) ld_168 = ld_144 + (ld_152 - ld_144) / 2.0; else ld_168 = 0; if (l_low_128 >= ld_144 - (ld_152 - ld_144) / 8.0 && l_high_136 <= 5.0 * (ld_152 - ld_144) / 8.0 + ld_144 && ld_168 == 0.0) ld_160 = ld_144 + (ld_152 - ld_144) / 2.0; else ld_160 = 0; if (l_low_128 >= ld_144 + 7.0 * (ld_152 - ld_144) / 16.0 && l_high_136 <= 13.0 * (ld_152 - ld_144) / 16.0 + ld_144) ld_184 = ld_144 + 3.0 * (ld_152 - ld_144) / 4.0; else ld_184 = 0; if (l_low_128 >= ld_144 + 3.0 * (ld_152 - ld_144) / 8.0 && l_high_136 <= 9.0 * (ld_152 - ld_144) / 8.0 + ld_144 && ld_184 == 0.0) ld_192 = ld_152; else ld_192 = 0; if (l_low_128 >= ld_144 + (ld_152 - ld_144) / 8.0 && l_high_136 <= 7.0 * (ld_152 - ld_144) / 8.0 + ld_144 && ld_160 == 0.0 && ld_168 == 0.0 && ld_184 == 0.0 && ld_192 == 0.0) ld_176 = ld_144 + 3.0 * (ld_152 - ld_144) / 4.0; else ld_176 = 0; if (ld_160 + ld_168 + ld_176 + ld_184 + ld_192 == 0.0) ld_200 = ld_152; else ld_200 = 0; ld_280 = ld_160 + ld_168 + ld_176 + ld_184 + ld_192 + ld_200; if (ld_160 > 0.0) ld_208 = ld_144; else ld_208 = 0; if (ld_168 > 0.0) ld_216 = ld_144 + (ld_152 - ld_144) / 4.0; else ld_216 = 0; if (ld_176 > 0.0) ld_224 = ld_144 + (ld_152 - ld_144) / 4.0; else ld_224 = 0; if (ld_184 > 0.0) ld_232 = ld_144 + (ld_152 - ld_144) / 2.0; else ld_232 = 0; if (ld_192 > 0.0) ld_240 = ld_144 + (ld_152 - ld_144) / 2.0; else ld_240 = 0; if (ld_280 > 0.0 && ld_208 + ld_216 + ld_224 + ld_232 + ld_240 == 0.0) ld_248 = ld_144; else ld_248 = 0; ld_288 = ld_208 + ld_216 + ld_224 + ld_232 + ld_240 + ld_248; ad_0 = NormalizeDouble((ld_280 - ld_288) / 8.0, Digits); ad_8 = ld_288 - 2.0 * ad_0; ad_16 = ad_8 + ad_0; ad_24 = ad_16 + ad_0; ad_32 = ad_24 + ad_0; ad_40 = ad_32 + ad_0; ad_48 = ad_40 + ad_0; ad_56 = ad_48 + ad_0; ad_64 = ad_56 + ad_0; ad_72 = ad_64 + ad_0; ad_80 = ad_72 + ad_0; ad_88 = ad_80 + ad_0; ad_96 = ad_88 + ad_0; ad_104 = ad_96 + ad_0; } } int CandleStickPattern(string as_0) { if (Check_HRR_Bullish_Candles(txt2tf(as_0)) == 1 || Check_HRR_Bullish_Candles(txt2tf(as_0)) == 2 || Check_HRR_Bullish_Candles(txt2tf(as_0)) == 3 || Check_HRR_Bullish_Candles(txt2tf(as_0)) == 4 || Check_HRR_Bullish_Candles(txt2tf(as_0)) == 5 || Check_HRR_Bullish_Candles(txt2tf(as_0)) == 6 || Check_HRR_Bullish_Candles(txt2tf(as_0)) == 7 || Check_HRR_Bullish_Candles(txt2tf(as_0)) == 8 || Check_HRR_Bullish_Candles(txt2tf(as_0)) == 9 || Check_HRR_Bullish_Candles(txt2tf(as_0)) == 10 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 21 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 22 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 23 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 24 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 25 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 26 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 27 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 28 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 29 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 30 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 31 || Check_MRR_Bullish_Candles(txt2tf(as_0)) == 32) return (1); if (Check_HRR_Bearish_Candles(txt2tf(as_0)) == 61 || Check_HRR_Bearish_Candles(txt2tf(as_0)) == 62 || Check_HRR_Bearish_Candles(txt2tf(as_0)) == 63 || Check_HRR_Bearish_Candles(txt2tf(as_0)) == 64 || Check_HRR_Bearish_Candles(txt2tf(as_0)) == 65 || Check_HRR_Bearish_Candles(txt2tf(as_0)) == 66 || Check_HRR_Bearish_Candles(txt2tf(as_0)) == 67 || Check_HRR_Bearish_Candles(txt2tf(as_0)) == 68 || Check_HRR_Bearish_Candles(txt2tf(as_0)) == 69 || Check_HRR_Bearish_Candles(txt2tf(as_0)) == 70 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 81 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 82 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 83 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 84 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 85 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 86 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 87 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 88 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 89 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 90 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 91 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 92 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 93 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 94 || Check_MRR_Bearish_Candles(txt2tf(as_0)) == 95) return (2); return (0); } int Check_HRR_Bullish_Candles(int a_timeframe_0) { int li_ret_4 = 0; double ld_8 = 0; double ld_16 = 0; double ld_24 = 0; double ld_32 = 0; double ld_40 = 0; double ld_48 = 0; double l_iopen_56 = 0; double l_iopen_64 = 0; double l_iopen_72 = 0; double l_iopen_80 = 0; double l_iopen_88 = 0; double l_ihigh_96 = 0; double l_ihigh_104 = 0; double l_ihigh_112 = 0; double l_ihigh_120 = 0; double l_ihigh_128 = 0; double l_ihigh_136 = 0; double l_ihigh_144 = 0; double l_ihigh_152 = 0; double l_ihigh_160 = 0; double l_ihigh_168 = 0; double ld_unused_176 = 0; double ld_unused_184 = 0; double ld_unused_192 = 0; double ld_unused_200 = 0; double ld_unused_208 = 0; double ld_unused_216 = 0; double ld_unused_224 = 0; double ld_unused_232 = 0; double ld_unused_240 = 0; double ld_unused_248 = 0; double l_ilow_256 = 0; double l_ilow_264 = 0; double l_ilow_272 = 0; double l_ilow_280 = 0; double l_ilow_288 = 0; double l_ilow_296 = 0; double l_ilow_304 = 0; double l_iclose_312 = 0; double l_iclose_320 = 0; double l_iclose_328 = 0; double l_iclose_336 = 0; double l_iclose_344 = 0; double l_iclose_352 = 0; double l_iclose_360 = 0; int li_368 = 0; int li_unused_372 = 0; int li_unused_376 = 0; int li_unused_380 = 0; int li_unused_384 = 0; int li_unused_388 = 0; int li_unused_392 = 0; int li_unused_396 = 0; int li_unused_400 = 0; int li_unused_404 = 0; int li_unused_408 = 0; l_iopen_56 = iOpen(Symbol(), a_timeframe_0, 1); l_iopen_64 = iOpen(Symbol(), a_timeframe_0, 2); l_iopen_72 = iOpen(Symbol(), a_timeframe_0, 3); l_iopen_80 = iOpen(Symbol(), a_timeframe_0, 4); l_iopen_88 = iOpen(Symbol(), a_timeframe_0, 5); l_ihigh_96 = iHigh(Symbol(), a_timeframe_0, 1); l_ihigh_104 = iHigh(Symbol(), a_timeframe_0, 2); l_ihigh_112 = iHigh(Symbol(), a_timeframe_0, 3); l_ihigh_120 = iHigh(Symbol(), a_timeframe_0, 4); l_ihigh_128 = iHigh(Symbol(), a_timeframe_0, 5); l_ihigh_136 = iHigh(Symbol(), a_timeframe_0, 6); l_ihigh_144 = iHigh(Symbol(), a_timeframe_0, 7); l_ihigh_152 = iHigh(Symbol(), a_timeframe_0, 8); l_ihigh_160 = iHigh(Symbol(), a_timeframe_0, 9); l_ihigh_168 = iHigh(Symbol(), a_timeframe_0, 10); l_ilow_256 = iLow(Symbol(), a_timeframe_0, 1); l_ilow_264 = iLow(Symbol(), a_timeframe_0, 2); l_ilow_272 = iLow(Symbol(), a_timeframe_0, 3); l_ilow_280 = iLow(Symbol(), a_timeframe_0, 4); l_ilow_288 = iLow(Symbol(), a_timeframe_0, 5); l_ilow_296 = iLow(Symbol(), a_timeframe_0, 6); l_ilow_304 = iLow(Symbol(), a_timeframe_0, 7); l_iclose_312 = iClose(Symbol(), a_timeframe_0, 1); l_iclose_320 = iClose(Symbol(), a_timeframe_0, 2); l_iclose_328 = iClose(Symbol(), a_timeframe_0, 3); l_iclose_336 = iClose(Symbol(), a_timeframe_0, 4); l_iclose_344 = iClose(Symbol(), a_timeframe_0, 5); l_iclose_352 = iClose(Symbol(), a_timeframe_0, 6); l_iclose_360 = iClose(Symbol(), a_timeframe_0, 7); ld_8 = 0; for (li_368 = 1; li_368 < 22; li_368++) ld_8 += iHigh(Symbol(), a_timeframe_0, li_368); ld_16 = ld_8 / 21.0; ld_8 = 0; for (li_368 = 2; li_368 < 23; li_368++) ld_8 += iHigh(Symbol(), a_timeframe_0, li_368); ld_40 = ld_8 / 21.0; ld_8 = 0; for (li_368 = 1; li_368 < 22; li_368++) ld_8 += iLow(Symbol(), a_timeframe_0, li_368); ld_24 = ld_8 / 21.0; ld_8 = 0; for (li_368 = 2; li_368 < 23; li_368++) ld_8 += iLow(Symbol(), a_timeframe_0, li_368); ld_32 = ld_8 / 21.0; ld_48 = MathMax(l_ihigh_168, l_ihigh_160); ld_48 = MathMax(ld_48, l_ihigh_152); ld_48 = MathMax(ld_48, l_ihigh_144); ld_48 = MathMax(ld_48, l_ihigh_136); ld_48 = MathMax(ld_48, l_ihigh_144); ld_48 = MathMax(ld_48, l_ihigh_136); ld_48 = MathMax(ld_48, l_ihigh_128); ld_48 = MathMax(ld_48, l_ihigh_120); ld_48 = MathMax(ld_48, l_ihigh_112); ld_48 = MathMax(ld_48, l_ihigh_104); ld_48 = MathMax(ld_48, l_ihigh_96); if ((l_ilow_256 < l_ilow_264 && l_ilow_264 < l_ilow_272 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_ihigh_96 < l_ihigh_104 && l_ihigh_104 < l_ihigh_112 && l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_iclose_312 > l_iopen_56 && l_iopen_56 < l_ilow_264 && l_iclose_312 < l_iopen_64 && l_iclose_312 > (l_iopen_64 - l_iclose_320) / 2.01 + l_iclose_320) || (l_ilow_256 < l_ilow_264 && l_ilow_264 < l_ilow_272 && l_ilow_272 < l_ilow_280 && l_ihigh_96 < l_ihigh_104 && l_ihigh_104 < l_ihigh_112 && l_ihigh_112 < l_ihigh_120 && l_iclose_312 > l_iopen_56 && l_iopen_56 < l_ilow_264 && l_iclose_312 < l_iopen_64 && l_iclose_312 > (l_iopen_64 - l_iclose_320) / 2.01 + l_iclose_320) || (l_ilow_256 < l_ilow_264 && l_ilow_264 < l_ilow_272 && l_ihigh_96 < l_ihigh_104 && l_ihigh_104 < l_ihigh_112 && l_iclose_312 > l_iopen_56 && l_iopen_56 < l_ilow_264 && l_iclose_312 < l_iopen_64 && l_iclose_312 > (l_iopen_64 - l_iclose_320) / 2.01 + l_iclose_320) || (l_ilow_256 < l_ilow_264 && l_ihigh_96 < l_ihigh_104 && l_iclose_312 > l_iopen_56 && l_iopen_56 < l_ilow_264 && l_iclose_312 < l_iopen_64 && l_iclose_312 > (l_iopen_64 - l_iclose_320) / 2.01 + l_iclose_320)) { li_unused_372 = 1; li_ret_4 = 1; return (li_ret_4); } if (l_iopen_64 > l_iclose_320 && l_ihigh_104 == l_iopen_64 && l_ilow_264 == l_iclose_320 && l_iclose_312 > l_iopen_56 && l_ihigh_96 == l_iclose_312 && l_ilow_256 == l_iopen_56 && l_iopen_56 > l_iopen_64 && l_iopen_64 - l_iclose_320 > gd_760 && l_iclose_312 - l_iopen_56 > gd_760) { li_unused_376 = 1; li_ret_4 = 2; return (li_ret_4); } if ((l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ihigh_128 < l_ihigh_136 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_ilow_288 < l_ilow_296 && l_iopen_72 > l_iclose_328 && l_iopen_64 == l_iclose_320 && l_ihigh_104 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_iclose_312 > l_iopen_56 && l_ilow_256 > l_ihigh_104 && l_iclose_312 - l_iopen_56 > gd_760) || (l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_iopen_72 > l_iclose_328 && l_iopen_64 == l_iclose_320 && l_ihigh_104 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_iclose_312 > l_iopen_56 && l_ilow_256 > l_ihigh_104 && l_iclose_312 - l_iopen_56 > gd_760) || (l_ihigh_112 < l_ihigh_120 && l_ilow_272 < l_ilow_280 && l_iopen_72 > l_iclose_328 && l_iopen_64 == l_iclose_320 && l_ihigh_104 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_iclose_312 > l_iopen_56 && l_ilow_256 > l_ihigh_104 && l_iclose_312 - l_iopen_56 > gd_760) || (l_iopen_72 > l_iclose_328 && l_iopen_64 == l_iclose_320 && l_ihigh_104 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_iclose_312 > l_iopen_56 && l_ilow_256 > l_ihigh_104 && l_iclose_312 - l_iopen_56 > gd_760)) { li_unused_380 = 1; li_ret_4 = 3; return (li_ret_4); } if ((l_ihigh_104 < l_ihigh_112 && l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ihigh_128 < l_ihigh_136 && l_ilow_264 < l_ilow_272 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_ilow_288 < l_ilow_296 && l_iopen_72 > l_iclose_328 && l_iopen_64 < l_ilow_272 && l_iopen_64 == l_iclose_320 && l_ihigh_104 > l_iopen_64 && l_ilow_264 < l_iopen_64 && l_iclose_312 > l_iopen_56 && l_iopen_56 > l_iclose_320) || (l_ihigh_104 < l_ihigh_112 && l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ilow_264 < l_ilow_272 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_iopen_72 > l_iclose_328 && l_iopen_64 < l_ilow_272 && l_iopen_64 == l_iclose_320 && l_ihigh_104 > l_iopen_64 && l_ilow_264 < l_iopen_64 && l_iclose_312 > l_iopen_56 && l_iopen_56 > l_iclose_320) || (l_ihigh_104 < l_ihigh_112 && l_ihigh_112 < l_ihigh_120 && l_ilow_264 < l_ilow_272 && l_ilow_272 < l_ilow_280 && l_iopen_72 > l_iclose_328 && l_iopen_64 < l_ilow_272 && l_iopen_64 == l_iclose_320 && l_ihigh_104 > l_iopen_64 && l_ilow_264 < l_iopen_64 && l_iclose_312 > l_iopen_56 && l_iopen_56 > l_iclose_320) || (l_ihigh_104 < l_ihigh_112 && l_ilow_264 < l_ilow_272 && l_iopen_72 > l_iclose_328 && l_iopen_64 < l_ilow_272 && l_iopen_64 == l_iclose_320 && l_ihigh_104 > l_iopen_64 && l_ilow_264 < l_iopen_64 && l_iclose_312 > l_iopen_56 && l_iopen_56 > l_iclose_320)) { li_unused_384 = 1; li_ret_4 = 4; return (li_ret_4); } if ((l_ihigh_104 < l_ihigh_112 && l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ihigh_128 < l_ihigh_136 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_ilow_288 < l_ilow_296 && l_iopen_72 > l_iclose_328 && MathAbs(l_iclose_320 - l_iopen_64) > gd_760 && (l_iclose_320 > l_iopen_64 && l_iopen_64 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_ilow_264 < l_iopen_64 && l_ihigh_104 > l_iclose_320 && l_iclose_320 - l_iopen_64 > gd_760 && l_ihigh_104 - l_ilow_264 > 2.0 * (l_iclose_320 - l_iopen_64)) || (l_iopen_64 > l_iclose_320 && l_iopen_64 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_ilow_264 < l_iclose_320 && l_ihigh_104 > l_iopen_64 && l_iopen_64 - l_iclose_320 > gd_760 && l_ihigh_104 - l_ilow_264 > 2.0 * (l_iopen_64 - l_iclose_320)) && l_iclose_312 > l_iopen_56 && l_iopen_56 >= l_ihigh_104) || (l_ihigh_104 < l_ihigh_112 && l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_iopen_72 > l_iclose_328 && MathAbs(l_iclose_320 - l_iopen_64) > gd_760 && (l_iclose_320 > l_iopen_64 && l_iopen_64 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_ilow_264 < l_iopen_64 && l_ihigh_104 > l_iclose_320 && l_iclose_320 - l_iopen_64 > gd_760 && l_ihigh_104 - l_ilow_264 > 2.0 * (l_iclose_320 - l_iopen_64)) || (l_iopen_64 > l_iclose_320 && l_iopen_64 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_ilow_264 < l_iclose_320 && l_ihigh_104 > l_iopen_64 && l_iopen_64 - l_iclose_320 > gd_760 && l_ihigh_104 - l_ilow_264 > 2.0 * (l_iopen_64 - l_iclose_320)) && l_iclose_312 > l_iopen_56 && l_iopen_56 >= l_ihigh_104) || (l_ihigh_104 < l_ihigh_112 && l_ihigh_112 < l_ihigh_120 && l_ilow_272 < l_ilow_280 && l_iopen_72 > l_iclose_328 && MathAbs(l_iclose_320 - l_iopen_64) > gd_760 && (l_iclose_320 > l_iopen_64 && l_iopen_64 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_ilow_264 < l_iopen_64 && l_ihigh_104 > l_iclose_320 && l_iclose_320 - l_iopen_64 > gd_760 && l_ihigh_104 - l_ilow_264 > 2.0 * (l_iclose_320 - l_iopen_64)) || (l_iopen_64 > l_iclose_320 && l_iopen_64 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_ilow_264 < l_iclose_320 && l_ihigh_104 > l_iopen_64 && l_iopen_64 - l_iclose_320 > gd_760 && l_ihigh_104 - l_ilow_264 > 2.0 * (l_iopen_64 - l_iclose_320)) && l_iclose_312 > l_iopen_56 && l_iopen_56 >= l_ihigh_104) || (l_ihigh_104 < l_ihigh_112 && l_iopen_72 > l_iclose_328 && MathAbs(l_iclose_320 - l_iopen_64) > gd_760 && (l_iclose_320 > l_iopen_64 && l_iopen_64 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_ilow_264 < l_iopen_64 && l_ihigh_104 > l_iclose_320 && l_iclose_320 - l_iopen_64 > gd_760 && l_ihigh_104 - l_ilow_264 > 2.0 * (l_iclose_320 - l_iopen_64)) || (l_iopen_64 > l_iclose_320 && l_iopen_64 < l_ilow_272 && l_ilow_264 < l_ilow_272 && l_ilow_264 < l_iclose_320 && l_ihigh_104 > l_iopen_64 && l_iopen_64 - l_iclose_320 > gd_760 && l_ihigh_104 - l_ilow_264 > 2.0 * (l_iopen_64 - l_iclose_320)) && l_iclose_312 > l_iopen_56 && l_iopen_56 >= l_ihigh_104)) { li_unused_388 = 1; li_ret_4 = 5; return (li_ret_4); } if ((l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ihigh_128 < l_ihigh_136 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_ilow_288 < l_ilow_296 && l_iopen_72 > l_iclose_328 && l_iclose_320 > l_iopen_64 && (l_iopen_64 > l_iclose_328 && l_iclose_320 <= l_iopen_72) || (l_iopen_64 >= l_iclose_328 && l_iclose_320 < l_iopen_72) && l_iclose_312 > l_iopen_56 && l_iclose_312 > l_iclose_320 && l_ilow_256 > l_ilow_272) || (l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_iopen_72 > l_iclose_328 && l_iclose_320 > l_iopen_64 && (l_iopen_64 > l_iclose_328 && l_iclose_320 <= l_iopen_72) || (l_iopen_64 >= l_iclose_328 && l_iclose_320 < l_iopen_72) && l_iclose_312 > l_iopen_56 && l_iclose_312 > l_iclose_320 && l_ilow_256 > l_ilow_272) || (l_ihigh_112 < l_ihigh_120 && l_ilow_272 < l_ilow_280 && l_iopen_72 > l_iclose_328 && l_iclose_320 > l_iopen_64 && (l_iopen_64 > l_iclose_328 && l_iclose_320 <= l_iopen_72) || (l_iopen_64 >= l_iclose_328 && l_iclose_320 < l_iopen_72) && l_iclose_312 > l_iopen_56 && l_iclose_312 > l_iclose_320 && l_ilow_256 > l_ilow_272) || (l_iopen_72 > l_iclose_328 && l_iclose_320 > l_iopen_64 && (l_iopen_64 > l_iclose_328 && l_iclose_320 <= l_iopen_72) || (l_iopen_64 >= l_iclose_328 && l_iclose_320 < l_iopen_72) && l_iclose_312 > l_iopen_56 && l_iclose_312 > l_iclose_320 && l_ilow_256 > l_ilow_272)) { li_unused_392 = 1; li_ret_4 = 6; return (li_ret_4); } if ((l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_ilow_288 < l_ilow_296 && l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ihigh_128 < l_ihigh_136 && l_iopen_72 > l_iclose_328 && l_iclose_320 > l_iopen_64 && l_iopen_64 < l_iclose_328 && l_iclose_320 > l_iopen_72 && l_iclose_312 > l_iopen_56 && l_iclose_312 > l_iclose_320) || (l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_iopen_72 > l_iclose_328 && l_iclose_320 > l_iopen_64 && l_iopen_64 < l_iclose_328 && l_iclose_320 > l_iopen_72 && l_iclose_312 > l_iopen_56 && l_iclose_312 > l_iclose_320) || (l_ilow_272 < l_ilow_280 && l_ihigh_112 < l_ihigh_120 && l_iopen_72 > l_iclose_328 && l_iclose_320 > l_iopen_64 && l_iopen_64 < l_iclose_328 && l_iclose_320 > l_iopen_72 && l_iclose_312 > l_iopen_56 && l_iclose_312 > l_iclose_320) || (l_iopen_72 > l_iclose_328 && l_iclose_320 > l_iopen_64 && l_iopen_64 < l_iclose_328 && l_iclose_320 > l_iopen_72 && l_iclose_312 > l_iopen_56 && l_iclose_312 > l_iclose_320)) { li_unused_396 = 1; li_ret_4 = 7; return (li_ret_4); } if ((l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ihigh_128 < l_ihigh_136 && l_ihigh_136 < l_ihigh_144 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_ilow_288 < l_ilow_296 && l_ilow_296 < l_ilow_304 && l_iopen_72 < l_ilow_280 && l_iclose_328 > l_iopen_72 && l_iclose_320 > l_iopen_64 && l_iclose_312 > l_iopen_56 && l_ihigh_112 < l_ihigh_104 && l_ihigh_104 < l_ihigh_96 && l_ilow_272 < l_ilow_264 && l_ilow_264 < l_ilow_256 && l_iopen_64 <= l_iclose_328 && l_iopen_56 <= l_iclose_320) || (l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ihigh_128 < l_ihigh_136 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_ilow_288 < l_ilow_296 && l_iopen_72 < l_ilow_280 && l_iclose_328 > l_iopen_72 && l_iclose_320 > l_iopen_64 && l_iclose_312 > l_iopen_56 && l_ihigh_112 < l_ihigh_104 && l_ihigh_104 < l_ihigh_96 && l_ilow_272 < l_ilow_264 && l_ilow_264 < l_ilow_256 && l_iopen_64 <= l_iclose_328 && l_iopen_56 <= l_iclose_320) || (l_ihigh_112 < l_ihigh_120 && l_ihigh_120 < l_ihigh_128 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288 && l_iopen_72 < l_ilow_280 && l_iclose_328 > l_iopen_72 && l_iclose_320 > l_iopen_64 && l_iclose_312 > l_iopen_56 && l_ihigh_112 < l_ihigh_104 && l_ihigh_104 < l_ihigh_96 && l_ilow_272 < l_ilow_264 && l_ilow_264 < l_ilow_256 && l_iopen_64 <= l_iclose_328 && l_iopen_56 <= l_iclose_320) || (l_iopen_72 < l_ilow_280 && l_iclose_328 > l_iopen_72 && l_iclose_320 > l_iopen_64 && l_iclose_312 > l_iopen_56 && l_ihigh_112 < l_ihigh_104 && l_ihigh_104 < l_ihigh_96 && l_ilow_272 < l_ilow_264 && l_ilow_264 < l_ilow_256 && l_iopen_64 <= l_iclose_328 && l_iopen_56 <= l_iclose_320)) { li_unused_400 = 1; li_ret_4 = 8; return (li_ret_4); } if (l_iopen_80 == l_ihigh_120 && l_iclose_336 == l_ilow_280 && l_iopen_72 == l_ihigh_112 && l_iclose_328 == l_ilow_272 && l_iclose_320 < l_iopen_64 && l_iopen_64 < l_iclose_328 && l_ihigh_104 > l_iclose_328 && l_iopen_56 == l_ihigh_96 && l_iclose_312 == l_ilow_256 && l_ihigh_96 > l_ihigh_104 && l_ilow_256 < l_ilow_264) { li_unused_404 = 1; li_ret_4 = 9; return (li_ret_4); } if (l_ilow_256 == l_ilow_264 && MathAbs(l_iclose_312 - l_iopen_56) < 0.2 * MathAbs(l_iclose_320 - l_iopen_64) && MathAbs(l_iclose_320 - l_iopen_64) >= 0.9 * (l_ihigh_104 - l_ilow_264) && l_ihigh_104 - l_ilow_264 >= 1.3 * (ld_16 - ld_24)) { li_unused_408 = 1; li_ret_4 = 10; return (li_ret_4); } return (li_ret_4); } int Check_MRR_Bullish_Candles(int a_timeframe_0) { int li_ret_4 = 0; double ld_8 = 0; double ld_16 = 0; double ld_24 = 0; double ld_32 = 0; double ld_40 = 0; double ld_48 = 0; double ld_56 = 0; double ld_64 = 0; double l_iopen_72 = 0; double l_iopen_80 = 0; double l_iopen_88 = 0; double l_iopen_96 = 0; double l_iopen_104 = 0; double l_iopen_112 = 0; double l_iopen_120 = 0; double l_ihigh_128 = 0; double l_ihigh_136 = 0; double l_ihigh_144 = 0; double l_ihigh_152 = 0; double l_ihigh_160 = 0; double l_ihigh_168 = 0; double l_ihigh_176 = 0; double l_ihigh_184 = 0; double l_ihigh_192 = 0; double l_ihigh_200 = 0; double ld_unused_208 = 0; double ld_unused_216 = 0; double ld_unused_224 = 0; double ld_unused_232 = 0; double ld_unused_240 = 0; double ld_unused_248 = 0; double ld_unused_256 = 0; double ld_unused_264 = 0; double ld_unused_272 = 0; double ld_unused_280 = 0; double l_ilow_288 = 0; double l_ilow_296 = 0; double l_ilow_304 = 0; double l_ilow_312 = 0; double l_ilow_320 = 0; double l_ilow_328 = 0; double l_ilow_336 = 0; double l_ilow_344 = 0; double l_iclose_352 = 0; double l_iclose_360 = 0; double l_iclose_368 = 0; double l_iclose_376 = 0; double l_iclose_384 = 0; double l_iclose_392 = 0; double l_iclose_400 = 0; int li_408 = 0; int li_unused_412 = 0; int li_unused_416 = 0; int li_unused_420 = 0; int li_unused_424 = 0; int li_unused_428 = 0; int li_unused_432 = 0; int li_unused_436 = 0; int li_unused_440 = 0; int li_unused_444 = 0; int li_unused_448 = 0; int li_unused_452 = 0; int li_unused_456 = 0; int li_unused_460 = 0; int li_unused_464 = 0; int li_unused_468 = 0; int li_unused_472 = 0; l_iopen_72 = iOpen(Symbol(), a_timeframe_0, 1); l_iopen_80 = iOpen(Symbol(), a_timeframe_0, 2); l_iopen_88 = iOpen(Symbol(), a_timeframe_0, 3); l_iopen_96 = iOpen(Symbol(), a_timeframe_0, 4); l_iopen_104 = iOpen(Symbol(), a_timeframe_0, 5); l_iopen_112 = iOpen(Symbol(), a_timeframe_0, 6); l_iopen_120 = iOpen(Symbol(), a_timeframe_0, 7); l_ihigh_128 = iHigh(Symbol(), a_timeframe_0, 1); l_ihigh_136 = iHigh(Symbol(), a_timeframe_0, 2); l_ihigh_144 = iHigh(Symbol(), a_timeframe_0, 3); l_ihigh_152 = iHigh(Symbol(), a_timeframe_0, 4); l_ihigh_160 = iHigh(Symbol(), a_timeframe_0, 5); l_ihigh_168 = iHigh(Symbol(), a_timeframe_0, 6); l_ihigh_176 = iHigh(Symbol(), a_timeframe_0, 7); l_ihigh_184 = iHigh(Symbol(), a_timeframe_0, 8); l_ihigh_192 = iHigh(Symbol(), a_timeframe_0, 9); l_ihigh_200 = iHigh(Symbol(), a_timeframe_0, 10); l_ilow_288 = iLow(Symbol(), a_timeframe_0, 1); l_ilow_296 = iLow(Symbol(), a_timeframe_0, 2); l_ilow_304 = iLow(Symbol(), a_timeframe_0, 3); l_ilow_312 = iLow(Symbol(), a_timeframe_0, 4); l_ilow_320 = iLow(Symbol(), a_timeframe_0, 5); l_ilow_328 = iLow(Symbol(), a_timeframe_0, 6); l_ilow_336 = iLow(Symbol(), a_timeframe_0, 7); l_ilow_344 = iLow(Symbol(), a_timeframe_0, 8); l_iclose_352 = iClose(Symbol(), a_timeframe_0, 1); l_iclose_360 = iClose(Symbol(), a_timeframe_0, 2); l_iclose_368 = iClose(Symbol(), a_timeframe_0, 3); l_iclose_376 = iClose(Symbol(), a_timeframe_0, 4); l_iclose_384 = iClose(Symbol(), a_timeframe_0, 5); l_iclose_392 = iClose(Symbol(), a_timeframe_0, 6); l_iclose_400 = iClose(Symbol(), a_timeframe_0, 7); ld_8 = 0; for (li_408 = 1; li_408 < 22; li_408++) ld_8 += iHigh(Symbol(), a_timeframe_0, li_408); ld_16 = ld_8 / 21.0; ld_8 = 0; for (li_408 = 2; li_408 < 23; li_408++) ld_8 += iHigh(Symbol(), a_timeframe_0, li_408); ld_40 = ld_8 / 21.0; ld_8 = 0; for (li_408 = 1; li_408 < 22; li_408++) ld_8 += iLow(Symbol(), a_timeframe_0, li_408); ld_24 = ld_8 / 21.0; ld_8 = 0; for (li_408 = 2; li_408 < 23; li_408++) ld_8 += iLow(Symbol(), a_timeframe_0, li_408); ld_32 = ld_8 / 21.0; ld_8 = 0; for (li_408 = 5; li_408 < 26; li_408++) ld_8 += iHigh(Symbol(), a_timeframe_0, li_408); ld_56 = ld_8 / 21.0; ld_8 = 0; for (li_408 = 5; li_408 < 26; li_408++) ld_8 += iLow(Symbol(), a_timeframe_0, li_408); ld_48 = ld_8 / 21.0; ld_64 = MathMax(l_ihigh_200, l_ihigh_192); ld_64 = MathMax(ld_64, l_ihigh_184); ld_64 = MathMax(ld_64, l_ihigh_176); ld_64 = MathMax(ld_64, l_ihigh_168); ld_64 = MathMax(ld_64, l_ihigh_176); ld_64 = MathMax(ld_64, l_ihigh_168); ld_64 = MathMax(ld_64, l_ihigh_160); ld_64 = MathMax(ld_64, l_ihigh_152); ld_64 = MathMax(ld_64, l_ihigh_144); ld_64 = MathMax(ld_64, l_ihigh_136); ld_64 = MathMax(ld_64, l_ihigh_128); if ((l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_ilow_288 < l_ilow_296 && l_iopen_72 == l_iclose_352 && l_ihigh_128 == l_iopen_72 && l_ilow_288 < l_iopen_72 - 2.0 * gd_760) || (l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_288 < l_ilow_296 && l_iopen_72 == l_iclose_352 && l_ihigh_128 == l_iopen_72 && l_ilow_288 < l_iopen_72 - 2.0 * gd_760) || (l_ihigh_136 < l_ihigh_144 && l_ilow_296 < l_ilow_304 && l_ilow_288 < l_ilow_296 && l_iopen_72 == l_iclose_352 && l_ihigh_128 == l_iopen_72 && l_ilow_288 < l_iopen_72 - 2.0 * gd_760) || (l_ilow_288 < l_ilow_296 && l_iopen_72 == l_iclose_352 && l_ihigh_128 == l_iopen_72 && l_ilow_288 < l_iopen_72 - 2.0 * gd_760)) { li_unused_412 = 1; li_unused_416 = 1; li_ret_4 = 21; } if ((l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_iopen_80 > l_iclose_360 && l_iclose_352 > l_iopen_72 && l_iopen_72 < l_iclose_360 && l_iclose_352 > l_iopen_80) || (l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_iopen_80 > l_iclose_360 && l_iclose_352 > l_iopen_72 && l_iopen_72 < l_iclose_360 && l_iclose_352 > l_iopen_80) || (l_ilow_296 < l_ilow_304 && l_ihigh_136 < l_ihigh_144 && l_iopen_80 > l_iclose_360 && l_iclose_352 > l_iopen_72 && l_iopen_72 < l_iclose_360 && l_iclose_352 > l_iopen_80) || (l_iopen_80 > l_iclose_360 && l_iclose_352 > l_iopen_72 && l_iopen_72 < l_iclose_360 && l_iclose_352 > l_iopen_80)) { li_unused_420 = 1; li_ret_4 = 22; return (li_ret_4); } if ((l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_iopen_80 > l_iclose_360 && l_iclose_352 > l_iopen_72 && l_iopen_80 > l_iclose_360 && l_iopen_72 == l_iclose_352 && l_ilow_288 == l_iopen_72 && l_ihigh_128 > l_iopen_72 && l_iopen_72 <= l_iclose_360) || (l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_iopen_80 > l_iclose_360 && l_iopen_72 == l_iclose_352 && l_ilow_288 == l_iopen_72 && l_ihigh_128 > l_iopen_72 && l_iopen_72 <= l_iclose_360) || (l_ilow_296 < l_ilow_304 && l_ihigh_136 < l_ihigh_144 && l_iopen_80 > l_iclose_360 && l_iopen_72 == l_iclose_352 && l_ilow_288 == l_iopen_72 && l_ihigh_128 > l_iopen_72 && l_iopen_72 <= l_iclose_360) || (l_iopen_80 > l_iclose_360 && l_iopen_72 == l_iclose_352 && l_ilow_288 == l_iopen_72 && l_ihigh_128 > l_iopen_72 && l_iopen_72 <= l_iclose_360)) { li_unused_424 = 1; li_unused_428 = 1; li_ret_4 = 23; return (li_ret_4); } if ((l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_iopen_80 > l_iclose_360 && l_iopen_72 < l_iclose_360 && l_iopen_72 == l_iclose_352) || (l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_iopen_80 > l_iclose_360 && l_iopen_72 < l_iclose_360 && l_iopen_72 == l_iclose_352) || (l_ihigh_136 < l_ihigh_144 && l_ilow_296 < l_ilow_304 && l_iopen_80 > l_iclose_360 && l_iopen_72 < l_iclose_360 && l_iopen_72 == l_iclose_352) || (l_iopen_80 > l_iclose_360 && l_iopen_72 < l_iclose_360 && l_iopen_72 == l_iclose_352)) { li_unused_432 = 1; li_ret_4 = 24; return (li_ret_4); } if ((l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_iopen_80 > l_iclose_360 && l_iopen_72 == l_iclose_352 && l_ihigh_128 > l_iopen_72 && l_ilow_288 < l_iopen_72 && (l_iopen_72 > l_iclose_360 && l_iopen_72 <= l_iopen_80) || (l_iopen_72 >= l_iclose_360 && l_iopen_72 < l_iopen_80)) || (l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_iopen_80 > l_iclose_360 && l_iopen_72 == l_iclose_352 && l_ihigh_128 > l_iopen_72 && l_ilow_288 < l_iopen_72 && (l_iopen_72 > l_iclose_360 && l_iopen_72 <= l_iopen_80) || (l_iopen_72 >= l_iclose_360 && l_iopen_72 < l_iopen_80)) || (l_ihigh_136 < l_ihigh_144 && l_ilow_296 < l_ilow_304 && l_iopen_80 > l_iclose_360 && l_iopen_72 == l_iclose_352 && l_ihigh_128 > l_iopen_72 && l_ilow_288 < l_iopen_72 && (l_iopen_72 > l_iclose_360 && l_iopen_72 <= l_iopen_80) || (l_iopen_72 >= l_iclose_360 && l_iopen_72 < l_iopen_80)) || (l_iopen_80 > l_iclose_360 && l_iopen_72 == l_iclose_352 && l_ihigh_128 > l_iopen_72 && l_ilow_288 < l_iopen_72 && (l_iopen_72 > l_iclose_360 && l_iopen_72 <= l_iopen_80) || (l_iopen_72 >= l_iclose_360 && l_iopen_72 < l_iopen_80))) { li_unused_436 = 1; li_ret_4 = 25; return (li_ret_4); } if ((l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_iopen_80 > l_iclose_360 && l_iopen_72 > l_iclose_352 && (l_iopen_72 <= l_iopen_80 && l_iclose_352 > l_iclose_360) || (l_iclose_352 >= l_iclose_360 && l_iopen_72 < l_iopen_80)) || (l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_iopen_80 > l_iclose_360 && l_iopen_72 > l_iclose_352 && (l_iopen_72 <= l_iopen_80 && l_iclose_352 > l_iclose_360) || (l_iclose_352 >= l_iclose_360 && l_iopen_72 < l_iopen_80)) || (l_ihigh_136 < l_ihigh_144 && l_ilow_296 < l_ilow_304 && l_iopen_80 > l_iclose_360 && l_iopen_72 > l_iclose_352 && (l_iopen_72 <= l_iopen_80 && l_iclose_352 > l_iclose_360) || (l_iclose_352 >= l_iclose_360 && l_iopen_72 < l_iopen_80)) || (l_iopen_80 > l_iclose_360 && l_iopen_72 > l_iclose_352 && (l_iopen_72 <= l_iopen_80 && l_iclose_352 > l_iclose_360) || (l_iclose_352 >= l_iclose_360 && l_iopen_72 < l_iopen_80))) { li_unused_440 = 1; li_ret_4 = 26; return (li_ret_4); } if ((l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_iopen_80 > l_iclose_360 && l_iopen_72 > l_iclose_360 && l_iopen_72 > l_iclose_352 && MathAbs(l_iclose_352 - l_iclose_360) < gd_760) || (l_ihigh_136 < l_ihigh_144 && l_ilow_296 < l_ilow_304 && l_iopen_80 > l_iclose_360 && l_iopen_72 > l_iclose_360 && l_iopen_72 > l_iclose_352 && MathAbs(l_iclose_352 - l_iclose_360) < gd_760) || (l_iopen_80 > l_iclose_360 && l_iopen_72 > l_iclose_360 && l_iopen_72 > l_iclose_352 && MathAbs(l_iclose_352 - l_iclose_360) < gd_760)) { li_unused_444 = 1; li_ret_4 = 27; return (li_ret_4); } if (l_iclose_368 < l_iopen_88 && l_iclose_360 > l_iopen_80 && l_ilow_296 > l_iclose_368 && l_iclose_352 < l_iopen_72 && l_iclose_352 > 0.98 * l_iclose_368 && l_iclose_352 < 1.02 * l_iclose_368) { li_unused_452 = 1; li_ret_4 = 28; return (li_ret_4); } if ((l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ihigh_160 < l_ihigh_168 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_ilow_320 < l_ilow_328 && l_iopen_88 > l_iclose_368 && l_ilow_304 < l_iclose_368 - 1.0 * (l_iopen_88 - l_iclose_368) && l_iopen_88 == l_ihigh_144 && l_ilow_304 < l_iclose_368 && l_iopen_88 - l_iclose_368 > 3.0 * gd_760 && l_ilow_304 < l_ilow_296 && l_ilow_296 < l_ilow_288 && l_ihigh_136 > l_ihigh_128 && l_ihigh_144 > l_ihigh_136 && l_iopen_80 > l_iclose_368 && l_iopen_72 > l_iclose_360 && l_iopen_80 == l_ihigh_136 && l_ilow_296 < l_iclose_360 && l_iopen_80 > l_iclose_360 && l_iopen_80 - l_iclose_360 > 2.0 * gd_760 && l_iopen_72 > l_iclose_352 && l_iopen_72 == l_ihigh_128 && l_iclose_352 == l_ilow_288 && l_iopen_72 - l_iclose_352 > 2.0 * gd_760 && l_iopen_72 < l_iopen_80 && l_iclose_352 > l_ilow_296) || (l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_iopen_88 > l_iclose_368 && l_ilow_304 < l_iclose_368 - 1.0 * (l_iopen_88 - l_iclose_368) && l_iopen_88 == l_ihigh_144 && l_ilow_304 < l_iclose_368 && l_iopen_88 - l_iclose_368 > 3.0 * gd_760 && l_ilow_304 < l_ilow_296 && l_ilow_296 < l_ilow_288 && l_ihigh_136 > l_ihigh_128 && l_ihigh_144 > l_ihigh_136 && l_iopen_80 > l_iclose_368 && l_iopen_72 > l_iclose_360 && l_iopen_80 == l_ihigh_136 && l_ilow_296 < l_iclose_360 && l_iopen_80 > l_iclose_360 && l_iopen_80 - l_iclose_360 > 2.0 * gd_760 && l_iopen_72 > l_iclose_352 && l_iopen_72 == l_ihigh_128 && l_iclose_352 == l_ilow_288 && l_iopen_72 - l_iclose_352 > 2.0 * gd_760 && l_iopen_72 < l_iopen_80 && l_iclose_352 > l_ilow_296) || (l_ihigh_144 < l_ihigh_152 && l_ilow_304 < l_ilow_312 && l_iopen_88 > l_iclose_368 && l_ilow_304 < l_iclose_368 - 1.0 * (l_iopen_88 - l_iclose_368) && l_iopen_88 == l_ihigh_144 && l_ilow_304 < l_iclose_368 && l_iopen_88 - l_iclose_368 > 3.0 * gd_760 && l_ilow_304 < l_ilow_296 && l_ilow_296 < l_ilow_288 && l_ihigh_136 > l_ihigh_128 && l_ihigh_144 > l_ihigh_136 && l_iopen_80 > l_iclose_368 && l_iopen_72 > l_iclose_360 && l_iopen_80 == l_ihigh_136 && l_ilow_296 < l_iclose_360 && l_iopen_80 > l_iclose_360 && l_iopen_80 - l_iclose_360 > 2.0 * gd_760 && l_iopen_72 > l_iclose_352 && l_iopen_72 == l_ihigh_128 && l_iclose_352 == l_ilow_288 && l_iopen_72 - l_iclose_352 > 2.0 * gd_760 && l_iopen_72 < l_iopen_80 && l_iclose_352 > l_ilow_296) || (l_iopen_88 > l_iclose_368 && l_ilow_304 < l_iclose_368 - 1.0 * (l_iopen_88 - l_iclose_368) && l_iopen_88 == l_ihigh_144 && l_ilow_304 < l_iclose_368 && l_iopen_88 - l_iclose_368 > 3.0 * gd_760 && l_ilow_304 < l_ilow_296 && l_ilow_296 < l_ilow_288 && l_ihigh_136 > l_ihigh_128 && l_ihigh_144 > l_ihigh_136 && l_iopen_80 > l_iclose_368 && l_iopen_72 > l_iclose_360 && l_iopen_80 == l_ihigh_136 && l_ilow_296 < l_iclose_360 && l_iopen_80 > l_iclose_360 && l_iopen_80 - l_iclose_360 > 2.0 * gd_760 && l_iopen_72 > l_iclose_352 && l_iopen_72 == l_ihigh_128 && l_iclose_352 == l_ilow_288 && l_iopen_72 - l_iclose_352 > 2.0 * gd_760 && l_iopen_72 < l_iopen_80 && l_iclose_352 > l_ilow_296)) { li_unused_456 = 1; li_ret_4 = 29; return (li_ret_4); } if ((l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ihigh_160 < l_ihigh_168 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_ilow_320 < l_ilow_328 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296 && l_iopen_88 < l_iopen_96 && l_iopen_80 < l_iopen_88 && l_ihigh_144 > l_iopen_88 && l_ilow_304 < l_iopen_88 && l_ihigh_136 > l_iopen_80 && l_ilow_296 < l_iopen_80 && l_ihigh_128 > l_iopen_72 && l_ilow_288 < l_iopen_72 && l_iopen_88 == l_iclose_368 && l_iopen_80 == l_iclose_360 && l_iopen_72 == l_iclose_352) || (l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296 && l_iopen_88 < l_iopen_96 && l_iopen_80 < l_iopen_88 && l_ihigh_144 > l_iopen_88 && l_ilow_304 < l_iopen_88 && l_ihigh_136 > l_iopen_80 && l_ilow_296 < l_iopen_80 && l_ihigh_128 > l_iopen_72 && l_ilow_288 < l_iopen_72 && l_iopen_88 == l_iclose_368 && l_iopen_80 == l_iclose_360 && l_iopen_72 == l_iclose_352) || (l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296 && l_iopen_88 < l_iopen_96 && l_iopen_80 < l_iopen_88 && l_ihigh_144 > l_iopen_88 && l_ilow_304 < l_iopen_88 && l_ihigh_136 > l_iopen_80 && l_ilow_296 < l_iopen_80 && l_ihigh_128 > l_iopen_72 && l_ilow_288 < l_iopen_72 && l_iopen_88 == l_iclose_368 && l_iopen_80 == l_iclose_360 && l_iopen_72 == l_iclose_352) || (l_ihigh_136 < l_ihigh_144 && l_ilow_296 < l_ilow_304 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296 && l_iopen_88 < l_iopen_96 && l_iopen_80 < l_iopen_88 && l_ihigh_144 > l_iopen_88 && l_ilow_304 < l_iopen_88 && l_ihigh_136 > l_iopen_80 && l_ilow_296 < l_iopen_80 && l_ihigh_128 > l_iopen_72 && l_ilow_288 < l_iopen_72 && l_iopen_88 == l_iclose_368 && l_iopen_80 == l_iclose_360 && l_iopen_72 == l_iclose_352)) { li_unused_460 = 1; li_ret_4 = 30; return (li_ret_4); } if ((l_ihigh_160 < l_ihigh_168 && l_ihigh_168 < l_ihigh_176 && l_ihigh_176 < l_ihigh_184 && l_ilow_320 < l_ilow_328 && l_ilow_328 < l_ilow_336 && l_ilow_336 < l_ilow_344 && l_iopen_104 > l_iclose_384 && l_iopen_96 > l_iclose_376 && l_iopen_96 < l_iclose_384 - 3.0 * gd_760 && l_ihigh_152 < l_ihigh_160 && l_ihigh_144 < l_ihigh_152 && l_ihigh_136 < l_ihigh_144 && l_iclose_360 < l_iclose_368 && l_iclose_368 < l_iclose_376 && l_ilow_312 < l_ilow_320 && l_iclose_352 > l_iopen_72 && l_iopen_72 > l_iclose_360 && l_iclose_352 > l_iopen_96 && l_iclose_352 < l_iclose_384 && l_iclose_360 < l_iclose_368 && l_iclose_368 < l_iclose_376 && l_iclose_376 < l_iclose_384) || (l_ihigh_160 < l_ihigh_168 && l_ihigh_168 < l_ihigh_176 && l_ilow_320 < l_ilow_328 && l_ilow_328 < l_ilow_336 && l_iopen_104 > l_iclose_384 && l_iopen_96 > l_iclose_376 && l_iopen_96 < l_iclose_384 - 3.0 * gd_760 && l_ihigh_152 < l_ihigh_160 && l_ihigh_144 < l_ihigh_152 && l_ihigh_136 < l_ihigh_144 && l_iclose_360 < l_iclose_368 && l_iclose_368 < l_iclose_376 && l_ilow_312 < l_ilow_320 && l_iclose_352 > l_iopen_72 && l_iopen_72 > l_iclose_360 && l_iclose_352 > l_iopen_96 && l_iclose_352 < l_iclose_384 && l_iclose_360 < l_iclose_368 && l_iclose_368 < l_iclose_376 && l_iclose_376 < l_iclose_384) || (l_ihigh_160 < l_ihigh_168 && l_ilow_320 < l_ilow_328 && l_iopen_104 > l_iclose_384 && l_iopen_96 > l_iclose_376 && l_iopen_96 < l_iclose_384 - 3.0 * gd_760 && l_ihigh_152 < l_ihigh_160 && l_ihigh_144 < l_ihigh_152 && l_ihigh_136 < l_ihigh_144 && l_iclose_360 < l_iclose_368 && l_iclose_368 < l_iclose_376 && l_ilow_312 < l_ilow_320 && l_iclose_352 > l_iopen_72 && l_iopen_72 > l_iclose_360 && l_iclose_352 > l_iopen_96 && l_iclose_352 < l_iclose_384 && l_iclose_360 < l_iclose_368 && l_iclose_368 < l_iclose_376 && l_iclose_376 < l_iclose_384) || (l_iopen_104 > l_iclose_384 && l_iopen_96 > l_iclose_376 && l_iopen_96 < l_iclose_384 - 3.0 * gd_760 && l_ihigh_152 < l_ihigh_160 && l_ihigh_144 < l_ihigh_152 && l_ihigh_136 < l_ihigh_144 && l_iclose_360 < l_iclose_368 && l_iclose_368 < l_iclose_376 && l_ilow_312 < l_ilow_320 && l_iclose_352 > l_iopen_72 && l_iopen_72 > l_iclose_360 && l_iclose_352 > l_iopen_96 && l_iclose_352 < l_iclose_384 && l_iclose_360 < l_iclose_368 && l_iclose_368 < l_iclose_376 && l_iclose_376 < l_iclose_384)) { li_unused_468 = 1; li_ret_4 = 31; return (li_ret_4); } if ((l_ihigh_160 < l_ihigh_168 && l_ihigh_168 < l_ihigh_176 && l_ihigh_176 < l_ihigh_184 && l_ilow_320 < l_ilow_328 && l_ilow_328 < l_ilow_336 && l_ilow_336 < l_ilow_344 && l_iopen_104 > l_iclose_384 && l_iopen_96 > l_iclose_376 && l_iopen_88 > l_iclose_368 && l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_iopen_80 > l_iclose_360 && l_ihigh_128 > l_iopen_72 && l_iopen_72 > l_iopen_80 && l_iclose_352 > l_iopen_72 && l_iclose_352 > l_ihigh_136) || (l_ihigh_160 < l_ihigh_168 && l_ihigh_168 < l_ihigh_176 && l_ilow_320 < l_ilow_328 && l_ilow_328 < l_ilow_336 && l_iopen_104 > l_iclose_384 && l_iopen_96 > l_iclose_376 && l_iopen_88 > l_iclose_368 && l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_iopen_80 > l_iclose_360 && l_ihigh_128 > l_iopen_72 && l_iopen_72 > l_iopen_80 && l_iclose_352 > l_iopen_72 && l_iclose_352 > l_ihigh_136) || (l_ihigh_160 < l_ihigh_168 && l_ilow_320 < l_ilow_328 && l_iopen_104 > l_iclose_384 && l_iopen_96 > l_iclose_376 && l_iopen_88 > l_iclose_368 && l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_iopen_80 > l_iclose_360 && l_ihigh_128 > l_iopen_72 && l_iopen_72 > l_iopen_80 && l_iclose_352 > l_iopen_72 && l_iclose_352 > l_ihigh_136) || (l_iopen_104 > l_iclose_384 && l_iopen_96 > l_iclose_376 && l_iopen_88 > l_iclose_368 && l_ihigh_136 < l_ihigh_144 && l_ihigh_144 < l_ihigh_152 && l_ihigh_152 < l_ihigh_160 && l_ilow_296 < l_ilow_304 && l_ilow_304 < l_ilow_312 && l_ilow_312 < l_ilow_320 && l_iopen_80 > l_iclose_360 && l_ihigh_128 > l_iopen_72 && l_iopen_72 > l_iopen_80 && l_iclose_352 > l_iopen_72 && l_iclose_352 > l_ihigh_136)) { li_unused_472 = 1; li_ret_4 = 32; return (li_ret_4); } return (li_ret_4); } int Check_HRR_Bearish_Candles(int a_timeframe_0) { int li_ret_4 = 0; double ld_8 = 0; double ld_16 = 0; double ld_24 = 0; double ld_32 = 0; double ld_40 = 0; double ld_48 = 0; double l_iopen_56 = 0; double l_iopen_64 = 0; double l_iopen_72 = 0; double l_iopen_80 = 0; double l_iopen_88 = 0; double l_iopen_96 = 0; double l_iopen_104 = 0; double l_ihigh_112 = 0; double l_ihigh_120 = 0; double l_ihigh_128 = 0; double l_ihigh_136 = 0; double l_ihigh_144 = 0; double l_ihigh_152 = 0; double l_ihigh_160 = 0; double l_ihigh_168 = 0; double l_ihigh_176 = 0; double l_ihigh_184 = 0; double ld_unused_192 = 0; double ld_unused_200 = 0; double ld_unused_208 = 0; double ld_unused_216 = 0; double ld_unused_224 = 0; double ld_unused_232 = 0; double ld_unused_240 = 0; double ld_unused_248 = 0; double ld_unused_256 = 0; double ld_unused_264 = 0; double l_ilow_272 = 0; double l_ilow_280 = 0; double l_ilow_288 = 0; double l_ilow_296 = 0; double l_ilow_304 = 0; double l_ilow_312 = 0; double l_ilow_320 = 0; double l_iclose_328 = 0; double l_iclose_336 = 0; double l_iclose_344 = 0; double l_iclose_352 = 0; double l_iclose_360 = 0; double l_iclose_368 = 0; double l_iclose_376 = 0; int li_384 = 0; int li_unused_388 = 0; int li_unused_392 = 0; int li_unused_396 = 0; int li_unused_400 = 0; int li_unused_404 = 0; int li_unused_408 = 0; int li_unused_412 = 0; int li_unused_416 = 0; int li_unused_420 = 0; int li_unused_424 = 0; l_iopen_56 = iOpen(Symbol(), a_timeframe_0, 1); l_iopen_64 = iOpen(Symbol(), a_timeframe_0, 2); l_iopen_72 = iOpen(Symbol(), a_timeframe_0, 3); l_iopen_80 = iOpen(Symbol(), a_timeframe_0, 4); l_iopen_88 = iOpen(Symbol(), a_timeframe_0, 5); l_iopen_96 = iOpen(Symbol(), a_timeframe_0, 6); l_iopen_104 = iOpen(Symbol(), a_timeframe_0, 7); l_ihigh_112 = iHigh(Symbol(), a_timeframe_0, 1); l_ihigh_120 = iHigh(Symbol(), a_timeframe_0, 2); l_ihigh_128 = iHigh(Symbol(), a_timeframe_0, 3); l_ihigh_136 = iHigh(Symbol(), a_timeframe_0, 4); l_ihigh_144 = iHigh(Symbol(), a_timeframe_0, 5); l_ihigh_152 = iHigh(Symbol(), a_timeframe_0, 6); l_ihigh_160 = iHigh(Symbol(), a_timeframe_0, 7); l_ihigh_168 = iHigh(Symbol(), a_timeframe_0, 8); l_ihigh_176 = iHigh(Symbol(), a_timeframe_0, 9); l_ihigh_184 = iHigh(Symbol(), a_timeframe_0, 10); l_ilow_272 = iLow(Symbol(), a_timeframe_0, 1); l_ilow_280 = iLow(Symbol(), a_timeframe_0, 2); l_ilow_288 = iLow(Symbol(), a_timeframe_0, 3); l_ilow_296 = iLow(Symbol(), a_timeframe_0, 4); l_ilow_304 = iLow(Symbol(), a_timeframe_0, 5); l_ilow_312 = iLow(Symbol(), a_timeframe_0, 6); l_ilow_320 = iLow(Symbol(), a_timeframe_0, 7); l_iclose_328 = iClose(Symbol(), a_timeframe_0, 1); l_iclose_336 = iClose(Symbol(), a_timeframe_0, 2); l_iclose_344 = iClose(Symbol(), a_timeframe_0, 3); l_iclose_352 = iClose(Symbol(), a_timeframe_0, 4); l_iclose_360 = iClose(Symbol(), a_timeframe_0, 5); l_iclose_368 = iClose(Symbol(), a_timeframe_0, 6); l_iclose_376 = iClose(Symbol(), a_timeframe_0, 7); ld_8 = 0; for (li_384 = 1; li_384 < 22; li_384++) ld_8 += iHigh(Symbol(), a_timeframe_0, li_384); ld_16 = ld_8 / 21.0; ld_8 = 0; for (li_384 = 2; li_384 < 23; li_384++) ld_8 += iHigh(Symbol(), a_timeframe_0, li_384); ld_40 = ld_8 / 21.0; ld_8 = 0; for (li_384 = 1; li_384 < 22; li_384++) ld_8 += iLow(Symbol(), a_timeframe_0, li_384); ld_24 = ld_8 / 21.0; ld_8 = 0; for (li_384 = 2; li_384 < 23; li_384++) ld_8 += iLow(Symbol(), a_timeframe_0, li_384); ld_32 = ld_8 / 21.0; ld_48 = MathMax(l_ihigh_184, l_ihigh_176); ld_48 = MathMax(ld_48, l_ihigh_168); ld_48 = MathMax(ld_48, l_ihigh_160); ld_48 = MathMax(ld_48, l_ihigh_152); ld_48 = MathMax(ld_48, l_ihigh_160); ld_48 = MathMax(ld_48, l_ihigh_152); ld_48 = MathMax(ld_48, l_ihigh_144); ld_48 = MathMax(ld_48, l_ihigh_136); ld_48 = MathMax(ld_48, l_ihigh_128); ld_48 = MathMax(ld_48, l_ihigh_120); ld_48 = MathMax(ld_48, l_ihigh_112); if ((l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ilow_280 > l_ilow_288 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iclose_336 > l_iopen_64 && l_iopen_56 > l_iclose_328 && l_iopen_56 > l_ihigh_120 && l_iclose_328 < l_iclose_336 && l_iclose_328 < l_iclose_336 - (l_iclose_336 - l_iopen_64) / 2.0 && l_iclose_328 >= l_iopen_64) || (l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ilow_280 > l_ilow_288 && l_ilow_288 > l_ilow_296 && l_iclose_336 > l_iopen_64 && l_iopen_56 > l_iclose_328 && l_iopen_56 > l_ihigh_120 && l_iclose_328 < l_iclose_336 && l_iclose_328 < l_iclose_336 - (l_iclose_336 - l_iopen_64) / 2.0 && l_iclose_328 >= l_iopen_64) || (l_ihigh_120 > l_ihigh_128 && l_ilow_280 > l_ilow_288 && l_iclose_336 > l_iopen_64 && l_iopen_56 > l_iclose_328 && l_iopen_56 > l_ihigh_120 && l_iclose_328 < l_iclose_336 && l_iclose_328 < l_iclose_336 - (l_iclose_336 - l_iopen_64) / 2.0 && l_iclose_328 >= l_iopen_64) || (l_iclose_336 > l_iopen_64 && l_iopen_56 > l_iclose_328 && l_iopen_56 > l_ihigh_120 && l_iclose_328 < l_iclose_336 && l_iclose_328 < l_iclose_336 - (l_iclose_336 - l_iopen_64) / 2.0 && l_iclose_328 >= l_iopen_64)) { li_unused_388 = 1; li_ret_4 = 61; return (li_ret_4); } if (l_iclose_336 > l_iopen_64 && l_ihigh_120 == l_iclose_336 && l_ilow_280 == l_iopen_64 && l_iopen_56 > l_iclose_328 && l_ihigh_112 == l_iopen_56 && l_ilow_272 == l_iclose_328 && l_iopen_56 < l_iopen_64 && l_iclose_336 - l_iopen_64 > gd_760 && l_iopen_56 - l_iclose_328 > gd_760) { li_unused_392 = 1; li_ret_4 = 62; return (li_ret_4); } if ((l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ihigh_120 > l_ihigh_128 && l_ilow_280 > l_ilow_288 && l_iclose_344 > l_iopen_72 && l_iopen_64 == l_iclose_336 && l_ilow_280 > l_ihigh_128 && l_ihigh_120 > l_iopen_64 && l_ilow_280 < l_iopen_64 && l_iopen_56 > l_iclose_328 && l_ihigh_112 < l_ilow_280) || (l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ihigh_120 > l_ihigh_128 && l_ilow_280 > l_ilow_288 && l_iclose_344 > l_iopen_72 && l_iopen_64 == l_iclose_336 && l_ilow_280 > l_ihigh_128 && l_ihigh_120 > l_iopen_64 && l_ilow_280 < l_iopen_64 && l_iopen_56 > l_iclose_328 && l_ihigh_112 < l_ilow_280) || (l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296 && l_ihigh_120 > l_ihigh_128 && l_ilow_280 > l_ilow_288 && l_iclose_344 > l_iopen_72 && l_iopen_64 == l_iclose_336 && l_ilow_280 > l_ihigh_128 && l_ihigh_120 > l_iopen_64 && l_ilow_280 < l_iopen_64 && l_iopen_56 > l_iclose_328 && l_ihigh_112 < l_ilow_280) || (l_ihigh_120 > l_ihigh_128 && l_ilow_280 > l_ilow_288 && l_iclose_344 > l_iopen_72 && l_iopen_64 == l_iclose_336 && l_ilow_280 > l_ihigh_128 && l_ihigh_120 > l_iopen_64 && l_ilow_280 < l_iopen_64 && l_iopen_56 > l_iclose_328 && l_ihigh_112 < l_ilow_280)) { li_unused_396 = 1; li_ret_4 = 63; return (li_ret_4); } if ((l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_280 > l_ilow_288 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_344 > l_iopen_72 && MathAbs(l_iclose_336 - l_iopen_64) > gd_760 && (l_iclose_336 > l_iopen_64 && l_iopen_64 > l_iclose_344 && l_ilow_280 < l_iopen_64 && l_ihigh_120 > l_iclose_336 && l_iclose_336 - l_iopen_64 > gd_760 && l_ihigh_120 - l_ilow_280 > 2.0 * (l_iclose_336 - l_iopen_64)) || (l_iopen_64 > l_iclose_336 && l_iopen_64 > l_iclose_344 && l_ilow_280 > l_iclose_336 && l_ihigh_120 > l_iopen_64 && l_iopen_64 - l_iclose_336 > gd_760 && l_ihigh_120 - l_ilow_280 > 2.0 * (l_iopen_64 - l_iclose_336)) && l_iopen_56 > l_iclose_328 && l_iopen_56 < l_iopen_64 && l_iopen_56 < l_iclose_336) || (l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ilow_280 > l_ilow_288 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iclose_344 > l_iopen_72 && MathAbs(l_iclose_336 - l_iopen_64) > gd_760 && (l_iclose_336 > l_iopen_64 && l_iopen_64 > l_iclose_344 && l_ilow_280 < l_iopen_64 && l_ihigh_120 > l_iclose_336 && l_iclose_336 - l_iopen_64 > gd_760 && l_ihigh_120 - l_ilow_280 > 2.0 * (l_iclose_336 - l_iopen_64)) || (l_iopen_64 > l_iclose_336 && l_iopen_64 > l_iclose_344 && l_ilow_280 > l_iclose_336 && l_ihigh_120 > l_iopen_64 && l_iopen_64 - l_iclose_336 > gd_760 && l_ihigh_120 - l_ilow_280 > 2.0 * (l_iopen_64 - l_iclose_336)) && l_iopen_56 > l_iclose_328 && l_iopen_56 < l_iopen_64 && l_iopen_56 < l_iclose_336) || (l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ilow_280 > l_ilow_288 && l_ilow_288 > l_ilow_296 && l_iclose_344 > l_iopen_72 && MathAbs(l_iclose_336 - l_iopen_64) > gd_760 && (l_iclose_336 > l_iopen_64 && l_iopen_64 > l_iclose_344 && l_ilow_280 < l_iopen_64 && l_ihigh_120 > l_iclose_336 && l_iclose_336 - l_iopen_64 > gd_760 && l_ihigh_120 - l_ilow_280 > 2.0 * (l_iclose_336 - l_iopen_64)) || (l_iopen_64 > l_iclose_336 && l_iopen_64 > l_iclose_344 && l_ilow_280 > l_iclose_336 && l_ihigh_120 > l_iopen_64 && l_iopen_64 - l_iclose_336 > gd_760 && l_ihigh_120 - l_ilow_280 > 2.0 * (l_iopen_64 - l_iclose_336)) && l_iopen_56 > l_iclose_328 && l_iopen_56 < l_iopen_64 && l_iopen_56 < l_iclose_336) || (l_ihigh_120 > l_ihigh_128 && l_ilow_280 > l_ilow_288 && l_iclose_344 > l_iopen_72 && MathAbs(l_iclose_336 - l_iopen_64) > gd_760 && (l_iclose_336 > l_iopen_64 && l_iopen_64 > l_iclose_344 && l_ilow_280 < l_iopen_64 && l_ihigh_120 > l_iclose_336 && l_iclose_336 - l_iopen_64 > gd_760 && l_ihigh_120 - l_ilow_280 > 2.0 * (l_iclose_336 - l_iopen_64)) || (l_iopen_64 > l_iclose_336 && l_iopen_64 > l_iclose_344 && l_ilow_280 > l_iclose_336 && l_ihigh_120 > l_iopen_64 && l_iopen_64 - l_iclose_336 > gd_760 && l_ihigh_120 - l_ilow_280 > 2.0 * (l_iopen_64 - l_iclose_336)) && l_iopen_56 > l_iclose_328 && l_iopen_56 < l_iopen_64 && l_iopen_56 < l_iclose_336)) { li_unused_400 = 1; li_ret_4 = 64; return (li_ret_4); } if ((l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_280 > l_ilow_288 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_344 && l_iopen_64 == l_iclose_336 && l_ihigh_120 > l_iopen_64 && l_ilow_280 < l_iopen_64 && l_iopen_56 > l_iclose_328 && l_iopen_56 < l_iopen_64) || (l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ilow_280 > l_ilow_288 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_344 && l_iopen_64 == l_iclose_336 && l_ihigh_120 > l_iopen_64 && l_ilow_280 < l_iopen_64 && l_iopen_56 > l_iclose_328 && l_iopen_56 < l_iopen_64) || (l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ilow_280 > l_ilow_288 && l_ilow_288 > l_ilow_296 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_344 && l_iopen_64 == l_iclose_336 && l_ihigh_120 > l_iopen_64 && l_ilow_280 < l_iopen_64 && l_iopen_56 > l_iclose_328 && l_iopen_56 < l_iopen_64) || (l_ihigh_120 > l_ihigh_128 && l_ilow_280 > l_ilow_288 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_344 && l_iopen_64 == l_iclose_336 && l_ihigh_120 > l_iopen_64 && l_ilow_280 < l_iopen_64 && l_iopen_56 > l_iclose_328 && l_iopen_56 < l_iopen_64)) { li_unused_404 = 1; li_ret_4 = 65; return (li_ret_4); } if ((l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iopen_72 > l_iclose_344 && l_iopen_64 > l_iclose_336 && l_iopen_56 > l_iclose_328 && l_ihigh_128 > l_ihigh_120 && l_ihigh_120 > l_ihigh_112 && l_ilow_288 > l_ilow_280 && l_ilow_280 > l_ilow_272 && l_iclose_336 < l_iclose_344 && l_iclose_328 < l_iclose_336 && l_iopen_64 > l_iclose_344 && l_iopen_64 < l_iopen_72 && l_iopen_56 > l_iclose_336 && l_iopen_56 < l_iopen_64) || (l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iopen_72 > l_iclose_344 && l_iopen_64 > l_iclose_336 && l_iopen_56 > l_iclose_328 && l_ihigh_128 > l_ihigh_120 && l_ihigh_120 > l_ihigh_112 && l_ilow_288 > l_ilow_280 && l_ilow_280 > l_ilow_272 && l_iclose_336 < l_iclose_344 && l_iclose_328 < l_iclose_336 && l_iopen_64 > l_iclose_344 && l_iopen_64 < l_iopen_72 && l_iopen_56 > l_iclose_336 && l_iopen_56 < l_iopen_64) || (l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296 && l_iopen_72 > l_iclose_344 && l_iopen_64 > l_iclose_336 && l_iopen_56 > l_iclose_328 && l_ihigh_128 > l_ihigh_120 && l_ihigh_120 > l_ihigh_112 && l_ilow_288 > l_ilow_280 && l_ilow_280 > l_ilow_272 && l_iclose_336 < l_iclose_344 && l_iclose_328 < l_iclose_336 && l_iopen_64 > l_iclose_344 && l_iopen_64 < l_iopen_72 && l_iopen_56 > l_iclose_336 && l_iopen_56 < l_iopen_64) || (l_iopen_72 > l_iclose_344 && l_iopen_64 > l_iclose_336 && l_iopen_56 > l_iclose_328 && l_ihigh_128 > l_ihigh_120 && l_ihigh_120 > l_ihigh_112 && l_ilow_288 > l_ilow_280 && l_ilow_280 > l_ilow_272 && l_iclose_336 < l_iclose_344 && l_iclose_328 < l_iclose_336 && l_iopen_64 > l_iclose_344 && l_iopen_64 < l_iopen_72 && l_iopen_56 > l_iclose_336 && l_iopen_56 < l_iopen_64)) { li_unused_408 = 1; li_ret_4 = 66; return (li_ret_4); } if ((l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_336 && (l_iopen_64 <= l_iclose_344 && l_iclose_336 > l_iopen_72) || (l_iclose_336 >= l_iopen_72 && l_iopen_64 < l_iclose_344) && l_iopen_56 > l_iclose_328 && l_iclose_328 < l_iclose_336) || (l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_336 && (l_iopen_64 <= l_iclose_344 && l_iclose_336 > l_iopen_72) || (l_iclose_336 >= l_iopen_72 && l_iopen_64 < l_iclose_344) && l_iopen_56 > l_iclose_328 && l_iclose_328 < l_iclose_336) || (l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_336 && (l_iopen_64 <= l_iclose_344 && l_iclose_336 > l_iopen_72) || (l_iclose_336 >= l_iopen_72 && l_iopen_64 < l_iclose_344) && l_iopen_56 > l_iclose_328 && l_iclose_328 < l_iclose_336) || (l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_336 && (l_iopen_64 <= l_iclose_344 && l_iclose_336 > l_iopen_72) || (l_iclose_336 >= l_iopen_72 && l_iopen_64 < l_iclose_344) && l_iopen_56 > l_iclose_328 && l_iclose_328 < l_iclose_336)) { li_unused_412 = 1; li_ret_4 = 67; return (li_ret_4); } if ((l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_336 && l_iopen_64 > l_iclose_344 && l_iclose_336 < l_iopen_72 && l_iopen_56 > l_iclose_328 && l_iclose_328 < l_iclose_336 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288) || (l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_336 && l_iopen_64 > l_iclose_344 && l_iclose_336 < l_iopen_72 && l_iopen_56 > l_iclose_328 && l_iclose_328 < l_iclose_336 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288) || (l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_336 && l_iopen_64 > l_iclose_344 && l_iclose_336 < l_iopen_72 && l_iopen_56 > l_iclose_328 && l_iclose_328 < l_iclose_336 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288) || (l_ihigh_120 > l_ihigh_128 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_336 && l_iopen_64 > l_iclose_344 && l_iclose_336 < l_iopen_72 && l_iopen_56 > l_iclose_328 && l_iclose_328 < l_iclose_336 && l_ilow_272 < l_ilow_280 && l_ilow_280 < l_ilow_288)) { li_unused_416 = 1; li_ret_4 = 68; return (li_ret_4); } if ((l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_280 > l_ilow_288 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_344 && l_iclose_336 > l_iclose_344 && l_iopen_64 > l_iclose_336 && l_iopen_56 > l_iclose_328 && l_iopen_56 > l_iopen_64 && l_iclose_328 < l_iclose_336 && l_iclose_328 > l_iclose_344 + 2.0 * gd_760) || (l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ilow_280 > l_ilow_288 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_344 && l_iclose_336 > l_iclose_344 && l_iopen_64 > l_iclose_336 && l_iopen_56 > l_iclose_328 && l_iopen_56 > l_iopen_64 && l_iclose_328 < l_iclose_336 && l_iclose_328 > l_iclose_344 + 2.0 * gd_760) || (l_ihigh_120 > l_ihigh_128 && l_ihigh_128 > l_ihigh_136 && l_ilow_280 > l_ilow_288 && l_ilow_288 > l_ilow_296 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_344 && l_iclose_336 > l_iclose_344 && l_iopen_64 > l_iclose_336 && l_iopen_56 > l_iclose_328 && l_iopen_56 > l_iopen_64 && l_iclose_328 < l_iclose_336 && l_iclose_328 > l_iclose_344 + 2.0 * gd_760) || (l_ihigh_120 > l_ihigh_128 && l_ilow_280 > l_ilow_288 && l_iclose_344 > l_iopen_72 && l_iopen_64 > l_iclose_344 && l_iclose_336 > l_iclose_344 && l_iopen_64 > l_iclose_336 && l_iopen_56 > l_iclose_328 && l_iopen_56 > l_iopen_64 && l_iclose_328 < l_iclose_336 && l_iclose_328 > l_iclose_344 + 2.0 * gd_760)) { li_unused_420 = 1; li_ret_4 = 69; return (li_ret_4); } if (l_ihigh_112 == l_ihigh_120 && MathAbs(l_iclose_328 - l_iopen_56) < 0.2 * MathAbs(l_iclose_336 - l_iopen_64) && MathAbs(l_iclose_336 - l_iopen_64) >= 0.9 * (l_ihigh_120 - l_ilow_280) && l_ihigh_120 - l_ilow_280 >= ld_16 - ld_24) { li_unused_424 = 1; li_ret_4 = 70; return (li_ret_4); } return (li_ret_4); } int Check_MRR_Bearish_Candles(int a_timeframe_0) { int li_ret_4 = 0; double ld_8 = 0; double ld_16 = 0; double ld_24 = 0; double ld_32 = 0; double ld_40 = 0; double ld_48 = 0; double ld_56 = 0; double ld_64 = 0; double ld_72 = 0; double ld_80 = 0; double l_iopen_88 = 0; double l_iopen_96 = 0; double l_iopen_104 = 0; double l_iopen_112 = 0; double l_iopen_120 = 0; double l_ihigh_128 = 0; double l_ihigh_136 = 0; double l_ihigh_144 = 0; double l_ihigh_152 = 0; double l_ihigh_160 = 0; double l_ihigh_168 = 0; double l_ihigh_176 = 0; double l_ihigh_184 = 0; double l_ihigh_192 = 0; double l_ihigh_200 = 0; double ld_unused_208 = 0; double ld_unused_216 = 0; double ld_unused_224 = 0; double ld_unused_232 = 0; double ld_unused_240 = 0; double ld_unused_248 = 0; double ld_unused_256 = 0; double ld_unused_264 = 0; double ld_unused_272 = 0; double ld_unused_280 = 0; double l_ilow_288 = 0; double l_ilow_296 = 0; double l_ilow_304 = 0; double l_ilow_312 = 0; double l_ilow_320 = 0; double l_ilow_328 = 0; double l_ilow_336 = 0; double l_ilow_344 = 0; double l_iclose_352 = 0; double l_iclose_360 = 0; double l_iclose_368 = 0; double l_iclose_376 = 0; double l_iclose_384 = 0; double l_iclose_392 = 0; double l_iclose_400 = 0; double l_iclose_408 = 0; int li_416 = 0; int li_unused_420 = 0; int li_unused_424 = 0; int li_unused_428 = 0; int li_unused_432 = 0; int li_unused_436 = 0; int li_unused_440 = 0; int li_unused_444 = 0; int li_unused_448 = 0; int li_unused_452 = 0; int li_unused_456 = 0; int li_unused_460 = 0; int li_unused_464 = 0; int li_unused_468 = 0; int li_unused_472 = 0; int li_unused_476 = 0; l_iopen_88 = iOpen(Symbol(), a_timeframe_0, 1); l_iopen_96 = iOpen(Symbol(), a_timeframe_0, 2); l_iopen_104 = iOpen(Symbol(), a_timeframe_0, 3); l_iopen_112 = iOpen(Symbol(), a_timeframe_0, 4); l_iopen_120 = iOpen(Symbol(), a_timeframe_0, 5); l_ihigh_128 = iHigh(Symbol(), a_timeframe_0, 1); l_ihigh_136 = iHigh(Symbol(), a_timeframe_0, 2); l_ihigh_144 = iHigh(Symbol(), a_timeframe_0, 3); l_ihigh_152 = iHigh(Symbol(), a_timeframe_0, 4); l_ihigh_160 = iHigh(Symbol(), a_timeframe_0, 5); l_ihigh_168 = iHigh(Symbol(), a_timeframe_0, 6); l_ihigh_176 = iHigh(Symbol(), a_timeframe_0, 7); l_ihigh_184 = iHigh(Symbol(), a_timeframe_0, 8); l_ihigh_192 = iHigh(Symbol(), a_timeframe_0, 9); l_ihigh_200 = iHigh(Symbol(), a_timeframe_0, 10); l_ilow_288 = iLow(Symbol(), a_timeframe_0, 1); l_ilow_296 = iLow(Symbol(), a_timeframe_0, 2); l_ilow_304 = iLow(Symbol(), a_timeframe_0, 3); l_ilow_312 = iLow(Symbol(), a_timeframe_0, 4); l_ilow_320 = iLow(Symbol(), a_timeframe_0, 5); l_ilow_328 = iLow(Symbol(), a_timeframe_0, 6); l_ilow_336 = iLow(Symbol(), a_timeframe_0, 7); l_ilow_344 = iLow(Symbol(), a_timeframe_0, 8); l_iclose_352 = iClose(Symbol(), a_timeframe_0, 1); l_iclose_360 = iClose(Symbol(), a_timeframe_0, 2); l_iclose_368 = iClose(Symbol(), a_timeframe_0, 3); l_iclose_376 = iClose(Symbol(), a_timeframe_0, 4); l_iclose_384 = iClose(Symbol(), a_timeframe_0, 5); l_iclose_392 = iClose(Symbol(), a_timeframe_0, 6); l_iclose_400 = iClose(Symbol(), a_timeframe_0, 7); l_iclose_408 = iClose(Symbol(), a_timeframe_0, 8); ld_8 = 0; for (li_416 = 1; li_416 < 22; li_416++) ld_8 += iHigh(Symbol(), a_timeframe_0, li_416); ld_16 = ld_8 / 21.0; ld_8 = 0; for (li_416 = 2; li_416 < 23; li_416++) ld_8 += iHigh(Symbol(), a_timeframe_0, li_416); ld_40 = ld_8 / 21.0; ld_8 = 0; for (li_416 = 1; li_416 < 22; li_416++) ld_8 += iLow(Symbol(), a_timeframe_0, li_416); ld_24 = ld_8 / 21.0; ld_8 = 0; for (li_416 = 2; li_416 < 23; li_416++) ld_8 += iLow(Symbol(), a_timeframe_0, li_416); ld_32 = ld_8 / 21.0; ld_8 = 0; for (li_416 = 3; li_416 < 24; li_416++) ld_8 += iHigh(Symbol(), a_timeframe_0, li_416); ld_56 = ld_8 / 21.0; ld_8 = 0; for (li_416 = 3; li_416 < 24; li_416++) ld_8 += iLow(Symbol(), a_timeframe_0, li_416); ld_48 = ld_8 / 21.0; ld_8 = 0; for (li_416 = 5; li_416 < 26; li_416++) ld_8 += iHigh(Symbol(), a_timeframe_0, li_416); ld_72 = ld_8 / 21.0; ld_8 = 0; for (li_416 = 5; li_416 < 26; li_416++) ld_8 += iLow(Symbol(), a_timeframe_0, li_416); ld_64 = ld_8 / 21.0; ld_80 = MathMax(l_ihigh_200, l_ihigh_192); ld_80 = MathMax(ld_80, l_ihigh_184); ld_80 = MathMax(ld_80, l_ihigh_176); ld_80 = MathMax(ld_80, l_ihigh_168); ld_80 = MathMax(ld_80, l_ihigh_176); ld_80 = MathMax(ld_80, l_ihigh_168); ld_80 = MathMax(ld_80, l_ihigh_160); ld_80 = MathMax(ld_80, l_ihigh_152); ld_80 = MathMax(ld_80, l_ihigh_144); ld_80 = MathMax(ld_80, l_ihigh_136); ld_80 = MathMax(ld_80, l_ihigh_128); if ((l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_iclose_360 > l_iopen_96 && l_iopen_88 > l_iclose_352 && l_iopen_88 > l_iclose_360 && l_iclose_352 < l_iopen_96) || (l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_360 > l_iopen_96 && l_iopen_88 > l_iclose_352 && l_iopen_88 > l_iclose_360 && l_iclose_352 < l_iopen_96) || (l_ihigh_136 > l_ihigh_144 && l_ilow_296 > l_ilow_304 && l_iclose_360 > l_iopen_96 && l_iopen_88 > l_iclose_352 && l_iopen_88 > l_iclose_360 && l_iclose_352 < l_iopen_96) || (l_iclose_360 > l_iopen_96 && l_iopen_88 > l_iclose_352 && l_iopen_88 > l_iclose_360 && l_iclose_352 < l_iopen_96)) { li_unused_420 = 1; li_ret_4 = 81; return (li_ret_4); } if ((l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_iclose_360 > l_iopen_96 && l_iopen_88 >= l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ilow_288 == l_iopen_88 && l_ihigh_128 > l_iopen_88) || (l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_360 > l_iopen_96 && l_iopen_88 >= l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ilow_288 == l_iopen_88 && l_ihigh_128 > l_iopen_88) || (l_ihigh_128 > l_ihigh_136 && l_ihigh_136 > l_ihigh_144 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iclose_360 > l_iopen_96 && l_iopen_88 >= l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ilow_288 == l_iopen_88 && l_ihigh_128 > l_iopen_88) || (l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296 && l_iclose_360 > l_iopen_96 && l_iopen_88 >= l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ilow_288 == l_iopen_88 && l_ihigh_128 > l_iopen_88)) { li_unused_424 = 1; li_ret_4 = 82; return (li_ret_4); } if ((l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_iclose_360 > l_iopen_96 && l_iopen_88 > l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296) || (l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_360 > l_iopen_96 && l_iopen_88 > l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296) || (l_ihigh_136 > l_ihigh_144 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iclose_360 > l_iopen_96 && l_iopen_88 > l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296) || (l_ilow_288 > l_ilow_296 && l_iclose_360 > l_iopen_96 && l_iopen_88 > l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 > l_ilow_296)) { li_unused_428 = 1; li_ret_4 = 83; return (li_ret_4); } if ((l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_iclose_360 > l_iopen_96 && l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && (l_iopen_88 >= l_iopen_96 && l_iopen_88 < l_iclose_360) || (l_iopen_88 <= l_iclose_360 && l_iopen_88 > l_iopen_96)) || (l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_360 > l_iopen_96 && l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && (l_iopen_88 >= l_iopen_96 && l_iopen_88 < l_iclose_360) || (l_iopen_88 <= l_iclose_360 && l_iopen_88 > l_iopen_96)) || (l_ihigh_136 > l_ihigh_144 && l_ilow_296 > l_ilow_304 && l_iclose_360 > l_iopen_96 && l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && (l_iopen_88 >= l_iopen_96 && l_iopen_88 < l_iclose_360) || (l_iopen_88 <= l_iclose_360 && l_iopen_88 > l_iopen_96)) || (l_iclose_360 > l_iopen_96 && l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && (l_iopen_88 >= l_iopen_96 && l_iopen_88 < l_iclose_360) || (l_iopen_88 <= l_iclose_360 && l_iopen_88 > l_iopen_96))) { li_unused_432 = 1; li_ret_4 = 84; return (li_ret_4); } if ((l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ihigh_160 > l_ihigh_168 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_ilow_320 > l_ilow_328 && l_iopen_104 > l_iclose_368 && l_iopen_96 > l_iclose_360 && l_iopen_88 > l_iclose_352 && l_ihigh_144 > l_ihigh_136 && l_ihigh_136 > l_ihigh_128 && l_ilow_304 > l_ilow_296 && l_ilow_296 > l_ilow_288 && MathAbs(l_iopen_96 - l_iclose_368) <= 3.0 * gd_760 && MathAbs(l_iopen_88 - l_iclose_360) <= 3.0 * gd_760) || (l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_iopen_104 > l_iclose_368 && l_iopen_96 > l_iclose_360 && l_iopen_88 > l_iclose_352 && l_ihigh_144 > l_ihigh_136 && l_ihigh_136 > l_ihigh_128 && l_ilow_304 > l_ilow_296 && l_ilow_296 > l_ilow_288 && MathAbs(l_iopen_96 - l_iclose_368) <= 3.0 * gd_760 && MathAbs(l_iopen_88 - l_iclose_360) <= 3.0 * gd_760) || (l_ihigh_144 > l_ihigh_152 && l_ilow_304 > l_ilow_312 && l_iopen_104 > l_iclose_368 && l_iopen_96 > l_iclose_360 && l_iopen_88 > l_iclose_352 && l_ihigh_144 > l_ihigh_136 && l_ihigh_136 > l_ihigh_128 && l_ilow_304 > l_ilow_296 && l_ilow_296 > l_ilow_288 && MathAbs(l_iopen_96 - l_iclose_368) <= 3.0 * gd_760 && MathAbs(l_iopen_88 - l_iclose_360) <= 3.0 * gd_760) || (l_iopen_104 > l_iclose_368 && l_iopen_96 > l_iclose_360 && l_iopen_88 > l_iclose_352 && l_ihigh_144 > l_ihigh_136 && l_ihigh_136 > l_ihigh_128 && l_ilow_304 > l_ilow_296 && l_ilow_296 > l_ilow_288 && MathAbs(l_iopen_96 - l_iclose_368) <= 3.0 * gd_760 && MathAbs(l_iopen_88 - l_iclose_360) <= 3.0 * gd_760)) { li_unused_436 = 1; li_ret_4 = 85; return (li_ret_4); } if ((l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_iclose_360 > l_iopen_96 && l_iopen_96 > l_ihigh_144 && l_iopen_88 > l_iclose_352 && l_iclose_352 > l_ihigh_136 && MathAbs(l_iclose_352 - l_iclose_360) < 4.0 * gd_760) || (l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_360 > l_iopen_96 && l_iopen_96 > l_ihigh_144 && l_iopen_88 > l_iclose_352 && l_iclose_352 > l_ihigh_136 && MathAbs(l_iclose_352 - l_iclose_360) < 4.0 * gd_760) || (l_ihigh_136 > l_ihigh_144 && l_ilow_296 > l_ilow_304 && l_iclose_360 > l_iopen_96 && l_iopen_96 > l_ihigh_144 && l_iopen_88 > l_iclose_352 && l_iclose_352 > l_ihigh_136 && MathAbs(l_iclose_352 - l_iclose_360) < 4.0 * gd_760) || (l_iclose_360 > l_iopen_96 && l_iopen_96 > l_ihigh_144 && l_iopen_88 > l_iclose_352 && l_iclose_352 > l_ihigh_136 && MathAbs(l_iclose_352 - l_iclose_360) < 4.0 * gd_760)) { li_unused_440 = 1; li_ret_4 = 86; return (li_ret_4); } if ((l_ihigh_152 > l_ihigh_160 && l_ihigh_160 > l_ihigh_168 && l_ihigh_168 > l_ihigh_176 && l_ilow_312 > l_ilow_320 && l_ilow_320 > l_ilow_328 && l_ilow_328 > l_ilow_336 && l_iclose_368 > l_iopen_104 && l_ihigh_144 > l_ihigh_152 && l_iclose_360 > l_iopen_96 && l_ihigh_136 > l_ihigh_144 && l_iclose_360 > l_iclose_368 && l_iopen_96 < l_iclose_368 && l_iopen_96 > l_iopen_104 && l_iclose_352 > l_iopen_88 && l_ihigh_128 > l_ihigh_136 && l_iclose_352 > l_iclose_360 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iopen_88 < l_iclose_360 && l_iopen_88 > l_iopen_96 && l_ihigh_136 > l_iclose_360 + (l_iclose_360 - 1.0 * l_iopen_96) && l_ihigh_128 > l_iclose_352 + (l_iclose_352 - 1.1 * l_iopen_88) && l_ihigh_128 - l_iclose_352 > l_ihigh_136 - l_iclose_360 && l_iclose_352 - l_iopen_88 < l_iclose_360 - l_iopen_96) || (l_ihigh_152 > l_ihigh_160 && l_ihigh_160 > l_ihigh_168 && l_ilow_312 > l_ilow_320 && l_ilow_320 > l_ilow_328 && l_iclose_368 > l_iopen_104 && l_ihigh_144 > l_ihigh_152 && l_iclose_360 > l_iopen_96 && l_ihigh_136 > l_ihigh_144 && l_iclose_360 > l_iclose_368 && l_iopen_96 < l_iclose_368 && l_iopen_96 > l_iopen_104 && l_iclose_352 > l_iopen_88 && l_ihigh_128 > l_ihigh_136 && l_iclose_352 > l_iclose_360 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iopen_88 < l_iclose_360 && l_iopen_88 > l_iopen_96 && l_ihigh_136 > l_iclose_360 + (l_iclose_360 - 1.0 * l_iopen_96) && l_ihigh_128 > l_iclose_352 + (l_iclose_352 - 1.1 * l_iopen_88) && l_ihigh_128 - l_iclose_352 > l_ihigh_136 - l_iclose_360 && l_iclose_352 - l_iopen_88 < l_iclose_360 - l_iopen_96) || (l_ihigh_152 > l_ihigh_160 && l_ilow_312 > l_ilow_320 && l_iclose_368 > l_iopen_104 && l_ihigh_144 > l_ihigh_152 && l_iclose_360 > l_iopen_96 && l_ihigh_136 > l_ihigh_144 && l_iclose_360 > l_iclose_368 && l_iopen_96 < l_iclose_368 && l_iopen_96 > l_iopen_104 && l_iclose_352 > l_iopen_88 && l_ihigh_128 > l_ihigh_136 && l_iclose_352 > l_iclose_360 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iopen_88 < l_iclose_360 && l_iopen_88 > l_iopen_96 && l_ihigh_136 > l_iclose_360 + (l_iclose_360 - 1.0 * l_iopen_96) && l_ihigh_128 > l_iclose_352 + (l_iclose_352 - 1.1 * l_iopen_88) && l_ihigh_128 - l_iclose_352 > l_ihigh_136 - l_iclose_360 && l_iclose_352 - l_iopen_88 < l_iclose_360 - l_iopen_96) || (l_iclose_368 > l_iopen_104 && l_ihigh_144 > l_ihigh_152 && l_iclose_360 > l_iopen_96 && l_ihigh_136 > l_ihigh_144 && l_iclose_360 > l_iclose_368 && l_iopen_96 < l_iclose_368 && l_iopen_96 > l_iopen_104 && l_iclose_352 > l_iopen_88 && l_ihigh_128 > l_ihigh_136 && l_iclose_352 > l_iclose_360 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iopen_88 < l_iclose_360 && l_iopen_88 > l_iopen_96 && l_ihigh_136 > l_iclose_360 + (l_iclose_360 - 1.0 * l_iopen_96) && l_ihigh_128 > l_iclose_352 + (l_iclose_352 - 1.1 * l_iopen_88) && l_ihigh_128 - l_iclose_352 > l_ihigh_136 - l_iclose_360 && l_iclose_352 - l_iopen_88 < l_iclose_360 - l_iopen_96)) { li_unused_444 = 1; li_ret_4 = 87; return (li_ret_4); } if ((l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ihigh_160 > l_ihigh_168 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_ilow_320 > l_ilow_328 && l_iclose_368 > l_iopen_104 && l_iclose_360 > l_iopen_96 && l_iclose_360 > l_iclose_368 && (MathAbs(l_iopen_88 - l_iclose_360) <= 3.0 * gd_760 && l_iclose_352 - l_iopen_88 > 3.0 * gd_760 && l_ihigh_128 > l_iclose_352 + 1.5 * (l_iclose_352 - l_iopen_88) && l_ilow_288 < l_iopen_88 - 1.5 * (l_iclose_352 - l_iopen_88)) || (l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_iopen_88 > l_iclose_360 + 2.0 * gd_760)) || (l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_iclose_368 > l_iopen_104 && l_iclose_360 > l_iopen_96 && l_iclose_360 > l_iclose_368 && (MathAbs(l_iopen_88 - l_iclose_360) <= 3.0 * gd_760 && l_iclose_352 - l_iopen_88 > 3.0 * gd_760 && l_ihigh_128 > l_iclose_352 + 1.5 * (l_iclose_352 - l_iopen_88) && l_ilow_288 < l_iopen_88 - 1.5 * (l_iclose_352 - l_iopen_88)) || (l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_iopen_88 > l_iclose_360 + 2.0 * gd_760)) || (l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_368 > l_iopen_104 && l_iclose_360 > l_iopen_96 && l_iclose_360 > l_iclose_368 && (MathAbs(l_iopen_88 - l_iclose_360) <= 3.0 * gd_760 && l_iclose_352 - l_iopen_88 > 3.0 * gd_760 && l_ihigh_128 > l_iclose_352 + 1.5 * (l_iclose_352 - l_iopen_88) && l_ilow_288 < l_iopen_88 - 1.5 * (l_iclose_352 - l_iopen_88)) || (l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_iopen_88 > l_iclose_360 + 2.0 * gd_760)) || (l_ihigh_136 > l_ihigh_144 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iclose_368 > l_iopen_104 && l_iclose_360 > l_iopen_96 && l_iclose_360 > l_iclose_368 && (MathAbs(l_iopen_88 - l_iclose_360) <= 3.0 * gd_760 && l_iclose_352 - l_iopen_88 > 3.0 * gd_760 && l_ihigh_128 > l_iclose_352 + 1.5 * (l_iclose_352 - l_iopen_88) && l_ilow_288 < l_iopen_88 - 1.5 * (l_iclose_352 - l_iopen_88)) || (l_iopen_88 == l_iclose_352 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_iopen_88 > l_iclose_360 + 2.0 * gd_760))) { li_unused_448 = 1; li_ret_4 = 88; return (li_ret_4); } if ((l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ihigh_160 > l_ihigh_168 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_ilow_320 > l_ilow_328 && l_ihigh_136 > l_ihigh_144 && l_ilow_296 > l_ilow_304 && l_ihigh_128 < l_ihigh_136 && l_ilow_288 < l_ilow_296 && l_iopen_96 > l_iopen_104 && l_iopen_104 == l_iclose_368 && l_iopen_96 == l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ihigh_144 > l_iopen_104 && l_ilow_304 < l_iopen_104 && l_ihigh_136 > l_iopen_96 && l_ilow_296 < l_iopen_96 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_iopen_88 < l_iopen_96) || (l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_ihigh_136 > l_ihigh_144 && l_ilow_296 > l_ilow_304 && l_ihigh_128 < l_ihigh_136 && l_ilow_288 < l_ilow_296 && l_iopen_96 > l_iopen_104 && l_iopen_104 == l_iclose_368 && l_iopen_96 == l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ihigh_144 > l_iopen_104 && l_ilow_304 < l_iopen_104 && l_ihigh_136 > l_iopen_96 && l_ilow_296 < l_iopen_96 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_iopen_88 < l_iopen_96) || (l_ihigh_144 > l_ihigh_152 && l_ilow_304 > l_ilow_312 && l_ihigh_136 > l_ihigh_144 && l_ilow_296 > l_ilow_304 && l_ihigh_128 < l_ihigh_136 && l_ilow_288 < l_ilow_296 && l_iopen_96 > l_iopen_104 && l_iopen_104 == l_iclose_368 && l_iopen_96 == l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ihigh_144 > l_iopen_104 && l_ilow_304 < l_iopen_104 && l_ihigh_136 > l_iopen_96 && l_ilow_296 < l_iopen_96 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_iopen_88 < l_iopen_96) || (l_ihigh_136 > l_ihigh_144 && l_ilow_296 > l_ilow_304 && l_ihigh_128 < l_ihigh_136 && l_ilow_288 < l_ilow_296 && l_iopen_96 > l_iopen_104 && l_iopen_104 == l_iclose_368 && l_iopen_96 == l_iclose_360 && l_iopen_88 == l_iclose_352 && l_ihigh_144 > l_iopen_104 && l_ilow_304 < l_iopen_104 && l_ihigh_136 > l_iopen_96 && l_ilow_296 < l_iopen_96 && l_ihigh_128 > l_iopen_88 && l_ilow_288 < l_iopen_88 && l_iopen_88 < l_iopen_96)) { li_unused_452 = 1; li_ret_4 = 89; return (li_ret_4); } if ((l_ihigh_160 > l_ihigh_168 && l_ihigh_168 > l_ihigh_176 && l_ihigh_176 > l_ihigh_184 && l_ilow_320 > l_ilow_328 && l_ilow_328 > l_ilow_336 && l_ilow_336 > l_ilow_344 && l_iclose_384 > l_iopen_120 && l_ilow_312 > l_ihigh_160 && l_iclose_376 > l_iopen_112 && l_iclose_360 > l_iopen_96 && l_iclose_352 < l_iopen_112 && l_iclose_352 > l_iclose_384 + 2.0 * gd_760 && l_iclose_360 > l_iclose_368 && l_iclose_368 > l_iclose_376 && l_iopen_88 > l_iclose_352 && l_iopen_88 <= l_iclose_360) || (l_ihigh_160 > l_ihigh_168 && l_ihigh_168 > l_ihigh_176 && l_ilow_320 > l_ilow_328 && l_ilow_328 > l_ilow_336 && l_iclose_384 > l_iopen_120 && l_ilow_312 > l_ihigh_160 && l_iclose_376 > l_iopen_112 && l_iclose_360 > l_iopen_96 && l_iclose_352 < l_iopen_112 && l_iclose_352 > l_iclose_384 + 2.0 * gd_760 && l_iclose_360 > l_iclose_368 && l_iclose_368 > l_iclose_376 && l_iopen_88 > l_iclose_352 && l_iopen_88 <= l_iclose_360) || (l_ihigh_160 > l_ihigh_168 && l_ilow_320 > l_ilow_328 && l_iclose_384 > l_iopen_120 && l_ilow_312 > l_ihigh_160 && l_iclose_376 > l_iopen_112 && l_iclose_360 > l_iopen_96 && l_iclose_352 < l_iopen_112 && l_iclose_352 > l_iclose_384 + 2.0 * gd_760 && l_iclose_360 > l_iclose_368 && l_iclose_368 > l_iclose_376 && l_iopen_88 > l_iclose_352 && l_iopen_88 <= l_iclose_360) || (l_ihigh_136 > l_ihigh_144 && l_ilow_296 > l_ilow_304 && l_iclose_368 > l_iopen_104 && l_iopen_96 == l_iclose_360 && l_ilow_296 > l_ihigh_144 && l_iclose_384 > l_iopen_120 && l_ilow_312 > l_ihigh_160 && l_iclose_376 > l_iopen_112 && l_iclose_360 > l_iopen_96 && l_iclose_352 < l_iopen_112 && l_iclose_352 > l_iclose_384 + 2.0 * gd_760 && l_iclose_360 > l_iclose_368 && l_iclose_368 > l_iclose_376 && l_iopen_88 > l_iclose_352 && l_iopen_88 <= l_iclose_360)) { li_unused_456 = 1; li_ret_4 = 90; return (li_ret_4); } if ((l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ihigh_160 > l_ihigh_168 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_ilow_320 > l_ilow_328 && l_iclose_368 > l_iopen_104 && l_iopen_96 > l_iclose_368 && l_iopen_96 > l_iclose_360 && l_iclose_360 > l_iclose_368 && l_iopen_88 > l_iclose_352 && l_iopen_88 < l_iopen_96 && l_iopen_88 > l_iclose_360 && l_iclose_352 < l_iclose_368 && l_iclose_352 > l_iopen_104) || (l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_iclose_368 > l_iopen_104 && l_iopen_96 > l_iclose_368 && l_iopen_96 > l_iclose_360 && l_iclose_360 > l_iclose_368 && l_iopen_88 > l_iclose_352 && l_iopen_88 < l_iopen_96 && l_iopen_88 > l_iclose_360 && l_iclose_352 < l_iclose_368 && l_iclose_352 > l_iopen_104) || (l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_368 > l_iopen_104 && l_iopen_96 > l_iclose_368 && l_iopen_96 > l_iclose_360 && l_iclose_360 > l_iclose_368 && l_iopen_88 > l_iclose_352 && l_iopen_88 < l_iopen_96 && l_iopen_88 > l_iclose_360 && l_iclose_352 < l_iclose_368 && l_iclose_352 > l_iopen_104) || (l_ihigh_136 > l_ihigh_144 && l_ilow_296 > l_ilow_304 && l_iclose_368 > l_iopen_104 && l_iopen_96 > l_iclose_368 && l_iopen_96 > l_iclose_360 && l_iclose_360 > l_iclose_368 && l_iopen_88 > l_iclose_352 && l_iopen_88 < l_iopen_96 && l_iopen_88 > l_iclose_360 && l_iclose_352 < l_iclose_368 && l_iclose_352 > l_iopen_104)) { li_unused_460 = 1; li_ret_4 = 91; return (li_ret_4); } if ((l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_iclose_360 > l_iopen_96 && (l_iclose_352 > l_iopen_88 && l_iopen_88 > l_iclose_360 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 == l_iopen_88 && l_ihigh_128 > 2.0 * (l_iclose_352 - l_iopen_88)) || (l_iopen_88 > l_iclose_352 && l_iclose_352 > l_iclose_360 && l_ilow_288 == l_iclose_352 && l_ihigh_128 > l_iopen_88 + 2.0 * (l_iopen_88 - l_iclose_352))) || (l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_iclose_360 > l_iopen_96 && (l_iclose_352 > l_iopen_88 && l_iopen_88 > l_iclose_360 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 == l_iopen_88 && l_ihigh_128 > 2.0 * (l_iclose_352 - l_iopen_88)) || (l_iopen_88 > l_iclose_352 && l_iclose_352 > l_iclose_360 && l_ilow_288 == l_iclose_352 && l_ihigh_128 > l_iopen_88 + 2.0 * (l_iopen_88 - l_iclose_352))) || (l_ihigh_136 > l_ihigh_144 && l_ilow_288 > l_ilow_296 && l_ilow_296 > l_ilow_304 && l_iclose_360 > l_iopen_96 && (l_iclose_352 > l_iopen_88 && l_iopen_88 > l_iclose_360 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 == l_iopen_88 && l_ihigh_128 > 2.0 * (l_iclose_352 - l_iopen_88)) || (l_iopen_88 > l_iclose_352 && l_iclose_352 > l_iclose_360 && l_ilow_288 == l_iclose_352 && l_ihigh_128 > l_iopen_88 + 2.0 * (l_iopen_88 - l_iclose_352))) || (l_ilow_288 > l_ilow_296 && l_iclose_360 > l_iopen_96 && (l_iclose_352 > l_iopen_88 && l_iopen_88 > l_iclose_360 && l_ihigh_128 > l_ihigh_136 && l_ilow_288 == l_iopen_88 && l_ihigh_128 > 2.0 * (l_iclose_352 - l_iopen_88)) || (l_iopen_88 > l_iclose_352 && l_iclose_352 > l_iclose_360 && l_ilow_288 == l_iclose_352 && l_ihigh_128 > l_iopen_88 + 2.0 * (l_iopen_88 - l_iclose_352)))) { li_unused_464 = 1; li_ret_4 = 92; return (li_ret_4); } if (l_ihigh_128 - l_ilow_288 > 4.0 * (l_iopen_88 - l_iclose_352) && (l_iclose_352 - l_ilow_288) / (l_ihigh_128 - l_ilow_288 + 0.001) >= 0.75 && (l_iopen_88 - l_ilow_288) / (l_ihigh_128 - l_ilow_288 + 0.001) >= 0.75) { li_unused_468 = 1; li_ret_4 = 93; return (li_ret_4); } if (MathAbs(l_iclose_360 - l_iopen_96) > (l_ihigh_128 - l_ilow_288) / 2.0 && l_iclose_360 > l_iopen_96 && l_iclose_352 < l_iopen_88 && l_ihigh_128 < l_iclose_360 && l_ilow_288 > l_iopen_96) { li_unused_472 = 1; li_ret_4 = 94; return (li_ret_4); } if ((l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ilow_312 > l_ilow_320 && l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_ihigh_152 > l_ihigh_160 && l_iopen_88 > l_ihigh_136 && l_iopen_88 == l_iclose_352 && l_ihigh_128 == l_iopen_88 && l_ilow_288 < l_iopen_88 - 2.0 * gd_760) || (l_ilow_296 > l_ilow_304 && l_ilow_304 > l_ilow_312 && l_ihigh_136 > l_ihigh_144 && l_ihigh_144 > l_ihigh_152 && l_iopen_88 > l_ihigh_136 && l_iopen_88 == l_iclose_352 && l_ihigh_128 == l_iopen_88 && l_ilow_288 < l_iopen_88 - 2.0 * gd_760) || (l_ilow_296 > l_ilow_304 && l_ihigh_136 > l_ihigh_144 && l_iopen_88 > l_ihigh_136 && l_iopen_88 == l_iclose_352 && l_ihigh_128 == l_iopen_88 && l_ilow_288 < l_iopen_88 - 2.0 * gd_760) || (l_iopen_88 > l_ihigh_136 && l_iopen_88 == l_iclose_352 && l_ihigh_128 == l_iopen_88 && l_ilow_288 < l_iopen_88 - 2.0 * gd_760)) { li_unused_476 = 1; li_ret_4 = 95; return (li_ret_4); } return (li_ret_4); }