This commit is contained in:
2025-09-28 22:01:21 +03:30
parent f4067df926
commit 0e2138a4a9
2 changed files with 311 additions and 145 deletions
+34 -22
View File
@@ -453,11 +453,11 @@ void OnTick()
} }
// //
fima1Signaller.OnTick(); // fima1Signaller.OnTick();
fima2Signaller.OnTick(); fima2Signaller.OnTick();
// //
AnalyseMarket(1); // AnalyseMarket(1);
} }
// //
@@ -611,32 +611,44 @@ void OnSignalTriggered(XSignal &signal)
return; return;
} }
//
// Draw Signal on Chart ...
// XCSignalObject *iSignalObj;
// bool has = fima2Signaller.poiDrawer.DrawSignal(
// signal,
// iSignalObj,
// 7 //
// );
//
// Try to Execute Signal ...
// //
// Draw Signal Vertical Line ... // Draw Signal Vertical Line ...
// //
// CChartObjectVLine *iObj = new CChartObjectVLine(); CChartObjectVLine *iObj = new CChartObjectVLine();
// // //
// string iName = signal.GetTag(); string iName = signal.GetTag();
// color iColor = IsLong(signal.type) ? clrLime : clrRed; color iColor = IsLong(signal.type) ? clrLime : clrRed;
// // //
// bool has = iObj.Create( bool has = iObj.Create(
// fima2Signaller.poiDrawer.ChartIdentification(), fima2Signaller.poiDrawer.ChartIdentification(),
// iName, iName,
// fima2Signaller.poiDrawer.SubWindowIdentification(), fima2Signaller.poiDrawer.SubWindowIdentification(),
// signal.time // signal.time //
// ); );
// if (has) if (has)
// { {
// // //
// iObj.Width(2); iObj.Width(2);
// iObj.Color(iColor); iObj.Color(iColor);
// // //
// // eaDraws.Add(iObj); // eaDraws.Add(iObj);
// } }
// // // //
// // Alert Issued Signal ... // // Alert Issued Signal ...
@@ -901,7 +913,7 @@ void AnalyseMarket(int barIndex = 0)
); );
// //
HandleSignalLookup(bar); // HandleSignalLookup(bar);
// //
bar.Clean(); bar.Clean();
@@ -584,19 +584,6 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
analyserConfig.Clean(); analyserConfig.Clean();
} }
//
// Reading ZigZag ...
//
bool GetZigZagPoint()
{
//
bool result = false;
//
return result;
}
// //
// Overrides ... // Overrides ...
@@ -628,20 +615,31 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
XOHCL bar; XOHCL bar;
XSignal signal; XSignal signal;
XBoxZone iZone; XBoxZone iZone;
int count = 0;
bool has = false; bool has = false;
int cIdx = barIndex + 1; int cIdx = barIndex + 1;
int pIdx = cIdx + 1; int pIdx = cIdx + 1;
string iName = NULL; string iName = NULL;
XBoxZone supports[];
XBoxZone resistances[];
bool isBullish = false; bool isBullish = false;
bool isBearish = false; bool isBearish = false;
double iPrice = EMPTY_VALUE; double iPrice = EMPTY_VALUE;
XBoxZone supports[];
XBoxZone resistances[];
ENUM_X_PRICE iPriceType = X_PRICE_NONE;
XFIMAMarketStructure structure; XFIMAMarketStructure structure;
XFIMAConditions fimaConditions; XFIMAConditions fimaConditions;
ENUM_X_PRICE iPriceType = X_PRICE_NONE;
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE; ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
//
string pvTrendName = "XXIFMA2PVTrend";
CChartObjectTrend *pvTrendLine = NULL;
ENUM_X_DIRECTION pvTrend = X_DIRECTION_NONE;
//
string zgTrendName = "XFIMA2ZGTrend";
CChartObjectTrend *zgTrendLine = NULL;
ENUM_X_DIRECTION zgTrend = X_DIRECTION_NONE;
// //
// Initialize Bar as CBar ... // Initialize Bar as CBar ...
has = bar.Init( has = bar.Init(
@@ -786,6 +784,9 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
: iPrice > iMABandUpper; : iPrice > iMABandUpper;
if (!has) if (!has)
{ {
//
isBullish = false;
isBearish = false;
iDir = X_DIRECTION_NONE; iDir = X_DIRECTION_NONE;
} }
} }
@@ -795,16 +796,12 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
// //
// PV Trend Line ... // PV Trend Line ...
string pvTrendName = "XXIFMA2PVTrend";
CChartObjectTrend *pvTrendLine = NULL;
ENUM_X_DIRECTION pvTrend = X_DIRECTION_NONE;
bool hasPVAnalysis = structure.pvAnalysis.IsValid(); bool hasPVAnalysis = structure.pvAnalysis.IsValid();
if (hasPVAnalysis) if (hasPVAnalysis)
{ {
// //
// Support ... // Support ...
XBoxZone supportBox; XBoxZone supportBox;
XCBoxObject *iSupportObj;
has = structure.pvAnalysis.HasSupportBox(supportBox); has = structure.pvAnalysis.HasSupportBox(supportBox);
if (has) if (has)
{ {
@@ -814,32 +811,31 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
supportBox, supportBox,
supports // supports //
); );
has = poiDrawer.DrawBox( // has = poiDrawer.DrawBox(
supportBox, // supportBox,
iSupportObj, // iSupportObj,
true, // Ignore At ... // true, // Ignore At ...
supportBox.type // Name ... // supportBox.type // Name ...
); // );
if (has) // if (has)
{ // {
// // //
XPOIStyle iStyle; // XPOIStyle iStyle;
poiDrawer.GetBoxStyle( // poiDrawer.GetBoxStyle(
iStyle, // iStyle,
supportBox.dir // // supportBox.dir //
); // );
poiDrawer.ApplyBoxStyle( // poiDrawer.ApplyBoxStyle(
iSupportObj, // iSupportObj,
iStyle // // iStyle //
); // );
iStyle.Clean(); // iStyle.Clean();
} // }
} }
// //
// Resistance ... // Resistance ...
XBoxZone resistanceBox; XBoxZone resistanceBox;
XCBoxObject *iResistanceObj;
has = structure.pvAnalysis.HasResistanceBox(resistanceBox); has = structure.pvAnalysis.HasResistanceBox(resistanceBox);
if (has) if (has)
{ {
@@ -849,26 +845,26 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
resistanceBox, resistanceBox,
supports // supports //
); );
has = poiDrawer.DrawBox( // has = poiDrawer.DrawBox(
resistanceBox, // resistanceBox,
iResistanceObj, // iResistanceObj,
true, // Ignore At ... // true, // Ignore At ...
resistanceBox.type // Name ... // resistanceBox.type // Name ...
); // );
if (has) // if (has)
{ // {
// // //
XPOIStyle iStyle; // XPOIStyle iStyle;
poiDrawer.GetBoxStyle( // poiDrawer.GetBoxStyle(
iStyle, // iStyle,
resistanceBox.dir // // resistanceBox.dir //
); // );
poiDrawer.ApplyBoxStyle( // poiDrawer.ApplyBoxStyle(
iResistanceObj, // iResistanceObj,
iStyle // // iStyle //
); // );
iStyle.Clean(); // iStyle.Clean();
} // }
} }
// //
@@ -1066,16 +1062,13 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
// //
// ZigZag Trend Line ... // ZigZag Trend Line ...
string zgTrendName = "XFIMA2ZGTrend";
CChartObjectTrend *zgTrendLine = NULL;
ENUM_X_DIRECTION zgTrend = X_DIRECTION_NONE;
bool hasZGAnalysis = structure.zigzagAnalysis.IsValid(); bool hasZGAnalysis = structure.zigzagAnalysis.IsValid();
if (hasZGAnalysis) if (hasZGAnalysis)
{ {
// //
// Support ... // Support ...
XBoxZone supportBox; XBoxZone supportBox;
XCBoxObject *iSupportObj; // XCBoxObject *iSupportObj;
has = structure.zigzagAnalysis.HasSupportBox(supportBox); has = structure.zigzagAnalysis.HasSupportBox(supportBox);
if (has) if (has)
{ {
@@ -1085,32 +1078,32 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
supportBox, supportBox,
supports // supports //
); );
has = poiDrawer.DrawBox( // has = poiDrawer.DrawBox(
supportBox, // supportBox,
iSupportObj, // iSupportObj,
true, // Ignore At ... // true, // Ignore At ...
supportBox.type // Name ... // supportBox.type // Name ...
); // );
if (has) // if (has)
{ // {
// // //
XPOIStyle iStyle; // XPOIStyle iStyle;
poiDrawer.GetBoxStyle( // poiDrawer.GetBoxStyle(
iStyle, // iStyle,
supportBox.dir // // supportBox.dir //
); // );
poiDrawer.ApplyBoxStyle( // poiDrawer.ApplyBoxStyle(
iSupportObj, // iSupportObj,
iStyle // // iStyle //
); // );
iStyle.Clean(); // iStyle.Clean();
} // }
} }
// //
// Resistance ... // Resistance ...
XBoxZone resistanceBox; XBoxZone resistanceBox;
XCBoxObject *iResistanceObj; // XCBoxObject *iResistanceObj;
has = structure.zigzagAnalysis.HasResistanceBox(resistanceBox); has = structure.zigzagAnalysis.HasResistanceBox(resistanceBox);
if (has) if (has)
{ {
@@ -1120,26 +1113,26 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
resistanceBox, resistanceBox,
supports // supports //
); );
has = poiDrawer.DrawBox( // has = poiDrawer.DrawBox(
resistanceBox, // resistanceBox,
iResistanceObj, // iResistanceObj,
true, // Ignore At ... // true, // Ignore At ...
resistanceBox.type // Name ... // resistanceBox.type // Name ...
); // );
if (has) // if (has)
{ // {
// // //
XPOIStyle iStyle; // XPOIStyle iStyle;
poiDrawer.GetBoxStyle( // poiDrawer.GetBoxStyle(
iStyle, // iStyle,
resistanceBox.dir // // resistanceBox.dir //
); // );
poiDrawer.ApplyBoxStyle( // poiDrawer.ApplyBoxStyle(
iResistanceObj, // iResistanceObj,
iStyle // // iStyle //
); // );
iStyle.Clean(); // iStyle.Clean();
} // }
} }
// //
@@ -1346,14 +1339,14 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
supports // supports //
); );
// // //
XCBoxObject *iObj; // XCBoxObject *iObj;
has = fima2Signaller.poiDrawer.DrawBox( // has = fima2Signaller.poiDrawer.DrawBox(
structure.support, // structure.support,
iObj); // iObj);
if (has) // if (has)
{ // {
} // }
} }
// //
@@ -1367,14 +1360,14 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
resistances // resistances //
); );
// // //
XCBoxObject *iObj; // XCBoxObject *iObj;
has = fima2Signaller.poiDrawer.DrawBox( // has = fima2Signaller.poiDrawer.DrawBox(
structure.resistance, // structure.resistance,
iObj); // iObj);
if (has) // if (has)
{ // {
} // }
} }
// //
@@ -1415,16 +1408,173 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
: bar.low < resistances[insideZoneIDX].lower; : bar.low < resistances[insideZoneIDX].lower;
if (!has) if (!has)
{ {
//
isBullish = false;
isBearish = false;
iDir = X_DIRECTION_NONE; iDir = X_DIRECTION_NONE;
} }
} }
else
{
//
isBullish = false;
isBearish = false;
iDir = X_DIRECTION_NONE;
}
// //
// Checking Liquidities ... // Checking Liquidities ...
// //
// Do all Draws Here ... // Do all Draws Here ...
bool canDraw = true;
if (canDraw)
{
//
int iWidth = 2;
XPOIStyle iStyle;
XCBoxObject *iBoxObj = NULL;
color iClr = isBullish
? clrYellow
: clrDarkOrange;
//
// Supports ...
has = HasChild(supports);
if (has)
{
//
count = ArraySize(supports);
for (int i = 0; i < count; i++)
{
//
has = poiDrawer.DrawBox(
supports[i],
iBoxObj,
true, // Ignore At ...
supports[i].type // Name ...
);
if (has)
{
//
poiDrawer.GetBoxStyle(
iStyle,
supports[i].dir //
);
//
poiDrawer.ApplyBoxStyle(
iBoxObj,
iStyle //
);
}
//
iStyle.Clean();
ZeroMemory(iBoxObj);
}
}
//
// Resistances ...
has = HasChild(resistances);
if (has)
{
//
count = ArraySize(resistances);
for (int i = 0; i < count; i++)
{
//
has = poiDrawer.DrawBox(
resistances[i],
iBoxObj,
true, // Ignore At ...
resistances[i].type // Name ...
);
if (has)
{
//
poiDrawer.GetBoxStyle(
iStyle,
resistances[i].dir //
);
//
poiDrawer.ApplyBoxStyle(
iBoxObj,
iStyle //
);
}
//
iStyle.Clean();
ZeroMemory(iBoxObj);
}
}
//
// Selected Zone ...
has = iZone.IsValid();
if (has)
{
//
has = poiDrawer.DrawBox(
iZone,
iBoxObj,
true, // Ignore At ...
iZone.type // Name ...
);
if (has)
{
//
poiDrawer.GetBoxStyle(
iStyle,
iZone.dir //
);
//
iStyle.clr = iClr;
iStyle.width = iWidth;
//
poiDrawer.ApplyBoxStyle(
iBoxObj,
iStyle //
);
}
}
//
// TrendLines ...
//
// Patterns Bar ...
has = HasDirection(iDir);
if (has)
{
//
int iCode = 159;
ENUM_ARROW_ANCHOR iAnchor = isBullish
? ANCHOR_TOP
: ANCHOR_BOTTOM;
//
XCBarArrowObject *iPatternObj;
has = poiDrawer.DrawBarArrow(
bar,
iPatternObj,
iPriceType,
iCode,
iClr,
iWidth,
iAnchor,
iName,
true, // Ignore Bar Tag ...
10 // Threshold ...
);
}
}
// //
// Check Signal Founded ... // Check Signal Founded ...
has = HasDirection(iDir); has = HasDirection(iDir);
@@ -1452,8 +1602,12 @@ class XCXFIMAStrategy2Signaller : public XCXFIMABaseSignaller
// //
// Cleanup Resources ... // Cleanup Resources ...
bar.Clean(); bar.Clean();
iZone.Clean();
signal.Clean(); signal.Clean();
structure.Clean();
fimaConditions.Clean(); fimaConditions.Clean();
SpecifiedClean(supports);
SpecifiedClean(resistances);
} }
/** /**