// Original Liquidity Predator by raphix251 // Include all mqh files // Libraries #include "IncludeLibrarys.mqh" //--- INPUT PARAMETERS // Money Management parameters input string Section_MoneyManagement = ""; // ---MONEY MANAGEMENT--- input double fRiskPerTrade = 1; // Risk per trade input int nMaxTradesPerDay = 5; // Maximum trades per day input double fRiskReward = 2.0; // Risk reward ratio position 1 input bool bRunnerPosition = false; // Runner position (closing when EMAs cross) input double fPercentageRunner = 50; // Percentage runner position input int nDistanceMoveRunnerSLTP1 = 0; // Distance to move SL of runner to TP1 input double fLossPerLot = 0; // Loss per lot in dollar input int nMaxSpread = 0; // Maximum spread in points input double nMaxDailyProfit = 0; // Maximum daily profit in percent input int nMaxDaysWithoutTrade = 20; // Maximum days without trade(opens trade to keep account alive) // Strategy parameters input string Section_Strategy = ""; // ---STRATEGY--- input double nMoveBeAtProfit = 75; // Move break even at profit input int nMaxLiqus = 5; // Maximale liquidities input ENUM_TIMEFRAMES eLiquTimeframe = PERIOD_M15; // Liquidity timeframe input int fMaxDiffTakeOut = 11; // Maximum difference before take out input int fMinSizeFVG = 0; // Minimum size of fair value gap input int fMaxSizeFVG = 20; // Maximum size of fair value gap input int nCandlesLookbackFVG = 5; // Number of candles to look back for fair value gap input int fMinStopLossSize = 20; // Minimum stoploss size input int fMaxStopLossSize = 50; // Maximum stoploss size input int nMaxCandlesLiquEntry = 5; // Maximum candles between liquidity cross and entry input int nMaxDiffFVGEntry = 0; // Maximum difference between FVG and Entry input bool bNoWigsInOppositeDir = false; // No wicks in opposite direction between liquidity cross and entry input int nMinWigSizePercent = 90; // Minimum wick size of candle in percent //Strategy 1 input bool bStratOne = true; // Strat 1 - Enabled input int nS1MaxDiffFVGLiquCross = 0; // Strat 1 - Maximum difference FVG Liqu Cross input int nS1MaxDiffTakeout = 0; // Strat 1 - Maximum difference takeout input int nS1OrderExpiration = 0; // Strat 1 - Order expiration time[s] // Candles before liquidity input string Section_Candle_Patterns = ""; // ---CANDLES BEFORE LIQUIDITY--- input bool bCheckStrongMomentum = false; // Check momentum input int nCandlesMomentum = 3; // Number of candles to check for momentum input bool bCheckWigs = false; // Check wicks input int nCandlesWigs = 5; // Number of candles to check for wicks // Time filter parameters input string Section_TimeFilter = ""; // ---TIME FILTER--- input int nStartTime = 8; // Start time input int nEndTime = 20; // End time // News filter parameters input string Section_NewsFilter = ""; // ---NEWS FILTER--- input int nNewsMinutesBefore = 30; // No entries before news in minutes input int nNewsMinutesAfter = 10; // No entries after news in minutes input ENUM_CALENDAR_EVENT_IMPORTANCE eNewsImportance = CALENDAR_IMPORTANCE_NONE; // Minimum news importance input string sNewsCurrency1 = "USD"; // News currency to look for input string sNewsCurrency2 = ""; // News currency to look for input string sNewsCurrency3 = ""; // News currency to look for input string sNewsCurrency4 = ""; // News currency to look for input string sNewsCurrency5 = ""; // News currency to look for // RSI filter parameters input string Section_TrendFilter = ""; // ---RSI FILTER--- input bool bRSIActive = false; // RSI filter active input ENUM_TIMEFRAMES eRSITimeframe = PERIOD_CURRENT; // RSI timeframe input int nRSILength = 14; // RSI length input int nRSIRange = 15; // RSI range (50 +- parameter) // EMA filter parameters input string Section_EMAFilter = ""; // ---EMA FILTER--- input bool bEMAActive = false; // EMA filter active input ENUM_TIMEFRAMES eEMATimeframe = PERIOD_CURRENT; // EMA timeframe input int nSmallEMALength = 20; // Small EMA length input int nBigEMALength = 50; // Big EMA length input int nMinDiffEMA = 0; // Minimum difference between small and big EMA input int nEMAShift_CurrTF = 0; // EMA shift current TF input int nEMAShift_HTF = 0; // EMA shift higher TF // Debug input string Section_Debug = ""; // ---DEBUG--- input bool bOptimizationRun = false; // Optimization run (only for testing purpose) input datetime dtDebugTime; // Debug time breakpoint (only for testing purpose) // Global Vars stGlobalVars stGVL; E_DIRECTION eCurrentDirection; CTrade Trade; int nMaxCandles; int nMaxEMAArraySize; datetime tmpDebugTime; int OnInit() { //--- M_Points2Price(); M_InitializeArrays(); nMaxCandles = MathMax(nCandlesLookbackFVG + 3, nMaxCandlesLiquEntry); if(nMaxCandlesLiquEntry==0 || nCandlesLookbackFVG==0) { nMaxCandles = 100; } nMaxCandles = MathMin(nMaxCandles, 100); // We can maximum have 100 candles nMaxEMAArraySize = 2; nMaxEMAArraySize = MathMax(nMaxEMAArraySize, 2 + nEMAShift_CurrTF); nMaxEMAArraySize = MathMax(nMaxEMAArraySize, 2 + nEMAShift_HTF); tmpDebugTime = dtDebugTime; M_RSI_INIT(); M_EMA_INIT(); M_SetLineNames(); M_SetBoxNames(); M_CreateLabel("FilterLabel",5,10); M_CreateLabel("GMTTime",5,40); M_CreateLabel("ServerTime",5,80); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { IndicatorRelease(stGVL.rsiHandle); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { M_GetCandleData(PERIOD_M1, stGVL.Candle, nMaxCandles); M_GetCandleData(eLiquTimeframe, stGVL.Candle_HTF, 5); // We need candles 1-4, 0 is the actual open candle M_DetermineTimes(); M_StateMachine(); if(stGVL.dtTimeCurrent_M1 != stGVL.dtTimeLast_M1) { M_NewBar_M1(); stGVL.dtTimeLast_M1 = stGVL.dtTimeCurrent_M1; } if(stGVL.dtTimeCurrent_HTF != stGVL.dtTimeLast_HTF) { M_NewBar_HTF(); stGVL.dtTimeLast_HTF = stGVL.dtTimeCurrent_HTF; } if(stGVL.bDemandKeepAccountAliveTrade) { M_KeepAliveTrade(); } } //+------------------------------------------------------------------+