Re: 🔺 MT5 XARD - Simple Trend Following Trading System

1591
Okay, I used Antigravity, where I have the current Gemini Pro model . Test these basic statistics of average distance in points to see if they make sense. If anyone finds any errors and is willing to correct them, feel free to do so. If any statistics are missing increase history range in the indicator.
Claude Opus 4.5 fix

Code: Select all

Explanation of the Statistics Calculation Fix
The Problem
The original code had flags that prevented accurate counting of transitions between semaphores:

mq5
bool S4_Processed_For_OpS4 = false;
bool S3_Processed_For_OpS3 = false;
These flags were set to true after the first opposite transition was counted, and only reset when a new signal appeared. This caused a bug:

Example scenario:

Say you have the sequence: S4 Low → S4 High → S4 Low → S4 High
The old code would only count the first S4 Low → S4 High transition
The subsequent S4 High → S4 Low → S4 High transitions were incorrectly skipped
The Fix
I removed the unnecessary flags S4_Processed_For_OpS4 and S3_Processed_For_OpS3. Now:

Statistic	What it counts
S4 → Op S4	Every transition from S4 Low → S4 High (UP) or S4 High → S4 Low (DN)
S3 → Op S3	Every transition from S3 Low → S3 High (UP) or S3 High → S3 Low (DN)
What Remained Unchanged
The flag S4_Processed_For_OpS3 was kept because it has a different purpose:

For the "S4 → Op S3" statistic, we only want to count the first opposite S3 signal after each S4
Not every S3 signal between two S4 signals
Result
The average points calculation is now correct because:

All completed moves between opposite signals are counted
OK i have enough of AI "coding" for today have fun fixing code :sweat: