New Text Document
New Text Document
//| Scalping_Enko_MultiSymbol_Fixed.mq5 |
//| Copyright 2025, xAI |
//| Modified by Grok 3 |
//+------------------------------------------------------------------+
// Input parameters
input double LotSize = 0.1; // Lot Size
input int FastMAPeriod = 5; // Fast MA Period
input int SlowMAPeriod = 20; // Slow MA Period
input int TrendMAPeriod = 50; // Trend MA Period (for trend filter)
input int RSIPeriod = 14; // RSI Period
input int Slippage = 50; // Slippage in points
input double StopLossPips = 10.0; // Stop Loss in pips
input double TakeProfitPips = 50.0; // Take Profit in pips (1:5 risk-reward ratio)
// Global variables
int handleFastMA = 0; // Handle for Fast Moving Average
int handleSlowMA = 0; // Handle for Slow Moving Average
int handleTrendMA = 0; // Handle for Trend Moving Average
int handleRSI = 0; // Handle for RSI
CTrade trade; // Trade object for order execution
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// Create indicators for the chart's symbol
string symbol = _Symbol;
handleFastMA = iMA(symbol, PERIOD_M1, FastMAPeriod, 0, MODE_SMA, PRICE_CLOSE);
handleSlowMA = iMA(symbol, PERIOD_M1, SlowMAPeriod, 0, MODE_SMA, PRICE_CLOSE);
handleTrendMA = iMA(symbol, PERIOD_M1, TrendMAPeriod, 0, MODE_SMA, PRICE_CLOSE);
handleRSI = iRSI(symbol, PERIOD_M1, RSIPeriod, PRICE_CLOSE);
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// Release indicators
if(handleFastMA != INVALID_HANDLE) IndicatorRelease(handleFastMA);
if(handleSlowMA != INVALID_HANDLE) IndicatorRelease(handleSlowMA);
if(handleTrendMA != INVALID_HANDLE) IndicatorRelease(handleTrendMA);
if(handleRSI != INVALID_HANDLE) IndicatorRelease(handleRSI);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Get the current symbol and timeframe
string symbol = _Symbol;
ENUM_TIMEFRAMES timeframe = PERIOD_M1; // Scalping on 1-minute timeframe
// Trading logic
bool buySignal = false;
bool sellSignal = false;
//+------------------------------------------------------------------+