Files
MT5-EA-Sniper-Strategy/tests/SniperEA_Test.mq5
T
rithsila e80b78345e 🚀 Project Organization & Documentation Complete
 Added comprehensive project structure:
- README.md: Professional project documentation with features, installation, and usage
- .gitignore: Comprehensive exclusion rules for MT5, tests, logs, and system files
- tests/: Organized all test files, logs, and validation reports
- tests/README.md: Detailed test documentation and results summary

📁 File Organization:
- Moved test files to tests/ directory (gitignored)
- Moved VALIDATION_REPORT.md to tests/
- Moved SniperEA_Test.mq5 to tests/
- Moved 20250926.log to tests/ (excluded from git)
- Cleaned up compiled files (.ex5)

🎯 Project Status:
- Phase 1 & 2: 100% Complete
- Production Ready: 
- Professional Documentation: 
- Clean Repository Structure: 

Ready for professional deployment! 🚀
2025-09-26 09:46:36 +07:00

144 lines
4.5 KiB
Plaintext

//+------------------------------------------------------------------+
//| SniperEA_Test.mq5 |
//| Test version for compilation |
//+------------------------------------------------------------------+
#property copyright "Sniper Strategy EA"
#property link ""
#property version "1.00"
//--- Include files
#include <Trade/Trade.mqh>
#include <Trade/PositionInfo.mqh>
#include <Trade/OrderInfo.mqh>
//--- Global objects
CTrade trade;
CPositionInfo position;
COrderInfo order;
//--- Input parameters
input group "=== Core Settings ==="
input int MaxTradesPerDay = 3; // Maximum trades per symbol per day
input double RiskPercent = 1.0; // Risk percentage per trade
input double MinRR = 2.0; // Minimum risk-reward ratio
input bool UseTimeFilter = true; // Enable session filtering
//--- Global variables
string SymbolsToTrade[];
int TotalSymbols = 0;
datetime LastBarTime = 0;
bool IsInitialized = false;
//--- Structure definitions
struct OrderBlock
{
double high;
double low;
datetime time;
bool is_bullish;
bool is_fresh;
int strength;
};
struct BiasStrength
{
double strength; // Bias strength (0-100)
string direction; // "BULLISH", "BEARISH", "NEUTRAL"
datetime timestamp; // When bias was calculated
double bos_score; // Score from BOS events (0-40)
double ob_score; // Score from Order Blocks (0-30)
double pattern_score; // Score from pattern confluence (0-30)
};
struct BiasHistory
{
BiasStrength history[]; // Dynamic array for bias history
int current_index; // Current position in circular buffer
bool is_initialized; // Whether history is initialized
datetime last_change; // Last time bias changed significantly
string previous_bias; // Previous bias direction
};
struct MajorLevel
{
double level; // Price level
datetime time; // When level was formed
bool is_resistance; // True for resistance, false for support
double strength; // Level strength (0-1)
int touches; // Number of times level was tested
ENUM_TIMEFRAMES timeframe; // Timeframe where level was detected
};
//--- Phase 2: Enhanced Multi-Timeframe Global Variables
BiasHistory GlobalBiasHistory[]; // Bias history for each symbol
MajorLevel D1_MajorLevels[]; // Daily major levels
MajorLevel W1_MajorLevels[]; // Weekly major levels
datetime LastBiasUpdate = 0; // Last bias calculation time
datetime LastMajorLevelsUpdate = 0; // Last major levels update time
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
Print("=== Sniper EA Test Initialization Started ===");
// Initialize arrays
TotalSymbols = 1;
ArrayResize(SymbolsToTrade, TotalSymbols);
SymbolsToTrade[0] = _Symbol;
// Initialize bias history
ArrayResize(GlobalBiasHistory, TotalSymbols);
ArrayResize(D1_MajorLevels, 0);
ArrayResize(W1_MajorLevels, 0);
IsInitialized = true;
LastBarTime = iTime(_Symbol, PERIOD_M1, 0);
Print("=== Sniper EA Test Initialization Completed ===");
return INIT_SUCCEEDED;
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
Print("Sniper EA Test deinitialized. Reason: ", reason);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
if (!IsInitialized)
return;
// Simple tick processing
datetime current_bar_time = iTime(_Symbol, PERIOD_M1, 0);
if (current_bar_time == LastBarTime)
return;
LastBarTime = current_bar_time;
// Basic processing
ProcessTick();
}
//+------------------------------------------------------------------+
//| Process tick |
//+------------------------------------------------------------------+
void ProcessTick()
{
// Simple processing logic
static int tick_count = 0;
tick_count++;
if (tick_count % 100 == 0)
{
Print("Processed ", tick_count, " ticks");
}
}