StopFirst 1.00, the read-only core
Fourteen headers, a header-only MQL5 library: lot size from risk, pips on
forex, gold and indices, broker checks, bars and candle patterns, cached ATR,
sessions in GMT, account risk, symbol suffixes, a calendar filter. Sends no
trade requests. Plus the LotByRisk example script.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 21:40:34 +03:00 | | | //+------------------------------------------------------------------+
|
| | | //| Defs.mqh|
|
| | | //| Copyright 2026, bandersoft |
|
| | | //| https://www.mql5.com/en/users/fats |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //| Shared constants and sentinels. No dependencies. |
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | #ifndef STOPFIRST_DEFS_MQH
|
| | | #define STOPFIRST_DEFS_MQH
|
| | |
|
2026-10-16 21:48:01 +03:00 | | | //--- Symbol filters. GetTotalProfit, GetPositionCount, GetTotalVolume and
|
| | | //--- the AccountRisk.mqh totals take "" to mean EVERY symbol. A magic
|
| | | //--- string such as "ALL" would not be checked by the compiler - a typo
|
| | | //--- such as "all" would match nothing and the call would silently
|
| | | //--- return 0.
|
StopFirst 1.00, the read-only core
Fourteen headers, a header-only MQL5 library: lot size from risk, pips on
forex, gold and indices, broker checks, bars and candle patterns, cached ATR,
sessions in GMT, account risk, symbol suffixes, a calendar filter. Sends no
trade requests. Plus the LotByRisk example script.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 21:40:34 +03:00 | | | //---
|
2026-10-16 21:48:01 +03:00 | | | //--- Single-symbol functions are different: there "" means the current
|
| | | //--- chart symbol.
|
StopFirst 1.00, the read-only core
Fourteen headers, a header-only MQL5 library: lot size from risk, pips on
forex, gold and indices, broker checks, bars and candle patterns, cached ATR,
sessions in GMT, account risk, symbol suffixes, a calendar filter. Sends no
trade requests. Plus the LotByRisk example script.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 21:40:34 +03:00 | | |
|
| | | //--- Magic-number filter meaning "any magic". MQL5 magic numbers are
|
| | | //--- ulong, so there is no negative value to borrow as a sentinel -
|
2026-10-16 21:48:01 +03:00 | | | //--- int and -1 would both truncate any magic above 2^31 and collide
|
| | | //--- with a legitimate one.
|
StopFirst 1.00, the read-only core
Fourteen headers, a header-only MQL5 library: lot size from risk, pips on
forex, gold and indices, broker checks, bars and candle patterns, cached ATR,
sessions in GMT, account risk, symbol suffixes, a calendar filter. Sends no
trade requests. Plus the LotByRisk example script.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 21:40:34 +03:00 | | | #define STOPFIRST_ANY_MAGIC ULONG_MAX
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| Candlestick patterns DetectCandlePattern understands |
|
| | | //| |
|
2026-10-16 21:48:01 +03:00 | | | //| An enum, not a string: with a string a typo - "hammer", or |
|
| | | //| "SHOOTINGSTAR" - would match no branch and return 0, which is |
|
| | | //| also what "looked and found nothing" returns. An enum makes that |
|
| | | //| a compile error. |
|
StopFirst 1.00, the read-only core
Fourteen headers, a header-only MQL5 library: lot size from risk, pips on
forex, gold and indices, broker checks, bars and candle patterns, cached ATR,
sessions in GMT, account risk, symbol suffixes, a calendar filter. Sends no
trade requests. Plus the LotByRisk example script.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 21:40:34 +03:00 | | | //+------------------------------------------------------------------+
|
| | | enum ENUM_SF_PATTERN
|
| | | {
|
| | | SF_PATTERN_DOJI = 0,
|
| | | SF_PATTERN_HAMMER = 1,
|
| | | SF_PATTERN_SHOOTING_STAR = 2,
|
| | | SF_PATTERN_ENGULFING = 3,
|
| | | SF_PATTERN_PIN_BAR = 4
|
| | | };
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| What DetectCandlePattern reports |
|
| | | //| |
|
2026-10-16 21:48:01 +03:00 | | | //| NONE and NEUTRAL are deliberately different. Returning 0 for both |
|
| | | //| "no pattern here" and "this is a doji" would make a doji |
|
| | | //| impossible to detect. |
|
StopFirst 1.00, the read-only core
Fourteen headers, a header-only MQL5 library: lot size from risk, pips on
forex, gold and indices, broker checks, bars and candle patterns, cached ATR,
sessions in GMT, account risk, symbol suffixes, a calendar filter. Sends no
trade requests. Plus the LotByRisk example script.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 21:40:34 +03:00 | | | //+------------------------------------------------------------------+
|
| | | enum ENUM_SF_SIGNAL
|
| | | {
|
| | | SF_SIGNAL_BEARISH = -1, // pattern found, bearish
|
| | | SF_SIGNAL_NONE = 0, // pattern not found
|
| | | SF_SIGNAL_BULLISH = 1, // pattern found, bullish
|
| | | SF_SIGNAL_NEUTRAL = 2 // pattern found, no directional bias
|
| | | };
|
| | |
|
| | | //--- a body smaller than this share of the candle range counts as no
|
| | | //--- body at all, which makes the candle a doji and leaves every
|
2026-10-16 21:48:01 +03:00 | | | //--- directional pattern undefined for it
|
StopFirst 1.00, the read-only core
Fourteen headers, a header-only MQL5 library: lot size from risk, pips on
forex, gold and indices, broker checks, bars and candle patterns, cached ATR,
sessions in GMT, account risk, symbol suffixes, a calendar filter. Sends no
trade requests. Plus the LotByRisk example script.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 21:40:34 +03:00 | | | #define STOPFIRST_DOJI_BODY_RATIO 0.1
|
| | |
|
| | | #endif // STOPFIRST_DEFS_MQH
|
| | | //+------------------------------------------------------------------+
|