RSI-Stoch-MA-EA/Chartlabels.mqh
Sahr John 07b77184a9
Some checks failed
Build and Deploy MT5 EA / build (push) Failing after 17s
Build and Deploy MT5 EA / deploy (push) Has been skipped
Update Chartlabels.mqh
2026-01-20 10:15:22 +00:00

261 lines
No EOL
11 KiB
MQL5

//+------------------------------------------------------------------+
//| ChartLabels.mqh |
//| Visual Feedback System |
//+------------------------------------------------------------------+
#property copyright "QuarterTheory x VIZION"
#property strict
#include "GlobalVariables.mqh"
#include "InputParams.mqh"
#include "Utilities.mqh"
#include "AILabels.mqh"
//+------------------------------------------------------------------+
//| Update all chart labels |
//+------------------------------------------------------------------+
void UpdateLabels()
{
//================================================================
// MODE LABEL
//================================================================
ObjectDelete(0, "ModeLabel");
ObjectCreate(0, "ModeLabel", OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, "ModeLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER);
ObjectSetInteger(0, "ModeLabel", OBJPROP_XDISTANCE, 10);
ObjectSetInteger(0, "ModeLabel", OBJPROP_YDISTANCE, 20);
string mode_text = "MODE: " + FamilyToText(Current_Family);
if(Current_Family == FAMILY_TRENDING)
mode_text += " | " + StrengthToText(Current_Strength) + " " + BiasToText(Current_Bias);
color mode_color = clrYellow;
if(Current_Family == FAMILY_TRENDING)
{
if(Current_Bias == BIAS_BULL)
mode_color = (Current_Strength == STRENGTH_STRONG ? clrLime : (Current_Strength == STRENGTH_CONFIRMED ? clrGreenYellow : clrGreen));
if(Current_Bias == BIAS_BEAR)
mode_color = (Current_Strength == STRENGTH_STRONG ? clrRed : (Current_Strength == STRENGTH_CONFIRMED ? clrOrangeRed : clrOrange));
}
else if(Current_Family == FAMILY_RANGING)
mode_color = clrAqua;
else if(Current_Family == FAMILY_CHOP)
mode_color = clrViolet;
ObjectSetString(0, "ModeLabel", OBJPROP_TEXT, mode_text);
ObjectSetInteger(0, "ModeLabel", OBJPROP_COLOR, mode_color);
ObjectSetInteger(0, "ModeLabel", OBJPROP_FONTSIZE, 12);
//================================================================
// MFIB BIAS LABEL
//================================================================
ObjectDelete(0, "MFIBLabel");
if(Use_MFIB_382_Bias)
{
ObjectCreate(0, "MFIBLabel", OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, "MFIBLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER);
ObjectSetInteger(0, "MFIBLabel", OBJPROP_XDISTANCE, 10);
ObjectSetInteger(0, "MFIBLabel", OBJPROP_YDISTANCE, 40);
string mfib_text = "MFIB .382 BIAS: " + BiasToText(MFIB_Bias);
color mfib_color = (MFIB_Bias == BIAS_BULL ? clrLime : (MFIB_Bias == BIAS_BEAR ? clrRed : clrGray));
ObjectSetString(0, "MFIBLabel", OBJPROP_TEXT, mfib_text);
ObjectSetInteger(0, "MFIBLabel", OBJPROP_COLOR, mfib_color);
ObjectSetInteger(0, "MFIBLabel", OBJPROP_FONTSIZE, 11);
}
//================================================================
// STATE LABEL
//================================================================
ObjectDelete(0, "StateLabel");
ObjectCreate(0, "StateLabel", OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, "StateLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER);
ObjectSetInteger(0, "StateLabel", OBJPROP_XDISTANCE, 10);
ObjectSetInteger(0, "StateLabel", OBJPROP_YDISTANCE, Use_MFIB_382_Bias ? 60 : 40);
string state_text = "STATE: " + StateToText(Current_State);
// Add action guidance for pullback/retracement states
if(Current_Family == FAMILY_TRENDING && (Current_State == STATE_PULLBACK || Current_State == STATE_DEEP_RETRACEMENT))
{
if(IsBullBias() && !Bull_MA50_Reclaimed())
state_text += " | ACTION: COUNTER-SELLS (50 SL)";
else if(IsBearBias() && !Bear_MA50_Reclaimed())
state_text += " | ACTION: COUNTER-BUYS (50 SL)";
else
state_text += " | ACTION: TREND-OK (150 SL)";
}
color state_color = clrWhite;
if(Current_State == STATE_CONTINUATION) state_color = clrLime;
else if(Current_State == STATE_PULLBACK) state_color = clrYellow;
else if(Current_State == STATE_DEEP_RETRACEMENT) state_color = clrOrange;
else if(Current_State == STATE_REVERSAL_ATTEMPT) state_color = clrOrangeRed;
else if(Current_State == STATE_REVERSAL_CONFIRMED) state_color = clrRed;
else if(Current_Family == FAMILY_RANGING) state_color = clrAqua;
else if(Current_Family == FAMILY_CHOP) state_color = clrViolet;
ObjectSetString(0, "StateLabel", OBJPROP_TEXT, state_text);
ObjectSetInteger(0, "StateLabel", OBJPROP_COLOR, state_color);
ObjectSetInteger(0, "StateLabel", OBJPROP_FONTSIZE, 11);
//================================================================
// WARNING LABEL
//================================================================
bool anyWarn = (Stoch_Extreme_Warning || Stoch_Reject_Warning || Stoch_Level_Cross ||
MA7_Cross_14_Warning || MA7_Cross_21_Warning || MA50_Break_Warning ||
MA50_Warning || MA140_Warning || MA230_Warning || MA500_Warning ||
Fib_Reject_Warning || MFIB_Reject_Warning ||
Fib_Reclaim_Warning || MFIB_Reclaim_Warning || MA_Reclaim_Warning ||
MA_Reject_Warning || Band_Snap_Warning || Warning_Confluence_3Plus);
if(anyWarn)
{
ObjectDelete(0, "WarningLabel");
ObjectCreate(0, "WarningLabel", OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, "WarningLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER);
ObjectSetInteger(0, "WarningLabel", OBJPROP_XDISTANCE, 10);
ObjectSetInteger(0, "WarningLabel", OBJPROP_YDISTANCE, Use_MFIB_382_Bias ? 80 : 60);
string warn_text = "WARN: ";
if(Stoch_Extreme_Warning) warn_text += "STOCH-EXT | ";
if(Stoch_Reject_Warning) warn_text += "STOCH-REJ | ";
if(Stoch_Level_Cross) warn_text += "STOCH-LVL | ";
if(MA7_Cross_14_Warning) warn_text += "MA7x14-PB | ";
if(MA7_Cross_21_Warning) warn_text += "MA7x21-RET | ";
if(MA50_Break_Warning) warn_text += "MA50-BRK | ";
if(MA50_Warning) warn_text += "MA50 | ";
if(MA140_Warning) warn_text += "MA140 | ";
if(MA230_Warning) warn_text += "MA230 | ";
if(MA500_Warning) warn_text += "MA500 | ";
if(Fib_Reject_Warning) warn_text += "FIB-REJ | ";
if(MFIB_Reject_Warning) warn_text += "MFIB-REJ | ";
if(Fib_Reclaim_Warning) warn_text += "FIB-RCL | ";
if(MFIB_Reclaim_Warning) warn_text += "MFIB-RCL | ";
if(MA_Reclaim_Warning) warn_text += "MA-RCL | ";
if(MA_Reject_Warning) warn_text += "MA-REJ | ";
if(Band_Snap_Warning) warn_text += "BAND-SNAP | ";
if(Warning_Confluence_3Plus) warn_text += "3+CONF | ";
warn_text += "W=" + IntegerToString(Warning_Confluence_Count);
ObjectSetString(0, "WarningLabel", OBJPROP_TEXT, warn_text);
ObjectSetInteger(0, "WarningLabel", OBJPROP_COLOR, clrRed);
ObjectSetInteger(0, "WarningLabel", OBJPROP_FONTSIZE, 10);
}
else
{
ObjectDelete(0, "WarningLabel");
}
//================================================================
// PRAISE LABEL
//================================================================
bool anyPraise = (Praise_Triple_Magnet || Praise_Power_Couple || Praise_MFIB_Staircase ||
Praise_MFIB_Express || Praise_MFIB_Breakout || Praise_MA_Stack ||
Praise_Clean_Reclaim || Praise_Multi_Breakout);
if(anyPraise && Use_Praise_System)
{
ObjectDelete(0, "PraiseLabel");
ObjectCreate(0, "PraiseLabel", OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, "PraiseLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER);
ObjectSetInteger(0, "PraiseLabel", OBJPROP_XDISTANCE, 10);
ObjectSetInteger(0, "PraiseLabel", OBJPROP_YDISTANCE, Use_MFIB_382_Bias ? 100 : 80);
string praise_text = "PRAISE: ";
if(Praise_Triple_Magnet) praise_text += "7x14x21-MAG | ";
if(Praise_Power_Couple) praise_text += "14x21-PWR | ";
if(Praise_MFIB_Staircase) praise_text += "MFIB-STAIR | ";
if(Praise_MFIB_Express) praise_text += "MFIB-EXP | ";
if(Praise_MFIB_Breakout) praise_text += "MFIB-BRK | ";
if(Praise_MA_Stack) praise_text += "MA-STACK | ";
if(Praise_Clean_Reclaim) praise_text += "3xRCL | ";
if(Praise_Multi_Breakout) praise_text += "MULTI-BRK | ";
praise_text += "P=" + IntegerToString(Praise_Count);
// Add star indicators for strength
if(Praise_Count >= 4) praise_text += " ⭐⭐⭐⭐";
else if(Praise_Count == 3) praise_text += " ⭐⭐⭐";
color praise_color = clrGold;
if(Praise_Count >= 4) praise_color = clrYellow;
ObjectSetString(0, "PraiseLabel", OBJPROP_TEXT, praise_text);
ObjectSetInteger(0, "PraiseLabel", OBJPROP_COLOR, praise_color);
ObjectSetInteger(0, "PraiseLabel", OBJPROP_FONTSIZE, 10);
}
else
{
ObjectDelete(0, "PraiseLabel");
}
//================================================================
// SIGNAL MODE LABEL (P vs W Summary)
//================================================================
ObjectDelete(0, "SignalLabel");
ObjectCreate(0, "SignalLabel", OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, "SignalLabel", OBJPROP_CORNER, CORNER_LEFT_UPPER);
ObjectSetInteger(0, "SignalLabel", OBJPROP_XDISTANCE, 10);
int signal_y = Use_MFIB_382_Bias ? 120 : 100;
if(!anyPraise) signal_y -= 20;
ObjectSetInteger(0, "SignalLabel", OBJPROP_YDISTANCE, signal_y);
string signal_text = "SIGNAL: ";
color signal_color = clrWhite;
if(Praise_Count >= 4 && Warning_Confluence_Count <= 1)
{
signal_text += "SUPREME TREND (P>>W) - MAX AGGRESSION";
signal_color = clrLime;
}
else if(Praise_Count >= 3 && Warning_Confluence_Count <= 2)
{
signal_text += "STRONG TREND (P>W) - AGGRESSIVE";
signal_color = clrGreenYellow;
}
else if(Praise_Count >= 2 && Praise_Count > Warning_Confluence_Count)
{
signal_text += "TREND MODE (P>W) - CONTINUATION BIAS";
signal_color = clrYellow;
}
else if(Warning_Confluence_Count >= 3 && Praise_Count <= 1)
{
signal_text += "REVERSAL RISK (W>>P) - COUNTER BIAS";
signal_color = clrOrangeRed;
}
else if(Warning_Confluence_Count > Praise_Count)
{
signal_text += "CAUTION (W>P) - DEFENSIVE MODE";
signal_color = clrOrange;
}
else
{
signal_text += "NEUTRAL (P≈W) - STANDARD MODE";
signal_color = clrGray;
}
ObjectSetString(0, "SignalLabel", OBJPROP_TEXT, signal_text);
ObjectSetInteger(0, "SignalLabel", OBJPROP_COLOR, signal_color);
ObjectSetInteger(0, "SignalLabel", OBJPROP_FONTSIZE, 10);
//================================================================
// AI LABELS
//================================================================
UpdateAILabel(); // Display AI status and analysis
}
//+------------------------------------------------------------------+
//| Clean up all labels |
//+------------------------------------------------------------------+
void CleanupLabels()
{
ObjectsDeleteAll(0, "ModeLabel");
ObjectsDeleteAll(0, "StateLabel");
ObjectsDeleteAll(0, "WarningLabel");
ObjectsDeleteAll(0, "MFIBLabel");
ObjectsDeleteAll(0, "PraiseLabel");
ObjectsDeleteAll(0, "SignalLabel");
CleanupAILabels(); // Clean up AI labels
}