MQLArticles/Strategy
Repository files (latest commit first)
Filename Latest commit message Latest commit date
nique_372 77019965e7 Sanitizar encoding a UTF-8: convertir 11 archivos desde UTF-16LE
Los .mqh estaban corruptos en el working tree porque core.autocrlf
normalizaba bytes de un archivo UTF-16LE como si fuera texto de 1 byte
por caracter, desalineando el contenido tras la primera linea. Se
reconstruyeron desde el blob de git (HEAD), no desde el working tree,
y se verifico igualdad byte a byte contra la conversion limpia antes
de commitear. Los .set estaban marcados binary en .gitattributes y no
sufrian este problema; solo se les cambio el encoding.
2026-09-14 11:01:42 -05:00
..
Core Correciones y mejoras 2026-09-13 08:47:52 -05:00
Drv Sanitizar encoding a UTF-8: convertir 11 archivos desde UTF-16LE 2026-09-14 11:01:42 -05:00
Utils Correciones y mejoras 2026-09-13 08:47:52 -05:00
Main.mqh new files added 2025-12-05 16:33:47 -05:00
README.md new files added 2026-09-06 11:15:27 -05:00

← MQLArticles

Strategy

Framework for building EAs by composition: a base strategy template plus chainable entry/exit filters and a text-based logic engine to combine them.

Main features

  • Base strategy template with TP/SL by ATR or fixed points, lot sizing modes and buy/sell control (CStrategyBaseTemplate<TPadre>).
  • Chainable technical filters (RSI, Stochastic, Bollinger Bands, SuperTrend, FVG, AD, liquidity...).
  • A small logic-rule engine that combines filters using a text expression (and/or, groups, indices) instead of hardcoded if-chains (CStrategyFilterParserClasific).
  • Time filters: by day of week and by year (Strategy/Utils).

Basic usage

Basic configuration

CAtrUltraOptimized* atr_ultra = new CAtrUltraOptimized();
atr_ultra.SetVariables(PERIOD_CURRENT, _Symbol, 0, 14);
atr_ultra.SetInternalPointer();
strategy.AddLogFlags(InpStrategyLogLevel);
strategy.SetAtrTP_SL(atr_ultra, INP_STRATEGY_ATR_MULTIPLIER_TP, INP_STRATEGY_ATR_MULTIPLIER_SL); // TP/SL by ATR
strategy.SetOperateMode(TR_BUY_SELL, INP_STRATEGY_TYPE_TPSL);
strategy.SetTP_SL(INP_STRATEGY_SL_POINT, INP_STRATEGY_TP_POINT); // TP/SL by points
if(InpRmLoteType == Fijo)
  strategy.FixedLotSize(InpRmLote);

Filters

// RSI filter
if(INP_FILTER_RSI_ENABLE)
  {
   CSFilterRsi* f = new CSFilterRsi();
   strategy.AddFilter(f);
  }

// Stochastic filter
if(INP_FILTER_STOCH_ENABLE)
  {
   CSFilterStochastic* f = new CSFilterStochastic();
   strategy.AddFilter(f);
  }

// Bollinger Bands filter
if(INP_FILTER_BANDS_ENABLE)
  {
   CSFilterBands* f = new CSFilterBands();
   strategy.AddFilter(f);
  }

// Logic combining filters as text
strategy.CodeCompra<CStrategyFilterEmptyFuncFac>(StringFormat(
    "#group oAnd (%s,%s,%s,%s,%s,%s,%s) == 0 oAnd ([%s] == 0 oOr [%s] == 2)",
    CSFIlterAD_NAME, CSFilterSuperTrend_NAME, CSFilterFvg_NAME, CSFilterBands_NAME,
    CSFilterRsi_NAME, CSFilterStochastic_NAME, CSFilterLiqEstimed_NAME,
    CMediationsByZoneFilterName, CMediationsByZoneFilterName), 5);

// Summary of registered filters
strategy.PrintFilters();

Only the most representative classes are shown here.