@@ -12,7 +12,8 @@ inline void DrawOneSwingPoint(
string keyLevelObjName = prefix + "KL_" + tag;
datetime barTime = iTime(_Symbol, tf, barIdx);
if (ObjectFind(0, arrowObjName) < 0) ObjectCreate(0, arrowObjName, OBJ_ARROW, 0, barTime, price);
if (ObjectFind(0, arrowObjName) < 0)
ObjectCreate(0, arrowObjName, OBJ_ARROW, 0, barTime, price);
ObjectSetInteger(0, arrowObjName, OBJPROP_ARROWCODE, isHigh ? 234 : 233);
ObjectSetInteger(0, arrowObjName, OBJPROP_COLOR, clr);
ObjectSetInteger(0, arrowObjName, OBJPROP_WIDTH, arrowSz);
@@ -21,7 +22,8 @@ inline void DrawOneSwingPoint(
double barRange = iHigh(_Symbol, tf, barIdx) - iLow(_Symbol, tf, barIdx);
double textY = isHigh ? price + barRange * 0.3 : price - barRange * 0.3;
if (ObjectFind(0, textObjName) < 0) ObjectCreate(0, textObjName, OBJ_TEXT, 0, barTime, textY);
if (ObjectFind(0, textObjName) < 0)
ObjectCreate(0, textObjName, OBJ_TEXT, 0, barTime, textY);
ObjectMove(0, textObjName, 0, barTime, textY);
ObjectSetString (0, textObjName, OBJPROP_TEXT, tag);
ObjectSetInteger(0, textObjName, OBJPROP_COLOR, clr);
@@ -31,7 +33,8 @@ inline void DrawOneSwingPoint(
if (isKL)
{
datetime endTime = iTime(_Symbol, tf, 0);
if (ObjectFind(0, keyLevelObjName) < 0) ObjectCreate(0, keyLevelObjName, OBJ_TREND, 0, barTime, price, endTime, price);
if (ObjectFind(0, keyLevelObjName) < 0)
ObjectCreate(0, keyLevelObjName, OBJ_TREND, 0, barTime, price, endTime, price);
ObjectSetInteger(0, keyLevelObjName, OBJPROP_COLOR, clr);
ObjectSetInteger(0, keyLevelObjName, OBJPROP_STYLE, STYLE_DASH);
ObjectSetInteger(0, keyLevelObjName, OBJPROP_WIDTH, 1);
@@ -52,10 +55,26 @@ inline void DrawMiddleSwingPoints()
bool isUp = (g_MiddleTrend.trend == DIR_UP);
bool isDown = (g_MiddleTrend.trend == DIR_DOWN);
DrawOneSwingPoint(PREFIX_SWING_MIDDLE, InpMiddleTF, "MiddleH0", true, g_MiddleTrend.idxH0, g_MiddleTrend.h0, clrAqua, isDown, 2, 8);
DrawOneSwingPoint( PREFIX_SWING_MIDDLE, InpMiddleTF, "MiddleH1", true, g_MiddleTrend.idxH1, g_MiddleTrend.h1, C'0,140,160', false, 2, 8);
DrawOneSwingPoint(PREFIX_SWING_MIDDLE, InpMiddleTF, "MiddleL0", fals e, g_MiddleTrend.idxL 0, g_MiddleTrend.l 0, clrYellow, isUp, 2, 8);
DrawOneSwingPoint(PREFIX_SWING_MIDDLE, InpMiddleTF, "MiddleL1", false, g_MiddleTrend.idxL1, g_MiddleTrend.l1, C'160,140,0', false, 2, 8);
DrawOneSwingPoint(
PREFIX_SWING_MIDDLE, InpMiddleTF, "MiddleH0",
tru e, g_MiddleTrend.idxH 0, g_MiddleTrend.h 0,
clrAqua, isDown, 2, 8
);
DrawOneSwingPoint(
PREFIX_SWING_MIDDLE, InpMiddleTF, "MiddleH1",
true, g_MiddleTrend.idxH1, g_MiddleTrend.h1,
C'0,140,160', false, 2, 8
);
DrawOneSwingPoint(
PREFIX_SWING_MIDDLE, InpMiddleTF, "MiddleL0",
false, g_MiddleTrend.idxL0, g_MiddleTrend.l0,
clrYellow, isUp, 2, 8
);
DrawOneSwingPoint(
PREFIX_SWING_MIDDLE, InpMiddleTF, "MiddleL1",
false, g_MiddleTrend.idxL1, g_MiddleTrend.l1,
C'160,140,0', false, 2, 8
);
}
/** Draws M5 swing points when debug draw enabled. */
@@ -68,10 +87,26 @@ inline void DrawTriggerSwingPoints()
bool isUp = (g_TriggerTrend.trend == DIR_UP);
bool isDown = (g_TriggerTrend.trend == DIR_DOWN);
DrawOneSwingPoint(PREFIX_SWING_TRIGGER, InpTriggerTF, "TriggerH0", true, g_TriggerTrend.idxH0, g_TriggerTrend.h0, C'180,100,255', isDown, 1, 7);
DrawOneSwingPoint( PREFIX_SWING_TRIGGER, InpTriggerTF, "TriggerH1 ", true, g_TriggerTrend.idxH1, g_TriggerTrend.h1, C'100,60,160', false, 1, 7);
DrawOneSwingPoint(PREFIX_SWING_TRIGGER, InpTriggerTF, "TriggerL0", fals e, g_TriggerTrend.idxL 0, g_TriggerTrend.l0, C'255,160,40', isUp, 1, 7);
DrawOneSwingPoint(PREFIX_SWING_TRIGGER, InpTriggerTF, "TriggerL1", false, g_TriggerTrend.idxL1, g_TriggerTrend.l1, C'16 0,100,20 ', false, 1, 7);
DrawOneSwingPoint(
PREFIX_SWING_TRIGGER, InpTriggerTF, "TriggerH0 ",
tru e, g_TriggerTrend.idxH 0, g_TriggerTrend.h0,
C'18 0,100,255 ', isDown, 1, 7
);
DrawOneSwingPoint(
PREFIX_SWING_TRIGGER, InpTriggerTF, "TriggerH1",
true, g_TriggerTrend.idxH1, g_TriggerTrend.h1,
C'100,60,160', false, 1, 7
);
DrawOneSwingPoint(
PREFIX_SWING_TRIGGER, InpTriggerTF, "TriggerL0",
false, g_TriggerTrend.idxL0, g_TriggerTrend.l0,
C'255,160,40', isUp, 1, 7
);
DrawOneSwingPoint(
PREFIX_SWING_TRIGGER, InpTriggerTF, "TriggerL1",
false, g_TriggerTrend.idxL1, g_TriggerTrend.l1,
C'160,100,20', false, 1, 7
);
}
/** Draws one MSS marker (arrow + label + horizontal level) at given time/level. */
@@ -131,10 +166,13 @@ inline void DrawMSSMarkers()
if (g_FVGPool[i].mssTime == 0) continue;
string tid = "T_" + IntegerToString(g_FVGPool[i].id);
DrawMSSMarker(tid, InpTriggerTF,
DrawMSSMarker(
tid,
InpTriggerTF,
g_FVGPool[i].mssTime,
g_FVGPool[i].mssEntry,
g_FVGPool[i].direction == DIR_UP ? DIR_UP : DIR_DOWN);
g_FVGPool[i].direction == DIR_UP ? DIR_UP : DIR_DOWN
);
}
}
@@ -155,9 +193,14 @@ inline void DrawOrderVisualization()
if (!g_OrderPlan.valid || g_State == EA_IDLE)
{
ObjectDelete(0, tpZoneN); ObjectDelete(0, slZoneN);
ObjectDelete(0, entLineN); ObjectDelete(0, slLineN); ObjectDelete(0, tpLi neN);
ObjectDelete(0, entLblN); ObjectDelete(0, slLblN); ObjectDelete(0, tpLbl N);
ObjectDelete(0, tpZoneN);
ObjectDelete(0, slZo neN);
ObjectDelete(0, entLine N);
ObjectDelete(0, slLineN);
ObjectDelete(0, tpLineN);
ObjectDelete(0, entLblN);
ObjectDelete(0, slLblN);
ObjectDelete(0, tpLblN);
ObjectDelete(0, infoLblN);
return;
}
@@ -180,58 +223,127 @@ inline void DrawOrderVisualization()
color tpClr = C'38,166,91';
color slClr = C'229,57,53';
double tpTop = isBuy ? tp : entry, tpBot = isBuy ? entry : tp ;
if (ObjectFind(0, tpZoneN) < 0) ObjectCreate(0, tpZoneN, OBJ_RECTANGLE, 0, tStart, tpTop, tEnd, tpBot) ;
ObjectSetInteger(0, tpZoneN, OBJPROP_COLOR, tpFill); ObjectSetInteger(0, tpZoneN, OBJPROP_FILL, true);
ObjectSetInteger (0, tpZoneN, OBJPROP_BACK, true );
ObjectMove(0, tpZoneN, 0, tStart, tpTop); ObjectMove(0, tpZoneN, 1, tEnd, tpBot );
double tpTop = isBuy ? tp : entry;
double tpBot = isBuy ? entry : tp ;
if ( ObjectFind(0, tpZoneN) < 0)
ObjectCreate (0, tpZoneN, OBJ_RECTANGLE, 0, tStart, tpTop, tEnd, tpBot );
ObjectSetInteger(0, tpZoneN, OBJPROP_COLOR, tpFill );
ObjectSetInteger(0, tpZoneN, OBJPROP_FILL, true);
ObjectSetInteger(0, tpZoneN, OBJPROP_BACK, true);
ObjectMove(0, tpZoneN, 0, tStart, tpTop);
ObjectMove(0, tpZoneN, 1, tEnd, tpBot);
double slTop = isBuy ? entry : sl, slBot = isBuy ? sl : entry ;
if (ObjectFind(0, slZoneN) < 0) ObjectCreate(0, slZoneN, OBJ_RECTANGLE, 0, tStart, slTop, tEnd, slBot) ;
ObjectSetInteger(0, slZoneN, OBJPROP_COLOR, slFill); ObjectSetInteger(0, slZoneN, OBJPROP_FILL, true);
ObjectSetInteger (0, slZoneN, OBJPROP_BACK, true );
ObjectMove(0, slZoneN, 0, tStart, slTop); ObjectMove(0, slZoneN, 1, tEnd, slBot );
double slTop = isBuy ? entry : sl;
double slBot = isBuy ? sl : entry ;
if ( ObjectFind(0, slZoneN) < 0)
ObjectCreate (0, slZoneN, OBJ_RECTANGLE, 0, tStart, slTop, tEnd, slBot );
ObjectSetInteger(0, slZoneN, OBJPROP_COLOR, slFill );
ObjectSetInteger(0, slZoneN, OBJPROP_FILL, true);
ObjectSetInteger(0, slZoneN, OBJPROP_BACK, true);
ObjectMove(0, slZoneN, 0, tStart, slTop);
ObjectMove(0, slZoneN, 1, tEnd, slBot);
if (ObjectFind(0, entLineN) < 0) ObjectCreate(0, entLineN, OBJ_TREND, 0, tStart, entry, tEnd, entry);
ObjectSetInteger (0, entLineN, OBJPROP_COLOR, entryClr); ObjectSetInteger(0, entLineN, OBJPROP_STYLE, STYLE_SOLID );
ObjectSetInteger(0, entLineN, OBJPROP_WIDTH, 2); ObjectSetInteger(0, entLineN, OBJPROP_RAY_RIGHT, true );
ObjectMove (0, entLineN, 0, tStart, entry); ObjectMove(0, entLineN, 1, tEnd, entry );
if (ObjectFind(0, entLineN) < 0)
ObjectCreate (0, entLineN, OBJ_TREND, 0, tStart, entry, tEnd, entry );
ObjectSetInteger(0, entLineN, OBJPROP_COLOR, entryClr );
ObjectSetInteger (0, entLineN, OBJPROP_STYLE, STYLE_SOLID );
ObjectSetInteger(0, entLineN, OBJPROP_WIDTH, 2);
ObjectSetInteger(0, entLineN, OBJPROP_RAY_RIGHT, true);
ObjectMove(0, entLineN, 0, tStart, entry);
ObjectMove(0, entLineN, 1, tEnd, entry);
if (ObjectFind(0, tpLineN) < 0) ObjectCreate(0, tpLineN, OBJ_TREND, 0, tStart, tp, tEnd, tp);
ObjectSetInteger (0, tpLineN, OBJPROP_COLOR, tpClr); ObjectSetInteger(0, tpLineN, OBJPROP_STYLE, STYLE_DASH );
ObjectSetInteger(0, tpLineN, OBJPROP_WIDTH, 1); ObjectSetInteger(0, tpLineN, OBJPROP_RAY_RIGHT, true );
ObjectMove (0, tpLineN, 0, tStart, tp); ObjectMove(0, tpLineN, 1, tEnd, tp );
if (ObjectFind(0, tpLineN) < 0)
ObjectCreate (0, tpLineN, OBJ_TREND, 0, tStart, tp, tEnd, tp );
ObjectSetInteger(0, tpLineN, OBJPROP_COLOR, tpClr );
ObjectSetInteger (0, tpLineN, OBJPROP_STYLE, STYLE_DASH );
ObjectSetInteger(0, tpLineN, OBJPROP_WIDTH, 1);
ObjectSetInteger(0, tpLineN, OBJPROP_RAY_RIGHT, true);
ObjectMove(0, tpLineN, 0, tStart, tp);
ObjectMove(0, tpLineN, 1, tEnd, tp);
if (ObjectFind(0, slLineN) < 0) ObjectCreate(0, slLineN, OBJ_TREND, 0, tStart, sl, tEnd, sl);
ObjectSetInteger (0, slLineN, OBJPROP_COLOR, slClr); ObjectSetInteger(0, slLineN, OBJPROP_STYLE, STYLE_DASH );
ObjectSetInteger(0, slLineN, OBJPROP_WIDTH, 1); ObjectSetInteger(0, slLineN, OBJPROP_RAY_RIGHT, true );
ObjectMove (0, slLineN, 0, tStart, sl); ObjectMove(0, slLineN, 1, tEnd, sl );
if (ObjectFind(0, slLineN) < 0)
ObjectCreate (0, slLineN, OBJ_TREND, 0, tStart, sl, tEnd, sl );
ObjectSetInteger(0, slLineN, OBJPROP_COLOR, slClr );
ObjectSetInteger (0, slLineN, OBJPROP_STYLE, STYLE_DASH );
ObjectSetInteger(0, slLineN, OBJPROP_WIDTH, 1);
ObjectSetInteger(0, slLineN, OBJPROP_RAY_RIGHT, true);
ObjectMove(0, slLineN, 0, tStart, sl);
ObjectMove(0, slLineN, 1, tEnd, sl);
datetime lblT = tEnd;
string eTxt = StringFormat("%s %s | %.2f lot", isBuy?"▶ BUY LIM":"▶ SELL LIM", DoubleToString(entry,_Digits), g_OrderPlan.lot);
if (ObjectFind(0, entLblN) < 0) ObjectCreate(0, entLblN, OBJ_TEXT, 0, lblT, entry);
ObjectMove(0, entLblN, 0, lblT, entry); ObjectSetString(0, entLblN, OBJPROP_TEXT, eTxt);
ObjectSetInteger(0, entLblN, OBJPROP_COLOR, entryClr); ObjectSetInteger(0, entLblN, OBJPROP_FONTSIZE, 8);
string eTxt = StringFormat(
"%s %s | %.2f lot",
isBuy ? "▶ BUY LIM" : "▶ SELL LIM",
DoubleToString(entry, _Digits),
g_OrderPlan.lot
);
if (ObjectFind(0, entLblN) < 0)
ObjectCreate(0, entLblN, OBJ_TEXT, 0, lblT, entry);
ObjectMove(0, entLblN, 0, lblT, entry);
ObjectSetString(0, entLblN, OBJPROP_TEXT, eTxt);
ObjectSetInteger(0, entLblN, OBJPROP_COLOR, entryClr);
ObjectSetInteger(0, entLblN, OBJPROP_FONTSIZE, 8);
ObjectSetInteger(0, entLblN, OBJPROP_ANCHOR, ANCHOR_LEFT);
string tTxt = StringFormat("◎ TP %s +%.0fp (%.1fR)", DoubleToString(tp,_Digits), tpPips, rr);
if (ObjectFind(0, tpLblN) < 0) ObjectCreate(0, tpLblN, OBJ_TEXT, 0, lblT, tp);
ObjectMove(0, tpLblN, 0, lblT, tp); ObjectSetString(0, tpLblN, OBJPROP_TEXT, tTxt);
ObjectSetInteger(0, tpLblN, OBJPROP_COLOR, tpClr); ObjectSetInteger(0, tpLblN, OBJPROP_FONTSIZE, 8);
ObjectSetInteger(0, tpLblN, OBJPROP_ANCHOR, isBuy?ANCHOR_LEFT_LOWER:ANCHOR_LEFT_UPPER);
string tTxt = StringFormat(
"◎ TP %s +%.0fp (%.1fR)",
DoubleToString(tp, _Digits),
tpPips,
rr
);
if (ObjectFind(0, tpLblN) < 0)
ObjectCreate(0, tpLblN, OBJ_TEXT, 0, lblT, tp);
ObjectMove(0, tpLblN, 0, lblT, tp);
ObjectSetString(0, tpLblN, OBJPROP_TEXT, tTxt);
ObjectSetInteger(0, tpLblN, OBJPROP_COLOR, tpClr);
ObjectSetInteger(0, tpLblN, OBJPROP_FONTSIZE, 8);
ObjectSetInteger(
0,
tpLblN,
OBJPROP_ANCHOR,
isBuy ? ANCHOR_LEFT_LOWER : ANCHOR_LEFT_UPPER
);
string sTxt = StringFormat("✕ SL %s -%.0fp", DoubleToString(sl,_Digits), slPips);
if (ObjectFind(0, slLblN) < 0) ObjectCreate(0, slLblN, OBJ_TEXT, 0, lblT, sl);
ObjectMove(0, slLblN, 0, lblT, sl); ObjectSetString(0, slLblN, OBJPROP_TEXT, sTxt);
ObjectSetInteger(0, slLblN, OBJPROP_COLOR, slClr); ObjectSetInteger(0, slLblN, OBJPROP_FONTSIZE, 8);
ObjectSetInteger(0, slLblN, OBJPROP_ANCHOR, isBuy?ANCHOR_LEFT_UPPER:ANCHOR_LEFT_LOWER );
string sTxt = StringFormat(
"✕ SL %s -%.0fp",
DoubleToString(sl, _Digits),
slPips
);
if (ObjectFind(0, slLblN) < 0)
ObjectCreate(0, slLblN, OBJ_TEXT, 0, lblT, sl);
ObjectMove(0, slLblN, 0, lblT, sl);
ObjectSetString(0, slLblN, OBJPROP_TEXT, sTxt);
ObjectSetInteger(0, slLblN, OBJPROP_COLOR, slClr);
ObjectSetInteger(0, slLblN, OBJPROP_FONTSIZE, 8);
ObjectSetInteger(
0,
slLblN,
OBJPROP_ANCHOR,
isBuy ? ANCHOR_LEFT_UPPER : ANCHOR_LEFT_LOWER
);
string iTxt = StringFormat("Risk %.1f%% | %.0f:%.0f pips | %.1fR", InpRiskPercent, slPips, tpPips, rr);
if (ObjectFind(0, infoLblN) < 0) ObjectCreate(0, infoLblN, OBJ_TEXT, 0, lblT, (entry+sl)/2.0);
ObjectMove(0, infoLblN, 0, lblT, (entry+sl)/2.0); ObjectSetString(0, infoLblN, OBJPROP_TEXT, iTxt);
ObjectSetInteger(0, infoLblN, OBJPROP_COLOR, C'160,160,160'); ObjectSetInteger(0, infoLblN, OBJPROP_FONTSIZE, 7);
ObjectSetInteger(0, infoLblN, OBJPROP_ANCHOR, ANCHOR_LEFT);
string iTxt = StringFormat(
"Risk %.1f%% | %.0f:%.0f pips | %.1fR",
InpRiskPercent,
slPips,
tpPips,
rr
);
if (ObjectFind(0, infoLblN) < 0)
ObjectCreate(
0,
infoLblN,
OBJ_TEXT,
0,
lblT,
(entry + sl) / 2.0
);
ObjectMove(0, infoLblN, 0, lblT, (entry + sl) / 2.0);
ObjectSetString(0, infoLblN, OBJPROP_TEXT, iTxt);
ObjectSetInteger(0, infoLblN, OBJPROP_COLOR, C'160,160,160');
ObjectSetInteger(0, infoLblN, OBJPROP_FONTSIZE, 7);
ObjectSetInteger(0, infoLblN, OBJPROP_ANCHOR, ANCHOR_LEFT);
}
/** Draws one FVG record (rectangle + mid line + label) by pool index. */
@@ -267,18 +379,51 @@ inline void DrawOneFVGRecord(int idx)
else fillColor = C'50,50,50';
if (ObjectFind(0, rectN) < 0)
ObjectCreate(0, rectN, OBJ_RECTANGLE, 0, g_FVGPool[idx].createdTime, g_FVGPool[idx].high, rectEnd, g_FVGPool[idx].low);
ObjectSetInteger(0, rectN, OBJPROP_COLOR, fillColor); ObjectSetInteger(0, rectN, OBJPROP_FILL, true);
ObjectSetInteger(0, rectN, OBJPROP_BACK, true);
ObjectMove(0, rectN, 0, g_FVGPool[idx].createdTime, g_FVGPool[idx].high);
ObjectCreate(
0,
rectN,
OBJ_RECTANGLE,
0,
g_FVGPool[idx].createdTime,
g_FVGPool[idx].high,
rectEnd,
g_FVGPool[idx].low
);
ObjectSetInteger(0, rectN, OBJPROP_COLOR, fillColor);
ObjectSetInteger(0, rectN, OBJPROP_FILL, true);
ObjectSetInteger(0, rectN, OBJPROP_BACK, true);
ObjectMove(
0,
rectN,
0,
g_FVGPool[idx].createdTime,
g_FVGPool[idx].high
);
ObjectMove(0, rectN, 1, rectEnd, g_FVGPool[idx].low);
color midColor = (g_FVGPool[idx].status == FVG_USED) ? C'60,60,60' : clrSilver;
if (ObjectFind(0, midN) < 0)
ObjectCreate(0, midN, OBJ_TREND, 0, g_FVGPool[idx].createdTime, g_FVGPool[idx].mid, rectEnd, g_FVGPool[idx].mid);
ObjectSetInteger(0, midN, OBJPROP_COLOR, midColor); ObjectSetInteger(0, midN, OBJPROP_STYLE, STYLE_DOT);
ObjectSetInteger(0, midN, OBJPROP_WIDTH, 1); ObjectSetInteger(0, midN, OBJPROP_RAY_RIGHT, false);
ObjectMove(0, midN, 0, g_FVGPool[idx].createdTime, g_FVGPool[idx].mid);
ObjectCreate(
0,
midN,
OBJ_TREND,
0,
g_FVGPool[idx].createdTime,
g_FVGPool[idx].mid,
rectEnd,
g_FVGPool[idx].mid
);
ObjectSetInteger(0, midN, OBJPROP_COLOR, midColor);
ObjectSetInteger(0, midN, OBJPROP_STYLE, STYLE_DOT);
ObjectSetInteger(0, midN, OBJPROP_WIDTH, 1);
ObjectSetInteger(0, midN, OBJPROP_RAY_RIGHT, false);
ObjectMove(
0,
midN,
0,
g_FVGPool[idx].createdTime,
g_FVGPool[idx].mid
);
ObjectMove(0, midN, 1, rectEnd, g_FVGPool[idx].mid);
string sym = (g_FVGPool[idx].direction == DIR_UP) ? "▲" : "▼";
@@ -289,10 +434,34 @@ inline void DrawOneFVGRecord(int idx)
else if (g_FVGPool[idx].status == FVG_USED) stTxt = " [EXP]";
if (ObjectFind(0, lblN) < 0)
ObjectCreate(0, lblN, OBJ_TEXT, 0, g_FVGPool[idx].createdTime, g_FVGPool[idx].high);
ObjectMove(0, lblN, 0, g_FVGPool[idx].createdTime, g_FVGPool[idx].high);
ObjectSetString(0, lblN, OBJPROP_TEXT, StringFormat("FVG#%d %s%s", g_FVGPool[idx].id, sym, stTxt));
ObjectSetInteger(0, lblN, OBJPROP_COLOR, fillColor); ObjectSetInteger(0, lblN, OBJPROP_FONTSIZE, 8);
ObjectCreate(
0,
lblN,
OBJ_TEXT,
0,
g_FVGPool[idx].createdTime,
g_FVGPool[idx].high
);
ObjectMove(
0,
lblN,
0,
g_FVGPool[idx].createdTime,
g_FVGPool[idx].high
);
ObjectSetString(
0,
lblN,
OBJPROP_TEXT,
StringFormat(
"FVG#%d %s%s",
g_FVGPool[idx].id,
sym,
stTxt
)
);
ObjectSetInteger(0, lblN, OBJPROP_COLOR, fillColor);
ObjectSetInteger(0, lblN, OBJPROP_FONTSIZE, 8);
ObjectSetInteger(0, lblN, OBJPROP_ANCHOR, ANCHOR_LEFT_LOWER);
}
@@ -308,71 +477,177 @@ inline void DrawContextDebug()
{
if (!InpDebugDraw) return;
#define LBL(name,txt,y,clr) \
if(ObjectFind(0,name)<0) ObjectCreate(0,name,OBJ_LABEL,0,0,0); \
ObjectSetInteger (0,name,OBJPROP_CORNER, CORNER_LEFT_UPPER); \
ObjectSetInteger(0,name,OBJPROP_XDISTANCE, 10); \
ObjectSetInteger(0,name,OBJPROP_Y DISTANCE, y); \
ObjectSetInteger(0,name,OBJPROP_FONTSIZE, 9); \
ObjectSetInteger(0,name,OBJPROP_COLOR, clr); \
ObjectSetString (0,name,OBJPROP_TEXT , txt);
#define LBL(name,txt,y,clr) \
if (ObjectFind(0, name) < 0) \
ObjectCreate (0, name, OBJ_LABEL, 0, 0, 0); \
ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_LEFT_UPPER); \
ObjectSetInteger(0, name, OBJPROP_X DISTANCE, 10); \
ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y); \
ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 9); \
ObjectSetInteger (0, name, OBJPROP_COLOR , clr); \
ObjectSetString (0, name, OBJPROP_TEXT, txt);
LBL(PREFIX_DEBUG_PANEL + "HDR", "── ICT EA v4.3 ──", 10, clrSilver)
color cB = (g_Bias.bias==BIAS_UP)?clrLime:(g_Bias.bias==BIAS_DOWN)?clrTomato:(g_Bias.bias==BIAS_SIDEWAY)?clrOrange:clrGray;
LBL(PREFIX_DEBUG_PANEL + "BIAS", StringFormat("Bias : %s", EnumToString(g_Bias.bias)), 34, cB)
color cB = (g_Bias.bias == BIAS_UP)
? clrLime
: (g_Bias.bias == BIAS_DOWN)
? clrTomato
: (g_Bias.bias == BIAS_SIDEWAY) ? clrOrange : clrGray;
LBL(
PREFIX_DEBUG_PANEL + "BIAS",
StringFormat("Bias : %s", EnumToString(g_Bias.bias)),
34,
cB
)
color cMT = (g_MiddleTrend.trend==DIR_UP)?clrLime:(g_MiddleTrend.trend==DIR_DOWN)?clrTomato:clrGray;
LBL(PREFIX_DEBUG_PANEL + "MT", StringFormat("H1 : %s KL=%.5f", EnumToString(g_MiddleTrend.trend), g_MiddleTrend.keyLevel), 58, cMT)
color cMT = (g_MiddleTrend.trend == DIR_UP)
? clrLime
: (g_MiddleTrend.trend == DIR_DOWN) ? clrTomato : clrGray;
LBL(
PREFIX_DEBUG_PANEL + "MT",
StringFormat(
"H1 : %s KL=%.5f",
EnumToString(g_MiddleTrend.trend),
g_MiddleTrend.keyLevel
),
58,
cMT
)
color cTT = (g_TriggerTrend.trend==DIR_UP)?clrLime:(g_TriggerTrend.trend==DIR_DOWN)?clrTomato:clrGray;
LBL(PREFIX_DEBUG_PANEL + "TT", StringFormat("M5 : %s KL=%.5f", EnumToString(g_TriggerTrend.trend), g_TriggerTrend.keyLevel), 82, cTT)
color cTT = (g_TriggerTrend.trend == DIR_UP)
? clrLime
: (g_TriggerTrend.trend == DIR_DOWN) ? clrTomato : clrGray;
LBL(
PREFIX_DEBUG_PANEL + "TT",
StringFormat(
"M5 : %s KL=%.5f",
EnumToString(g_TriggerTrend.trend),
g_TriggerTrend.keyLevel
),
82,
cTT
)
if (g_ActiveFVGIdx >= 0 && g_ActiveFVGIdx < g_FVGCount
&& g_FVGPool[g_ActiveFVGIdx].usedCase == 2
&& g_FVGPool[g_ActiveFVGIdx].mssTime > 0)
{
int ai = g_ActiveFVGIdx;
color cM = (g_FVGPool[ai].direction==DIR_UP)? clrLime: clrTomato;
LBL(PREFIX_DEBUG_PANEL + "MSS", StringFormat("MSS : %s entry=%.5f SL=%.5f @ %s (FVG#%d)",
(g_FVGPool[ai].direction==DIR_UP)?"▲":"▼ ",
g_FVGPool[ai].mssEntry, g_FVGPool[ai].mssSL,
TimeToString(g_FVGPool[ai].mssTime, TIME_MINUTES) ,
g_FVGPool[ai].id), 106, cM)
color cM = (g_FVGPool[ai].direction == DIR_UP) ? clrLime : clrTomato;
LBL(
PREFIX_DEBUG_PANEL + "MSS ",
StringFormat(
"MSS : %s entry=%.5f SL=%.5f @ %s (FVG#%d)" ,
( g_FVGPool[ai].direction == DIR_UP) ? "▲" : "▼",
g_FVGPool[ai].mssEntry,
g_FVGPool[ai].mssSL,
TimeToString(g_FVGPool[ai].mssTime, TIME_MINUTES),
g_FVGPool[ai].id
),
106,
cM
)
}
else ObjectDelete(0, PREFIX_DEBUG_PANEL + "MSS");
double lostPct = g_DailyRisk.startBalance > 0
? (g_DailyRisk.startBalance - g_DailyRisk.currentBalance) / g_DailyRisk.startBalance * 100.0 : 0.0;
color cR = g_DailyRisk.limitHit?clrRed:(lostPct>InpMaxDailyLossPct*0.7?clrOrange:clrLime);
LBL(PREFIX_DEBUG_PANEL + "RISK", StringFormat("Risk : %.2f%% / %.2f%%", lostPct, InpMaxDailyLossPct), 130, cR)
double lostPct = ( g_DailyRisk.startBalance > 0)
? (g_DailyRisk.startBalance - g_DailyRisk.currentBalance)
/ g_DailyRisk.startBalance * 100.0
: 0.0;
color cR = g_DailyRisk.limitHit
? clrRed
: (lostPct > InpMaxDailyLossPct * 0.7) ? clrOrange : clrLime;
LBL(
PREFIX_DEBUG_PANEL + "RISK",
StringFormat("Risk : %.2f%% / %.2f%%", lostPct, InpMaxDailyLossPct),
130,
cR
)
color cS = (g_State==EA_IDLE)?clrSilver:(g_State==EA_WAIT_TOUCH)?clrOrange:(g_State==EA_WAIT_TRIGGER)?clrYellow:clrLime;
LBL(PREFIX_DEBUG_PANEL + "ST", StringFormat("State: %s", EnumToString(g_State)), 154, cS)
color cS = (g_State == EA_IDLE)
? clrSilver
: (g_State == EA_WAIT_TOUCH)
? clrOrange
: (g_State == EA_WAIT_TRIGGER) ? clrYellow : clrLime;
LBL(
PREFIX_DEBUG_PANEL + "ST",
StringFormat("State: %s", EnumToString(g_State)),
154,
cS
)
if (g_BlockReason != BLOCK_NONE)
{ LBL(PREFIX_DEBUG_PANEL + "BLK", StringFormat("Block: %s", EnumToString(g_BlockReason)), 178, clrTomato) }
{
LBL(
PREFIX_DEBUG_PANEL + "BLK",
StringFormat("Block: %s", EnumToString(g_BlockReason)),
178,
clrTomato
)
}
else ObjectDelete(0, PREFIX_DEBUG_PANEL + "BLK");
int countPending = 0, countTouched = 0, countUsed = 0;
int countPending = 0;
int countTouched = 0;
int countUsed = 0;
for (int i = 0; i < g_FVGCount; i++)
{ if (g_FVGPool[i].status == FVG_PENDING) countPending++; else if (g_FVGPool[i].status == FVG_TOUCHED) countTouched++; else countUsed++; }
LBL(PREFIX_DEBUG_PANEL + "POOL", StringFormat("Pool : P=%d T=%d U=%d (%d/%d)", countPending, countTouched, countUsed, g_FVGCount, MAX_FVG_POOL), 202, clrDodgerBlue )
{
if (g_FVGPool[i].status == FVG_PENDING )
countPending++;
else if (g_FVGPool[i].status == FVG_TOUCHED)
countTouched++;
else
countUsed++;
}
LBL(
PREFIX_DEBUG_PANEL + "POOL",
StringFormat(
"Pool : P=%d T=%d U=%d (%d/%d)",
countPending,
countTouched,
countUsed,
g_FVGCount,
MAX_FVG_POOL
),
202,
clrDodgerBlue
)
if (g_ActiveFVGIdx >= 0 && g_ActiveFVGIdx < g_FVGCount)
{
int ai = g_ActiveFVGIdx;
LBL(PREFIX_DEBUG_PANEL + "ACT", StringFormat("Act : #%d %s [%.5f– %.5f] %s",
g_FVGPool[ai].id, EnumToString(g_FVGPool[ai].direction) ,
g_FVGPool[ai].low, g_FVGPool[ai].high, EnumToString(g_FVGPool[ai].status)), 226, clrDeepSkyBlue)
LBL(
PREFIX_DEBUG_PANEL + "ACT" ,
StringFormat(
"Act : #%d %s [%.5f– %.5f] %s",
g_FVGPool[ai].id,
EnumToString(g_FVGPool[ai].direction),
g_FVGPool[ai].low,
g_FVGPool[ai].high,
EnumToString(g_FVGPool[ai].status)
),
226,
clrDeepSkyBlue
)
}
else ObjectDelete(0, PREFIX_DEBUG_PANEL + "ACT");
if (g_PendingTicket > 0 && g_OrderPlan.valid)
{
LBL(PREFIX_DEBUG_PANEL + "ORD", StringFormat("Order: %s #%llu @ %.5f SL=%.5f TP=%.5f",
(g_OrderPlan.direction>0)?"BUY":"SELL", g_PendingTicket ,
g_OrderPlan.entry, g_OrderPlan.stopLoss, g_OrderPlan.takeProfit), 250, clrGold)
LBL(
PREFIX_DEBUG_PANEL + "ORD" ,
StringFormat(
"Order: %s #%llu @ %.5f SL=%.5f TP=%.5f",
(g_OrderPlan.direction > 0) ? "BUY" : "SELL",
g_PendingTicket,
g_OrderPlan.entry,
g_OrderPlan.stopLoss,
g_OrderPlan.takeProfit
),
250,
clrGold
)
}
else ObjectDelete(0, PREFIX_DEBUG_PANEL + "ORD");
@@ -383,12 +658,13 @@ inline void DrawContextDebug()
/** Draws all debug visuals: swings, MSS markers, FVG pool, order, debug panel. */
inline void DrawVisuals()
{
DrawContextDebug();
return; // TESTING ONLY
DrawMiddleSwingPoints();
DrawTriggerSwingPoints();
DrawMSSMarkers();
DrawFVGPool();
DrawOrderVisualization();
DrawContextDebug();
}
#endif // EA_ICT_CL__DRAWING_MQH