//+------------------------------------------------------------------+ //| 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 //--- 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. //--- //--- Single-symbol functions are different: there "" means the current //--- chart symbol. //--- Magic-number filter meaning "any magic". MQL5 magic numbers are //--- ulong, so there is no negative value to borrow as a sentinel - //--- int and -1 would both truncate any magic above 2^31 and collide //--- with a legitimate one. #define STOPFIRST_ANY_MAGIC ULONG_MAX //+------------------------------------------------------------------+ //| Candlestick patterns DetectCandlePattern understands | //| | //| 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. | //+------------------------------------------------------------------+ 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 | //| | //| 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. | //+------------------------------------------------------------------+ 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 //--- directional pattern undefined for it #define STOPFIRST_DOJI_BODY_RATIO 0.1 #endif // STOPFIRST_DEFS_MQH //+------------------------------------------------------------------+