diff --git a/Scripts/MyScripts/Market_Scanner_Pro.mq5 b/Scripts/MyScripts/Market_Scanner_Pro.mq5 new file mode 100644 index 0000000..c2bf29b --- /dev/null +++ b/Scripts/MyScripts/Market_Scanner_Pro.mq5 @@ -0,0 +1,453 @@ +//+------------------------------------------------------------------+ +//| Market_Scanner_Pro.mq5 | +//| QuantScan 2.1 - Professional Market Export | +//| Copyright 2026, xxxxxxxx | +//+------------------------------------------------------------------+ +#property copyright "Copyright 2026, xxxxxxxx" +#property version "3.10" // Added Squeeze & TSI inputs +#property description "Exports 'QuantScan 2.0' dataset for LLM Analysis." +#property description "Combines Trend Quality, Volume, and Statistical metrics." +#property script_show_inputs + +//--- Include Custom Calculators +#include +#include +#include +#include +#include +#include +#include +#include + +//--- Input Parameters --- +input group "Scanner Config" +input bool InpUseMarketWatch = false; // Scan Market Watch? +input string InpSymbolList = "EURUSD,USDJPY,GBPUSD,USDCHF,AUDUSD,XAUUSD,US500,DE40,XTIUSD,ETHUSD"; + +input group "Timeframes" +input ENUM_TIMEFRAMES InpTFFast = PERIOD_M15; // Trigger / Execution +input ENUM_TIMEFRAMES InpTFSlow = PERIOD_H1; // Context / Trend + +input group "Metric Settings" +input int InpDSMAPeriod = 40; +input double InpLaguerreGamma = 0.50; +input int InpMurreyPeriod = 64; +input int InpATRPeriod = 14; +input int InpRVOLPeriod = 20; // Relative Volume Lookback +input int InpERPeriod = 10; // Efficiency Ratio Lookback +input int InpZScorePeriod = 20; // Z-Score Lookback + +input group "TSI Settings" +input int InpTSI_Slow = 25; // TSI Slow Period +input int InpTSI_Fast = 13; // TSI Fast Period +input int InpTSI_Signal = 13; // TSI Signal Period + +input group "Squeeze Settings" +input int InpSqueezeLength = 20; // Indicators Length +input double InpBBMult = 2.0; // Bollinger Deviation +input double InpKCMult = 1.5; // Keltner Multiplier + +//--- Struct for QuantScan 2.0 Data +struct QuantData + { + string timestamp; + string symbol; + double price; + + // --- H1 Context --- + double trend_score; // DSMA Normalized Score + double trend_qual; // Efficiency Ratio (ER) + string zone; // Murrey Math Zone + + // --- M15 Execution --- + double momentum; // Laguerre RSI + double vol_qual; // Relative Volume (RVOL) + string squeeze; // ON/OFF + double z_score; // Statistical Deviation + double vola_regime; // ATR(5)/ATR(50) Ratio + string tsi_dir; // TSI Direction (BULL/BEAR) + }; + +//+------------------------------------------------------------------+ +//| Script Start | +//+------------------------------------------------------------------+ +void OnStart() + { + string symbols[]; + int total_symbols = 0; + +// 1. Symbol List Compilation + if(InpUseMarketWatch) + { + total_symbols = SymbolsTotal(true); + ArrayResize(symbols, total_symbols); + for(int i=0; i k_lo[idx]); + + return squeeze_on ? "ON" : "OFF"; + } + +//+------------------------------------------------------------------+ +//| WRAPPER: Laguerre RSI | +//+------------------------------------------------------------------+ +double Calc_LaguerreRSI(const double &o[], const double &h[], const double &l[], const double &c[]) + { + CLaguerreRSICalculator calc; + if(!calc.Init(InpLaguerreGamma, 3, SMA)) + return 0; + double lrsi[], sig[]; + int total = ArraySize(c); + ArrayResize(lrsi, total); + ArrayResize(sig, total); + calc.Calculate(total, 0, PRICE_CLOSE, o, h, l, c, lrsi, sig); + return lrsi[total-1] / 100.0; + } + +//+------------------------------------------------------------------+ +//| WRAPPER: TSI Direction (Uses Global Inputs) | +//+------------------------------------------------------------------+ +void Calc_TSI_Dir(const double &o[], const double &h[], const double &l[], const double &c[], string &dir) + { + CTSICalculator calc; +// Using Global Inputs + if(!calc.Init(InpTSI_Slow, EMA, InpTSI_Fast, EMA, InpTSI_Signal, EMA)) + { + dir="ERR"; + return; + } + + double tsi[], sig[], osc[]; + int total = ArraySize(c); + ArrayResize(tsi, total); + ArrayResize(sig, total); + ArrayResize(osc, total); + calc.Calculate(total, 0, PRICE_CLOSE, o, h, l, c, tsi, sig, osc); + + if(tsi[total-1] > sig[total-1]) + dir = "BULL"; + else + dir = "BEAR"; + } + +//+------------------------------------------------------------------+ +//| WRAPPER: Murrey Math | +//+------------------------------------------------------------------+ +string Calc_MurreyZone(string symbol, ENUM_TIMEFRAMES tf) + { + CMurreyMathCalculator calc; + if(!calc.Init(symbol, tf, InpMurreyPeriod, 0)) + return "N/A"; + double levels[]; + if(!calc.Calculate(levels)) + return "N/A"; + + double price = SymbolInfoDouble(symbol, SYMBOL_BID); + if(price < levels[2]) + return "Extreme Low"; + if(price > levels[10]) + return "Extreme High"; + + if(price >= levels[2] && price < levels[3]) + return "0/8-1/8 (Bottom)"; + if(price >= levels[3] && price < levels[4]) + return "1/8-2/8 (Weak)"; + if(price >= levels[4] && price < levels[6]) + return "2/8-4/8 (Lower)"; + if(price >= levels[6] && price < levels[8]) + return "4/8-6/8 (Upper)"; + if(price >= levels[8] && price < levels[9]) + return "6/8-7/8 (Weak)"; + if(price >= levels[9] && price <= levels[10]) + return "7/8-8/8 (Top)"; + + return "Middle"; + } +//+------------------------------------------------------------------+ +//+------------------------------------------------------------------+