diff --git a/Documents/BKP/x-121.smc.test.strategy.class.mq5 b/Documents/BKP/x-121.smc.test.strategy.class.mq5 new file mode 100644 index 00000000..9f60be18 Binary files /dev/null and b/Documents/BKP/x-121.smc.test.strategy.class.mq5 differ diff --git a/X121SMCEA/Libraries/x-121.smc.lib.mq5 b/X121SMCEA/Libraries/x-121.smc.lib.mq5 index 9b1df689..edfe1351 100644 --- a/X121SMCEA/Libraries/x-121.smc.lib.mq5 +++ b/X121SMCEA/Libraries/x-121.smc.lib.mq5 @@ -466,3 +466,188 @@ typedef void (*TOnX121SMCSignal)( XSignal &signal, X121SMCStrategyConditions &conditions // ); + +// +struct XRange +{ + // + string symbol; + ENUM_TIMEFRAMES period; + + // + double upper; + double lower; + + // + datetime from; + datetime to; + + // + void XRange() + { + Clean(); + } + + // + // Tools ... + + /** + * Initial ... + * + * @param _symbol: String ... + * @param _period: ENUM_TIMEFRAMES member ... + * @param _upper: Double ... + * @param _lower: Double ... + * @param _from: DateTime ... + * @param _to: DateTime ... + * + * @return ( bool ) + */ + bool Init( + string _symbol, + ENUM_TIMEFRAMES _period, + double _upper, + double _lower, + datetime _from, + datetime _to // + ) + { + // + bool result = false; + + // + result = + // + IsValid(_symbol) && + IsValid(_period) && + IsValid(_from) && + IsValid(_to) && + _upper > 0 && + _lower > 0 && + _to > _from + // + ; + + // + symbol = _symbol; + period = _period; + + // + upper = _upper; + lower = _lower; + + // + from = _from; + to = _to; + + // + result = IsValid(); + + // + return result; + } + + /** + * Cleanup ... + */ + void Clean() + { + // + symbol = NULL; + period = NULL; + + // + upper = 0; + lower = 0; + + // + from = NULL; + to = NULL; + } + + /** + * Validate ... + * + * @return ( bool ) + */ + bool IsValid() + { + // + bool result = false; + + // + result = + // + IsValid(symbol) && + IsValid(period) && + IsValid(from) && + IsValid(to) && + upper > 0 && + lower > 0 && + to > from + // + ; + + // + return result; + } + + /** + * Generate Unique Tag ... + * + * @return ( string ) + */ + string GetTag() + { + // + string result = NULL; + + // + string hash = + ToString(upper) + "," + + ToString(lower) + + ToFormatString(from); + hash = ToMD5(hash); + + // + result = + // + "XRNG_" + symbol + "_" + + ToString(period) + "_" + + hash + // + ; + + // + return result; + } + + /** + * Generate Tooltip ... + * + * @return ( string ) + */ + string GetTooltip() + { + // + string result = NULL; + + // + result = + // + "XRNG" + "\n" + + symbol + "\n" + + ToString(period) + "\n" + + ToString(from) + "\n" + + ToString(to) + // + ; + + // + return result; + } + + // +}; + +// \ No newline at end of file diff --git a/X121SMCEA/Strategy/x-121.smc.test.strategy.class.mq5 b/X121SMCEA/Strategy/x-121.smc.test.strategy.class.mq5 index 9f60be18..f40dae94 100644 Binary files a/X121SMCEA/Strategy/x-121.smc.test.strategy.class.mq5 and b/X121SMCEA/Strategy/x-121.smc.test.strategy.class.mq5 differ