2026-02-15 05:13:55 +00:00 | | | #ifndef INDICATORS_MQH
|
| | | #define INDICATORS_MQH
|
| | |
|
EA: sync live build (Jul-Nov 2026) — trade report direction/setup fix, VZ indicators, risk modules
- AIGateway/profitgtx: report_trade takes direction and setup from the position's
opening deal ("dir_src":"entry"); the closing deal inverted every direction and
restarts lost the setup (99% "auto")
- add MATheory, RiskGuards, RiskSizing, TradePolicy (setup blocklist, strict AI gate)
- add VZ_Core + VZ_Features/MFIB/Regime/Setups/Sessions indicators, VZ_FeaturesExport
service, VZ_DumpMA, VZ_TogglePause
- margin-aware sizing, news, labels and session updates since 2026-07-14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 13:48:22 -06:00 | | | int MAT_Trend(); // MATheory.mqh
|
| | |
|
2026-02-15 05:13:55 +00:00 | | | int MA_Periods[8] = {7, 14, 21, 50, 140, 230, 500, 1400};
|
| | | int MA_Handles[8];
|
| | | double MA_Current[8];
|
| | | double MA_Previous[8];
|
| | |
|
| | | int h_stoch = INVALID_HANDLE;
|
| | | double Stoch_K_Current = 50.0;
|
| | | double Stoch_K_Previous = 50.0;
|
| | | double Stoch_D_Current = 50.0;
|
| | |
|
| | | int h_atr = INVALID_HANDLE;
|
| | | double Current_ATR = 0.0;
|
| | |
|
| | | int h_adx = INVALID_HANDLE;
|
| | | double Current_ADX = 0.0;
|
| | |
|
| | | bool InitializeIndicators()
|
| | | {
|
| | | ArrayInitialize(MA_Handles, INVALID_HANDLE);
|
| | | ArrayInitialize(MA_Current, 0.0);
|
| | | ArrayInitialize(MA_Previous, 0.0);
|
| | |
|
| | | for(int i = 0; i < 8; ++i)
|
| | | {
|
| | | MA_Handles[i] = iMA(_Symbol, PERIOD_CURRENT, MA_Periods[i], 0, MODE_EMA, PRICE_CLOSE);
|
| | | if(MA_Handles[i] == INVALID_HANDLE)
|
| | | return false;
|
| | | }
|
| | |
|
| | | h_stoch = iStochastic(_Symbol, PERIOD_CURRENT, 14, 3, 3, MODE_SMA, STO_LOWHIGH);
|
| | | h_atr = iATR(_Symbol, PERIOD_CURRENT, 14);
|
| | | h_adx = iADX(_Symbol, PERIOD_CURRENT, 14);
|
| | |
|
| | | if(h_stoch == INVALID_HANDLE || h_atr == INVALID_HANDLE || h_adx == INVALID_HANDLE)
|
| | | return false;
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | void UpdateIndicators()
|
| | | {
|
| | | double b2[2];
|
| | |
|
| | | for(int i = 0; i < 8; ++i)
|
| | | {
|
EA: sync live build (Jul-Nov 2026) — trade report direction/setup fix, VZ indicators, risk modules
- AIGateway/profitgtx: report_trade takes direction and setup from the position's
opening deal ("dir_src":"entry"); the closing deal inverted every direction and
restarts lost the setup (99% "auto")
- add MATheory, RiskGuards, RiskSizing, TradePolicy (setup blocklist, strict AI gate)
- add VZ_Core + VZ_Features/MFIB/Regime/Setups/Sessions indicators, VZ_FeaturesExport
service, VZ_DumpMA, VZ_TogglePause
- margin-aware sizing, news, labels and session updates since 2026-07-14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 13:48:22 -06:00 | | | // CopyBuffer into a plain array is oldest-first: b2[0] = closed bar 1, b2[1] = live bar 0.
|
| | | // Until 2026-09-17 these were assigned the other way round, so every cross detector
|
| | | // (Stoch, MA14x50, MA50 reclaim) fired on the opposite cross.
|
2026-02-15 05:13:55 +00:00 | | | if(MA_Handles[i] != INVALID_HANDLE && CopyBuffer(MA_Handles[i], 0, 0, 2, b2) > 1)
|
| | | {
|
EA: sync live build (Jul-Nov 2026) — trade report direction/setup fix, VZ indicators, risk modules
- AIGateway/profitgtx: report_trade takes direction and setup from the position's
opening deal ("dir_src":"entry"); the closing deal inverted every direction and
restarts lost the setup (99% "auto")
- add MATheory, RiskGuards, RiskSizing, TradePolicy (setup blocklist, strict AI gate)
- add VZ_Core + VZ_Features/MFIB/Regime/Setups/Sessions indicators, VZ_FeaturesExport
service, VZ_DumpMA, VZ_TogglePause
- margin-aware sizing, news, labels and session updates since 2026-07-14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 13:48:22 -06:00 | | | MA_Current[i] = b2[1];
|
| | | MA_Previous[i] = b2[0];
|
2026-02-15 05:13:55 +00:00 | | | }
|
| | | }
|
| | |
|
| | | if(h_stoch != INVALID_HANDLE && CopyBuffer(h_stoch, 0, 0, 2, b2) > 1)
|
| | | {
|
EA: sync live build (Jul-Nov 2026) — trade report direction/setup fix, VZ indicators, risk modules
- AIGateway/profitgtx: report_trade takes direction and setup from the position's
opening deal ("dir_src":"entry"); the closing deal inverted every direction and
restarts lost the setup (99% "auto")
- add MATheory, RiskGuards, RiskSizing, TradePolicy (setup blocklist, strict AI gate)
- add VZ_Core + VZ_Features/MFIB/Regime/Setups/Sessions indicators, VZ_FeaturesExport
service, VZ_DumpMA, VZ_TogglePause
- margin-aware sizing, news, labels and session updates since 2026-07-14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 13:48:22 -06:00 | | | Stoch_K_Current = b2[1];
|
| | | Stoch_K_Previous = b2[0];
|
2026-02-15 05:13:55 +00:00 | | | }
|
| | |
|
| | | if(h_stoch != INVALID_HANDLE && CopyBuffer(h_stoch, 1, 0, 1, b2) > 0)
|
| | | Stoch_D_Current = b2[0];
|
| | |
|
| | | if(h_atr != INVALID_HANDLE && CopyBuffer(h_atr, 0, 0, 1, b2) > 0)
|
| | | Current_ATR = b2[0];
|
| | |
|
| | | if(h_adx != INVALID_HANDLE && CopyBuffer(h_adx, 0, 0, 1, b2) > 0)
|
| | | Current_ADX = b2[0];
|
| | | }
|
| | |
|
| | | bool IsBullBias()
|
| | | {
|
EA: sync live build (Jul-Nov 2026) — trade report direction/setup fix, VZ indicators, risk modules
- AIGateway/profitgtx: report_trade takes direction and setup from the position's
opening deal ("dir_src":"entry"); the closing deal inverted every direction and
restarts lost the setup (99% "auto")
- add MATheory, RiskGuards, RiskSizing, TradePolicy (setup blocklist, strict AI gate)
- add VZ_Core + VZ_Features/MFIB/Regime/Setups/Sessions indicators, VZ_FeaturesExport
service, VZ_DumpMA, VZ_TogglePause
- margin-aware sizing, news, labels and session updates since 2026-07-14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 13:48:22 -06:00 | | | if(Use_MA_Theory && MAT_State_From_Stack) return MAT_Trend() > 0;
|
2026-02-15 05:13:55 +00:00 | | | return (MA_Current[0] > MA_Current[3] && MA_Current[3] > MA_Current[4]);
|
| | | }
|
| | |
|
| | | bool IsBearBias()
|
| | | {
|
EA: sync live build (Jul-Nov 2026) — trade report direction/setup fix, VZ indicators, risk modules
- AIGateway/profitgtx: report_trade takes direction and setup from the position's
opening deal ("dir_src":"entry"); the closing deal inverted every direction and
restarts lost the setup (99% "auto")
- add MATheory, RiskGuards, RiskSizing, TradePolicy (setup blocklist, strict AI gate)
- add VZ_Core + VZ_Features/MFIB/Regime/Setups/Sessions indicators, VZ_FeaturesExport
service, VZ_DumpMA, VZ_TogglePause
- margin-aware sizing, news, labels and session updates since 2026-07-14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 13:48:22 -06:00 | | | if(Use_MA_Theory && MAT_State_From_Stack) return MAT_Trend() < 0;
|
2026-02-15 05:13:55 +00:00 | | | return (MA_Current[0] < MA_Current[3] && MA_Current[3] < MA_Current[4]);
|
| | | }
|
| | |
|
| | | int BiasDirection()
|
| | | {
|
EA: sync live build (Jul-Nov 2026) — trade report direction/setup fix, VZ indicators, risk modules
- AIGateway/profitgtx: report_trade takes direction and setup from the position's
opening deal ("dir_src":"entry"); the closing deal inverted every direction and
restarts lost the setup (99% "auto")
- add MATheory, RiskGuards, RiskSizing, TradePolicy (setup blocklist, strict AI gate)
- add VZ_Core + VZ_Features/MFIB/Regime/Setups/Sessions indicators, VZ_FeaturesExport
service, VZ_DumpMA, VZ_TogglePause
- margin-aware sizing, news, labels and session updates since 2026-07-14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 13:48:22 -06:00 | | | if(Use_MA_Theory && MAT_State_From_Stack) return MAT_Trend(); // EMA21 x EMA50
|
2026-02-15 05:13:55 +00:00 | | | if(IsBullBias()) return 1;
|
| | | if(IsBearBias()) return -1;
|
| | | return 0;
|
| | | }
|
| | |
|
| | | void ReleaseIndicators()
|
| | | {
|
| | | for(int i = 0; i < 8; ++i)
|
| | | {
|
| | | if(MA_Handles[i] != INVALID_HANDLE)
|
| | | IndicatorRelease(MA_Handles[i]);
|
| | | MA_Handles[i] = INVALID_HANDLE;
|
| | | }
|
| | |
|
| | | if(h_stoch != INVALID_HANDLE) IndicatorRelease(h_stoch);
|
| | | if(h_atr != INVALID_HANDLE) IndicatorRelease(h_atr);
|
| | | if(h_adx != INVALID_HANDLE) IndicatorRelease(h_adx);
|
| | |
|
| | | h_stoch = INVALID_HANDLE;
|
| | | h_atr = INVALID_HANDLE;
|
| | | h_adx = INVALID_HANDLE;
|
| | | }
|
| | |
|
| | | #endif
|