last works ...

This commit is contained in:
2025-09-27 19:49:17 +03:30
parent 21ce1ebf4f
commit 0d32543974
9 changed files with 1307 additions and 153 deletions
+497 -49
View File
@@ -39,13 +39,13 @@ enum ENUM_XCHARTOBJECTS
{ {
// //
// Global ... // Global ...
X_BOX_OBJ = 7861, X_EMPTY_OBJ = 7860, // Empty
X_BAR_ARROW_OBJ = 7862, X_BOX_OBJ = 7861, // XBox
// X_BAR_ARROW_OBJ = 7862, // XBarArrow
X_SIGNAL_OBJ = 8860, X_SIGNAL_OBJ = 8860, // XSignal
X_OHCL_OBJ = 8863, X_OHCL_OBJ = 8863, // XBar
X_RR_OBJ = 8864, X_RR_OBJ = 8864, // XRR
X_PIVOT_OBJ = 8865, X_PIVOT_OBJ = 8865, // XPivot
// //
// 9860 Custom Object ... // 9860 Custom Object ...
}; };
@@ -78,6 +78,12 @@ string ToString(ENUM_X_CHART_IDS value)
return result; return result;
} }
string ToXString(ENUM_XCHARTOBJECTS value)
{
//
return EnumToString(value);
}
struct XPOIStyle struct XPOIStyle
{ {
// //
@@ -372,9 +378,26 @@ class XCBaseObject : public CChartObject
*/ */
void ObjName(string value) void ObjName(string value)
{ {
//
Name(value);
mObjName = value; mObjName = value;
} }
virtual string TypeString()
{
return ToXString(X_EMPTY_OBJ);
}
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual int Type(void) const
{
return ((int)X_EMPTY_OBJ);
}
/** /**
* Destroy ... * Destroy ...
*/ */
@@ -481,6 +504,38 @@ class XCBarArrowObject : public XCBaseObject
// //
// Virtual ... // Virtual ...
/**
* Destroy ...
*/
void virtual Destroy()
{
//
mArrow.Detach();
mArrow.Delete();
//
Detach();
Delete();
}
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual int Type(void)
{
return (int)X_BAR_ARROW_OBJ;
}
/**
* Type as String ...
**/
string TypeString() override
{
return ToXString(X_BAR_ARROW_OBJ);
}
// //
// Setter(s) ... // Setter(s) ...
@@ -687,6 +742,48 @@ class XCSignalObject : public XCBaseObject
return result; return result;
} }
//
// Virtual ...
/**
* Destroy ...
*/
void virtual Destroy()
{
//
mTPTrend.Detach();
mTPTrend.Delete();
mSLTrend.Detach();
mSLTrend.Delete();
mEntryTrend.Detach();
mEntryTrend.Delete();
//
mTargetTrends.Clear();
//
Detach();
Delete();
}
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual int Type(void)
{
return (int)X_SIGNAL_OBJ;
}
/**
* Type as String ...
**/
string TypeString() override
{
return ToXString(X_SIGNAL_OBJ);
}
// //
// Setter(s) ... // Setter(s) ...
@@ -867,16 +964,6 @@ class XCSignalObject : public XCBaseObject
mEntryTrend.Style(value); mEntryTrend.Style(value);
} }
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual ENUM_XCHARTOBJECTS Type()
{
return X_SIGNAL_OBJ;
}
// //
private: private:
// //
@@ -950,6 +1037,24 @@ class XCRRObject : public XCSignalObject
// //
return result; return result;
} }
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual int Type(void)
{
return (int)X_RR_OBJ;
}
/**
* Type as String ...
**/
string TypeString() override
{
return ToXString(X_RR_OBJ);
}
}; };
// //
@@ -1072,6 +1177,49 @@ class XCOHCLObject : public XCBaseObject
return result; return result;
} }
//
// Virtual ...
/**
* Destroy ...
*/
void virtual Destroy()
{
//
mBodyRect.Detach();
mBodyRect.Delete();
//
mLowShadowRect.Detach();
mLowShadowRect.Delete();
//
mHighShadowRect.Detach();
mHighShadowRect.Delete();
//
Detach();
Delete();
}
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual int Type(void)
{
return (int)X_OHCL_OBJ;
}
/**
* Type as String ...
**/
string TypeString() override
{
return ToXString(X_OHCL_OBJ);
}
// //
// Getter(s) / Setter(s) ... // Getter(s) / Setter(s) ...
@@ -1244,19 +1392,6 @@ class XCOHCLObject : public XCBaseObject
HighShadowFill(fill); HighShadowFill(fill);
} }
//
// Virtual ...
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual ENUM_XCHARTOBJECTS Type()
{
return X_OHCL_OBJ;
}
// //
private: private:
// //
@@ -1375,6 +1510,45 @@ class XCBoxObject : public XCBaseObject
return result; return result;
} }
//
// Virtual ...
/**
* Destroy ...
*/
void virtual Destroy()
{
//
mAt.Detach();
mAt.Delete();
//
mRect.Detach();
mRect.Delete();
//
Detach();
Delete();
}
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual int Type(void)
{
return (int)X_BOX_OBJ;
}
/**
* Type as String ...
**/
string TypeString() override
{
return ToXString(X_BOX_OBJ);
}
// //
// Getter(s) / Setter(s) ... // Getter(s) / Setter(s) ...
@@ -1430,19 +1604,6 @@ class XCBoxObject : public XCBaseObject
mRect.Fill(value); mRect.Fill(value);
} }
//
// Virtual ...
/**
* Retrieve Object Type ...
*
* @return ( ENUM_XCHARTOBJECTS )
*/
virtual ENUM_XCHARTOBJECTS Type()
{
return X_BOX_OBJ;
}
// //
private: private:
// //
@@ -1685,10 +1846,24 @@ class XCPivotAnalysisObject : public XCBaseObject
// //
if (model.pivots[i].IsPeak()) if (model.pivots[i].IsPeak())
{ {
//
if (mPeaks == NULL)
{
mPeaks = new CArrayObj();
}
//
mPeaks.Add(iObj); mPeaks.Add(iObj);
} }
else else
{ {
//
if (mVales == NULL)
{
mVales = new CArrayObj();
}
//
mVales.Add(iObj); mVales.Add(iObj);
} }
} }
@@ -1723,9 +1898,17 @@ class XCPivotAnalysisObject : public XCBaseObject
* *
* @return ( ENUM_XCHARTOBJECTS ) * @return ( ENUM_XCHARTOBJECTS )
*/ */
virtual ENUM_XCHARTOBJECTS Type() virtual int Type(void)
{ {
return X_PIVOT_OBJ; return (int)X_PIVOT_OBJ;
}
/**
* Type as String ...
**/
string TypeString() override
{
return ToXString(X_PIVOT_OBJ);
} }
/** /**
@@ -1734,14 +1917,34 @@ class XCPivotAnalysisObject : public XCBaseObject
void virtual Destroy() void virtual Destroy()
{ {
// //
Detach(); DestroyObjects(mPeaks);
Delete(); DestroyObjects(mVales);
// //
DestroyObject(mUpper); DestroyObject(mUpper);
DestroyObject(mLower); DestroyObject(mLower);
DestroyObject(mSupportBox); DestroyObject(mSupportBox);
DestroyObject(mResistanceBox); DestroyObject(mResistanceBox);
//
delete mPeaks;
delete mVales;
delete mUpper;
delete mLower;
delete mSupportBox;
delete mResistanceBox;
//
ZeroMemory(mPeaks);
ZeroMemory(mVales);
ZeroMemory(mUpper);
ZeroMemory(mLower);
ZeroMemory(mSupportBox);
ZeroMemory(mResistanceBox);
//
Detach();
Delete();
} }
// //
@@ -2050,6 +2253,12 @@ class XCPivotAnalysisObject : public XCBaseObject
*/ */
void PeaksWidth(int value) void PeaksWidth(int value)
{ {
//
if (mPeaks == NULL)
{
return;
}
// //
// Normalize ... // Normalize ...
value = NormalizeInt(value, 1); value = NormalizeInt(value, 1);
@@ -2081,6 +2290,12 @@ class XCPivotAnalysisObject : public XCBaseObject
*/ */
void PeaksColor(color value) void PeaksColor(color value)
{ {
//
if (mPeaks == NULL)
{
return;
}
// //
// Validate ... // Validate ...
int count = mPeaks.Total(); int count = mPeaks.Total();
@@ -2108,6 +2323,12 @@ class XCPivotAnalysisObject : public XCBaseObject
*/ */
void PeaksAnchor(ENUM_ARROW_ANCHOR value) void PeaksAnchor(ENUM_ARROW_ANCHOR value)
{ {
//
if (mPeaks == NULL)
{
return;
}
// //
// Validate ... // Validate ...
int count = mPeaks.Total(); int count = mPeaks.Total();
@@ -2135,6 +2356,12 @@ class XCPivotAnalysisObject : public XCBaseObject
*/ */
void ValesWidth(int value) void ValesWidth(int value)
{ {
//
if (mVales == NULL)
{
return;
}
// //
// Normalize ... // Normalize ...
value = NormalizeInt(value, 1); value = NormalizeInt(value, 1);
@@ -2166,6 +2393,12 @@ class XCPivotAnalysisObject : public XCBaseObject
*/ */
void ValesColor(color value) void ValesColor(color value)
{ {
//
if (mVales == NULL)
{
return;
}
// //
// Validate ... // Validate ...
int count = mVales.Total(); int count = mVales.Total();
@@ -2193,6 +2426,12 @@ class XCPivotAnalysisObject : public XCBaseObject
*/ */
void ValesAnchor(ENUM_ARROW_ANCHOR value) void ValesAnchor(ENUM_ARROW_ANCHOR value)
{ {
//
if (mVales == NULL)
{
return;
}
// //
// Validate ... // Validate ...
int count = mVales.Total(); int count = mVales.Total();
@@ -2216,8 +2455,8 @@ class XCPivotAnalysisObject : public XCBaseObject
// //
private: private:
// //
CArrayObj mPeaks; CArrayObj *mPeaks;
CArrayObj mVales; CArrayObj *mVales;
CChartObjectTrend *mUpper; CChartObjectTrend *mUpper;
CChartObjectTrend *mLower; CChartObjectTrend *mLower;
XCBoxObject *mSupportBox; XCBoxObject *mSupportBox;
@@ -2331,6 +2570,215 @@ void DestroyObject(CChartObjectTrend *&object)
ZeroMemory(object); ZeroMemory(object);
} }
/**
* Completely Destroy all Chart Objects ...
*
* @param objects: CArrayObj, pointer refrence Specified Data Source ...
*/
void DestroyObjects(CArrayObj *&objects)
{
//
// Validate Exists ...
if (objects == NULL)
{
return;
}
//
// Count Childs ...
int count = objects.Total();
if (!IsValidSize(count))
{
return;
}
//
// Destroy all Childs ...
for (int i = 0; i < count; i++)
{
//
// Checking Types ...
int iType = ((CChartObject *)objects.At(i)).Type();
//
string iTypeStr = NULL;
if (iType == X_EMPTY_OBJ)
{
//
XCBaseObject *iObj = (XCBaseObject *)objects.At(i);
iTypeStr = iObj.TypeString();
//
if (iTypeStr == ToXString(X_BOX_OBJ))
{
iType = X_BOX_OBJ;
}
else if (iTypeStr == ToXString(X_BAR_ARROW_OBJ))
{
iType = X_BAR_ARROW_OBJ;
}
else if (iTypeStr == ToXString(X_SIGNAL_OBJ))
{
iType = X_SIGNAL_OBJ;
}
else if (iTypeStr == ToXString(X_OHCL_OBJ))
{
iType = X_OHCL_OBJ;
}
else if (iTypeStr == ToXString(X_RR_OBJ))
{
iType = X_RR_OBJ;
}
else if (iTypeStr == ToXString(X_PIVOT_OBJ))
{
iType = X_PIVOT_OBJ;
}
}
//
string iName = ((CChartObject *)objects.At(i)).Name();
if (!IsSpecifiedValid(iName))
{
iName = ((XCBaseObject *)objects.At(i)).ObjName();
}
//
switch (iType)
{
//
case X_RR_OBJ: {
//
XCRRObject *iObj = (XCRRObject *)objects.At(i);
iObj.Destroy();
//
delete iObj;
ZeroMemory(iObj);
}
break;
case X_BOX_OBJ: {
//
XCBoxObject *iObj = (XCBoxObject *)objects.At(i);
iObj.Destroy();
iObj.Detach();
iObj.Delete();
//
delete iObj;
ZeroMemory(iObj);
}
break;
case X_OHCL_OBJ: {
//
XCOHCLObject *iObj = (XCOHCLObject *)objects.At(i);
iObj.Destroy();
//
delete iObj;
ZeroMemory(iObj);
}
break;
case X_PIVOT_OBJ: {
//
XCPivotAnalysisObject *iObj = (XCPivotAnalysisObject *)objects.At(i);
iObj.Destroy();
//
delete iObj;
ZeroMemory(iObj);
}
break;
case X_SIGNAL_OBJ: {
//
XCSignalObject *iObj = (XCSignalObject *)objects.At(i);
iObj.Destroy();
//
delete iObj;
ZeroMemory(iObj);
}
break;
case X_BAR_ARROW_OBJ: {
//
XCBarArrowObject *iObj = (XCBarArrowObject *)objects.At(i);
iObj.Destroy();
//
delete iObj;
ZeroMemory(iObj);
}
break;
//
// Default Object Types ...
case OBJ_VLINE:
case OBJ_HLINE:
case OBJ_TREND:
case OBJ_TRENDBYANGLE:
case OBJ_CYCLES:
case OBJ_ARROWED_LINE:
case OBJ_CHANNEL:
case OBJ_STDDEVCHANNEL:
case OBJ_REGRESSION:
case OBJ_PITCHFORK:
case OBJ_GANNLINE:
case OBJ_GANNFAN:
case OBJ_GANNGRID:
case OBJ_FIBO:
case OBJ_FIBOTIMES:
case OBJ_FIBOFAN:
case OBJ_FIBOARC:
case OBJ_FIBOCHANNEL:
case OBJ_EXPANSION:
case OBJ_ELLIOTWAVE5:
case OBJ_ELLIOTWAVE3:
case OBJ_RECTANGLE:
case OBJ_TRIANGLE:
case OBJ_ELLIPSE:
case OBJ_ARROW_THUMB_UP:
case OBJ_ARROW_THUMB_DOWN:
case OBJ_ARROW_UP:
case OBJ_ARROW_DOWN:
case OBJ_ARROW_STOP:
case OBJ_ARROW_CHECK:
case OBJ_ARROW_LEFT_PRICE:
case OBJ_ARROW_RIGHT_PRICE:
case OBJ_ARROW_BUY:
case OBJ_ARROW_SELL:
case OBJ_ARROW:
case OBJ_TEXT:
case OBJ_LABEL:
case OBJ_BUTTON:
case OBJ_CHART:
case OBJ_BITMAP:
case OBJ_BITMAP_LABEL:
case OBJ_EDIT:
case OBJ_EVENT:
case OBJ_RECTANGLE_LABEL: {
//
CChartObject *iObj = (CChartObject *)objects.At(i);
//
iObj.Detach();
iObj.Delete();
//
delete iObj;
ZeroMemory(iObj);
}
break;
}
//
RemoveObjects(iName);
}
//
// Destroy itSelf ...
objects.Clear();
delete objects;
ZeroMemory(objects);
}
/** /**
* Remove Drawn Objects from Chart ... * Remove Drawn Objects from Chart ...
* *
+92
View File
@@ -430,6 +430,10 @@ class XCPOIDrawer : public XCBase
// //
// Prepare ... // Prepare ...
if (draws == NULL)
{
draws = new CArrayObj();
}
draws.Clear(); draws.Clear();
// //
@@ -617,6 +621,63 @@ class XCPOIDrawer : public XCBase
return result; return result;
} }
/**
* Draw a Collection of Boxes ...
*
* @param boxes: reference collection to Provide Boxes ...
* @param objects: reference pointer to holds drawn Objects ...
* @param ignoreAt: bool, ignore Box At Drawn ...
*
* @return ( int )
*/
int DrawBoxes(
XBoxZone &boxes[],
CArrayObj *&objects,
bool ignoreAt = true //
)
{
//
int result = 0;
//
// Prepare ...
objects = new CArrayObj();
//
// Validate ...
if (!HasChild(boxes))
{
return result;
}
//
bool has = false;
XCBoxObject *iObj;
int count = ArraySize(boxes);
for (int i = 0; i < count; i++)
{
//
has = DrawBox(
boxes[i],
iObj,
ignoreAt //
);
if (has)
{
objects.Add(iObj);
}
//
ZeroMemory(iObj);
}
//
result = objects.Total();
//
return result;
}
/** /**
* Draw Specified Signal ... * Draw Specified Signal ...
* *
@@ -1073,6 +1134,37 @@ class XCPOIDrawer : public XCBase
object.BoxStyle(style.style); object.BoxStyle(style.style);
} }
/**
* Apply Specified Style to a Collection on Drawn Boxes ...
*
* @param objects: pointer reference of Objects ...
* @param style: XPOIStyle, Specifed Style to Apply ...
*/
void ApplyBoxesStyle(
CArrayObj *&objects,
XPOIStyle &style //
)
{
//
// Validate ...
if (objects == NULL || objects.Total() <= 0)
{
return;
}
//
for (int i = 0; i < objects.Total(); i++)
{
//
XCBoxObject *iObj = ((XCBoxObject *)objects.At(i));
ApplyBoxStyle(
iObj,
style //
);
ZeroMemory(iObj);
}
}
/** /**
* Apply Specified Style to Specified Object ... * Apply Specified Style to Specified Object ...
* *
+76 -63
View File
@@ -154,7 +154,8 @@ XFIMAMarketStructureDrawerConfig marketStructureDrawerConfig; // POI Drawer Conf
// //
// Drawer and eaDraws ... // Drawer and eaDraws ...
CArrayObj eaDraws; // Drawn Objects ... // CArrayObj *eaDraws; // Drawn Objects ...
CArrayObj *marketStructureObjects; // Market Structure Objects ...
// //
XBarTracker eaBarTracker; // EA Bar Traker ... XBarTracker eaBarTracker; // EA Bar Traker ...
@@ -387,6 +388,7 @@ int OnInit()
// //
// Configure XFIMA POI Detector / Drawer ... // Configure XFIMA POI Detector / Drawer ...
detectorConfig.Default(); detectorConfig.Default();
// eaDraws = new CArrayObj();
detectorConfig.FullDetect(); detectorConfig.FullDetect();
marketStructureDrawerConfig.FullDraw(); marketStructureDrawerConfig.FullDraw();
@@ -457,8 +459,8 @@ void OnTick()
fima1Signaller.OnTick(); fima1Signaller.OnTick();
fima2Signaller.OnTick(); fima2Signaller.OnTick();
// // //
// AnalyseMarket(0); AnalyseMarket(1);
} }
// //
@@ -616,40 +618,40 @@ void OnSignalTriggered(XSignal &signal)
// Draw Signal Vertical Line ... // Draw Signal Vertical Line ...
// //
CChartObjectVLine *iObj = new CChartObjectVLine(); // CChartObjectVLine *iObj = new CChartObjectVLine();
// //
// string iName = signal.GetTag();
// color iColor = IsLong(signal.type) ? clrLime : clrRed;
// //
// bool has = iObj.Create(
// fima2Signaller.poiDrawer.ChartIdentification(),
// iName,
// fima2Signaller.poiDrawer.SubWindowIdentification(),
// signal.time //
// );
// if (has)
// {
// //
// iObj.Width(2);
// iObj.Color(iColor);
// //
// // eaDraws.Add(iObj);
// }
// //
// // Alert Issued Signal ...
// string message = signal.GetMessage();
// //
string iName = signal.GetTag(); // int signalBarIndex = GetBarIndex(
color iColor = IsLong(signal.type) ? clrLime : clrRed; // signal.symbol,
// signal.period,
// // signal.time //
bool has = iObj.Create( // );
fima2Signaller.poiDrawer.ChartIdentification(), // AnalyseMarket(signalBarIndex);
iName,
fima2Signaller.poiDrawer.SubWindowIdentification(),
signal.time //
);
if (has)
{
//
iObj.Width(2);
iObj.Color(iColor);
//
eaDraws.Add(iObj);
}
//
// Alert Issued Signal ...
string message = signal.GetMessage();
//
int signalBarIndex = GetBarIndex(
signal.symbol,
signal.period,
signal.time //
);
AnalyseMarket(signalBarIndex);
} }
// //
@@ -843,15 +845,31 @@ void AnalyseMarket(int barIndex = 0)
// //
// Configure Drawer ... // Configure Drawer ...
//
marketStructureDrawerConfig.drawOB = false;
marketStructureDrawerConfig.drawFVG = false;
//
marketStructureDrawerConfig.drawPinned = true;
marketStructureDrawerConfig.drawEngulfed = true;
marketStructureDrawerConfig.drawTrueGaped = false;
marketStructureDrawerConfig.drawMomentum = false;
marketStructureDrawerConfig.drawFlagPattern = false;
marketStructureDrawerConfig.drawStarPattern = false;
marketStructureDrawerConfig.drawRisingPattern = false;
marketStructureDrawerConfig.drawPiercingPattern = false;
marketStructureDrawerConfig.drawSignalKeyBarPattern = true;
// //
// Recents ... // Recents ...
marketStructureDrawerConfig.drawRecentPatterns = false;
marketStructureDrawerConfig.drawFakeBreakedZone = true; marketStructureDrawerConfig.drawFakeBreakedZone = true;
marketStructureDrawerConfig.drawRecentlyTestedZones = true; marketStructureDrawerConfig.drawRecentlyTestedZones = false;
marketStructureDrawerConfig.drawRecentlyBreakedZones = true; marketStructureDrawerConfig.drawRecentlyBreakedZones = false;
// //
// XPV ... // XPV ...
marketStructureDrawerConfig.drawFIMAPVPivotsAnalysis = true; marketStructureDrawerConfig.drawFIMAPVPivotsAnalysis = false;
marketStructureDrawerConfig.drawFIMAPVPivotsAnalysisZones = true; marketStructureDrawerConfig.drawFIMAPVPivotsAnalysisZones = true;
marketStructureDrawerConfig.drawFIMAPVPivotsAnalysisTrends = true; marketStructureDrawerConfig.drawFIMAPVPivotsAnalysisTrends = true;
marketStructureDrawerConfig.drawFIMAPVPivotsAnalysisPivots = true; marketStructureDrawerConfig.drawFIMAPVPivotsAnalysisPivots = true;
@@ -885,41 +903,36 @@ void AnalyseMarket(int barIndex = 0)
detectorConfig // detectorConfig //
); );
//
if (marketStructureObjects == NULL) {
marketStructureObjects = new CArrayObj();
}
//
// marketStructureObjects.Clear();
//
// Draw Only ...
// //
// Draw Market Structure ... // Draw Market Structure ...
CArrayObj *marketStructureObjects;
int marketStructureObjectsCount = fima2Signaller.poiDrawer.DrawMarketStructure( int marketStructureObjectsCount = fima2Signaller.poiDrawer.DrawMarketStructure(
marketStructure, marketStructure,
marketStructureDrawerConfig, marketStructureDrawerConfig,
marketStructureObjects // marketStructureObjects //
); );
if (IsValidIndex(marketStructureObjectsCount)) // if (IsValidIndex(marketStructureObjectsCount))
{ // {
// // //
// Add Drawn Objects if Necessary ... // // Add Drawn Objects if Necessary ...
} // // AddObjects(
// // marketStructureObjects,
// // // eaDraws //
if (HasChild(marketStructure.recentlyTestedZones)) // // );
{ // }
Print("Recently Tested Zones ...");
}
//
if (HasChild(marketStructure.recentlyBreakedZones))
{
Print("Recently Breaked Zones ...");
}
//
if (marketStructure.fakeBreakedZone.IsValid())
{
Print("Fake Breaked Zone ...");
}
// //
bar.Clean(); bar.Clean();
marketStructureObjects.Clear();
} }
// //
@@ -1524,6 +1524,11 @@ string GetTypeName(const T &t)
{ {
return typename(T); return typename(T);
} }
template <typename T>
string GetTypeName(const T *t)
{
return typename(T);
}
/** /**
* Get Specified Types Token ... * Get Specified Types Token ...
+27 -3
View File
@@ -1282,8 +1282,8 @@ string ToString(ENUM_X_MA_METHOD value)
// //
enum ENUM_X_PIVOT_TYPE enum ENUM_X_PIVOT_TYPE
{ {
X_PIVOT_TYPE_NONE = 0, // None X_PIVOT_TYPE_NONE = 0, // None
X_PIVOT_TYPE_PEAK = 1, // PEAK X_PIVOT_TYPE_PEAK = 1, // PEAK
X_PIVOT_TYPE_VALE = 2, // VALE X_PIVOT_TYPE_VALE = 2, // VALE
}; };
@@ -1355,7 +1355,31 @@ bool IsXVale(ENUM_X_PIVOT_TYPE value)
*/ */
string ToXString(ENUM_X_PIVOT_TYPE value) string ToXString(ENUM_X_PIVOT_TYPE value)
{ {
return EnumToString(value); //
string result = NULL;
//
switch (value)
{
//
case X_PIVOT_TYPE_NONE:
result = "XNONE";
break;
//
case X_PIVOT_TYPE_PEAK:
result = "XPEAK";
break;
//
case X_PIVOT_TYPE_VALE:
result = "XVALE";
break;
}
//
return result;
// return EnumToString(value);
} }
// //
@@ -3951,8 +3951,8 @@ bool ToBox(
box.dir = forDir; box.dir = forDir;
box.type = prefix; box.type = prefix;
box.at = bar.time; box.at = bar.time;
box.to = bar.time;
box.from = bar.time; box.from = bar.time;
box.to = TimeCurrent();
box.symbol = bar.symbol; box.symbol = bar.symbol;
box.period = bar.period; box.period = bar.period;
@@ -1227,6 +1227,40 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
); );
} }
//
// Supports ...
if (config.detectSupport)
{
//
Copy(
supports,
structure.supports //
);
Sort(
structure.supports,
iSortBy,
iSortDir,
config.recentlyPatternsMaxAllowedCollecting //
);
}
//
// Resistances ...
if (config.detectResistance)
{
//
Copy(
resistances,
structure.resistances //
);
Sort(
structure.resistances,
iSortBy,
iSortDir,
config.recentlyPatternsMaxAllowedCollecting //
);
}
// //
// Loop through Items ... // Loop through Items ...
for (int i = start; i < end; i++) for (int i = start; i < end; i++)
@@ -1312,7 +1346,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
// //
iPrefix = "TruGapedBar"; iPrefix = "TruGapedBar";
has = IsTrueGapedBar( has = IsTrueGapedBar(
forBar, iBar,
iDir, iDir,
config.truwGapApprovedPointMultiplier // config.truwGapApprovedPointMultiplier //
); );
@@ -1341,7 +1375,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
// //
iPrefix = "PinBar"; iPrefix = "PinBar";
has = IsPinnedBar( has = IsPinnedBar(
forBar, iBar,
iDir, iDir,
config.pinnedBaarShadowApprovedMultiplier, config.pinnedBaarShadowApprovedMultiplier,
config.pinnedBarMinimumPinBarRangeMultiplier, config.pinnedBarMinimumPinBarRangeMultiplier,
@@ -1375,12 +1409,12 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
// //
iPrefix = "Star"; iPrefix = "Star";
has = IsStartPattern( has = IsStartPattern(
forBar, iBar,
iDir // iDir //
); );
has = has && has = has &&
ToBox( ToBox(
forBar, iBar,
iBox, iBox,
iDir, iDir,
iPrefix // iPrefix //
@@ -1403,12 +1437,12 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
// //
iPrefix = "Piercing"; iPrefix = "Piercing";
has = IsPiercingPattern( has = IsPiercingPattern(
forBar, iBar,
iDir // iDir //
); );
has = has && has = has &&
ToBox( ToBox(
forBar, iBar,
iBox, iBox,
iDir, iDir,
iPrefix // iPrefix //
@@ -1431,12 +1465,12 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
// //
iPrefix = "Rising"; iPrefix = "Rising";
has = IsRisingPattern( has = IsRisingPattern(
forBar, iBar,
iDir // iDir //
); );
has = has && has = has &&
ToBox( ToBox(
forBar, iBar,
iBox, iBox,
iDir, iDir,
iPrefix // iPrefix //
@@ -1460,14 +1494,14 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
iPrefix = "Flag"; iPrefix = "Flag";
XOHCL swingBar; XOHCL swingBar;
has = IsFlagPattern( has = IsFlagPattern(
forBar, iBar,
iDir, iDir,
swingBar, swingBar,
config.flagPatternMinimumPullbackBars // config.flagPatternMinimumPullbackBars //
); );
has = has && has = has &&
ToBox( ToBox(
forBar, iBar,
iBox, iBox,
iDir, iDir,
iPrefix // iPrefix //
@@ -1490,7 +1524,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
// //
iPrefix = "SignalKeyBar"; iPrefix = "SignalKeyBar";
has = IsSignalKeyBarPattern( has = IsSignalKeyBarPattern(
forBar, iBar,
iDir, iDir,
config.signalKeyBarShadowApprovedMultiplier, config.signalKeyBarShadowApprovedMultiplier,
config.signalKeyBarMinimumPinBarRangeMultiplier, config.signalKeyBarMinimumPinBarRangeMultiplier,
@@ -1498,7 +1532,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
); );
has = has && has = has &&
ToBox( ToBox(
forBar, iBar,
iBox, iBox,
iDir, iDir,
iPrefix // iPrefix //
@@ -230,6 +230,82 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
return result; return result;
} }
/**
* Get Patterns Zone Style ...
*
* @param style: reference to hold result ...
* @param zone: Specified Zone ...
*
* @return ( bool )
*/
bool GetPatternStyle(
XPOIStyle &style,
XBoxZone &zone //
)
{
//
bool result = false;
//
style.Clean();
//
result = zone.IsValid();
if (!result)
{
return result;
}
//
GetPatternStyle(
style,
zone.dir //
);
//
return result;
}
/**
* Get Patterns Zone Style ...
*
* @param style: reference to hold result ...
* @param forDir: Specified Direction ...
*
* @return ( bool )
*/
bool GetPatternStyle(
XPOIStyle &style,
ENUM_X_DIRECTION forDir //
)
{
//
bool result = false;
//
style.Clean();
//
result = HasDirection(forDir);
if (!result)
{
return result;
}
//
GetBoxStyle(
style,
forDir //
);
//
style.width = 3;
style.style = STYLE_DASH;
//
return result;
}
/** /**
* Get Breaked Zone Style ... * Get Breaked Zone Style ...
* *
@@ -450,6 +526,182 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
); );
} }
/**
* Apply Pattern Style ...
*
* @param object: reference pointer to Object ...
* @param zone: reference to Zone ...
*/
void ApplyPatternStyle(
XCBoxObject *&object,
XBoxZone &zone //
)
{
//
if (!zone.IsValid() ||
object == NULL)
{
return;
}
//
XPOIStyle style;
if (!GetPatternStyle(style, zone))
{
return;
}
//
ApplyBoxStyle(
object,
style //
);
}
/**
* Apply Patterns Style ...
*
* @param object: reference pointer to Object ...
*/
void ApplyPatternsStyle(
CArrayObj *&objects //
)
{
//
if (objects == NULL ||
objects.Total() == 0)
{
return;
}
//
bool has = false;
XPOIStyle iStyle;
string iName = NULL;
XCBoxObject *iBoxObj = NULL;
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
for (int i = 0; i < objects.Total(); i++)
{
//
iBoxObj = (XCBoxObject *)objects.At(i);
iName = iBoxObj.ObjName();
//
iDir =
IsSpecifiedValid(iName) &&
Contains(
"BULL",
iName //
)
? X_DIRECTION_BULLISH
: IsSpecifiedValid(iName) &&
Contains(
"BEAR",
iName //
)
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
//
has = GetPatternStyle(iStyle, iDir);
if (has)
{
//
ApplyBoxStyle(
iBoxObj,
iStyle //
);
}
//
iStyle.Clean();
ZeroMemory(iBoxObj);
}
}
/**
* Apply Style to Specified Pivot Object ...
*
* @param object: reference pointer to Object ...
* @param zone: reference to Zone ...
*/
void ApplyPivotStyle(
XCBarArrowObject *&object,
XPOIStyle &style //
)
{
//
if (object == NULL)
{
return;
}
//
object.ArrowColor(style.clr);
object.ArrowWidth(style.width);
}
/**
* Apply Patterns Style ...
*
* @param object: reference pointer to Object ...
*/
void ApplyPivotsStyle(
CArrayObj *&objects //
)
{
//
if (objects == NULL ||
objects.Total() == 0)
{
return;
}
//
bool has = false;
XPOIStyle iStyle;
string iName = NULL;
XCBarArrowObject *iObj = NULL;
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
for (int i = 0; i < objects.Total(); i++)
{
//
iObj = (XCBarArrowObject *)objects.At(i);
iName = iObj.ObjName();
//
iDir =
IsSpecifiedValid(iName) &&
Contains(
"BULL",
iName //
)
? X_DIRECTION_BULLISH
: IsSpecifiedValid(iName) &&
Contains(
"BEAR",
iName //
)
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
//
has = GetPatternStyle(iStyle, iDir);
if (has)
{
//
ApplyPivotStyle(
iObj,
iStyle //
);
}
//
iStyle.Clean();
ZeroMemory(iObj);
}
}
/** /**
* Draw Specified Market Structure Based on Given Configs ... * Draw Specified Market Structure Based on Given Configs ...
* *
@@ -477,7 +729,7 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
// //
// Prepare ... // Prepare ...
objects.Clear(); // objects.Clear();
// //
int count = 0; int count = 0;
@@ -556,7 +808,7 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
// //
// Support ... // Support ...
if (config.drawSupports) if (config.drawSupport)
{ {
// //
// Validate ... // Validate ...
@@ -1173,13 +1425,145 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
// Draw Recent Patterns ... // Draw Recent Patterns ...
if (config.drawRecentPatterns) if (config.drawRecentPatterns)
{ {
//
int baseArrowCode = 159;
CArrayObj *patternObjects;
//
// Order Blocs ...
if (config.drawOB &&
HasChild(structure.obs))
{
//
count = DrawBoxes(
structure.obs,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
//
// Fair Value Gaps ...
if (config.drawFVG &&
HasChild(structure.fvgs))
{
//
count = DrawBoxes(
structure.fvgs,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
//
// Supports ...
if (config.drawSupport &&
HasChild(structure.supports))
{
//
count = DrawBoxes(
structure.supports,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
//
// Resistances ...
if (config.drawResistance &&
HasChild(structure.obs))
{
//
count = DrawBoxes(
structure.resistances,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
}
// //
// Pin Bars ... // Pin Bars ...
if (config.drawPinned && if (config.drawPinned &&
HasChild(structure.pinBars)) HasChild(structure.pinBars))
{ {
// //
// TODO: Complete this ... count = DrawPivots(
structure.pinBars,
patternObjects,
baseArrowCode,
baseArrowCode //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPivotsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
} }
// //
@@ -1188,7 +1572,27 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.engulfBars)) HasChild(structure.engulfBars))
{ {
// //
// TODO: Complete this ... count = DrawPivots(
structure.engulfBars,
patternObjects,
baseArrowCode,
baseArrowCode //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPivotsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
} }
// //
@@ -1197,16 +1601,56 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.trueGapBars)) HasChild(structure.trueGapBars))
{ {
// //
// TODO: Complete this ... count = DrawPivots(
structure.trueGapBars,
patternObjects,
baseArrowCode,
baseArrowCode //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPivotsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
} }
// //
// TrueGap Bars ... // Momentum Bars ...
if (config.drawMomentum && if (config.drawMomentum &&
HasChild(structure.momentumBars)) HasChild(structure.momentumBars))
{ {
// //
// TODO: Complete this ... count = DrawPivots(
structure.momentumBars,
patternObjects,
baseArrowCode,
baseArrowCode //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPivotsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
} }
// //
@@ -1215,7 +1659,25 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.flagPatterns)) HasChild(structure.flagPatterns))
{ {
// //
// TODO: Complete this ... count = DrawBoxes(
structure.flagPatterns,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
} }
// //
@@ -1224,7 +1686,25 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.starPatterns)) HasChild(structure.starPatterns))
{ {
// //
// TODO: Complete this ... count = DrawBoxes(
structure.starPatterns,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
} }
// //
@@ -1233,7 +1713,25 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.risingPatterns)) HasChild(structure.risingPatterns))
{ {
// //
// TODO: Complete this ... count = DrawBoxes(
structure.risingPatterns,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
} }
// //
@@ -1242,7 +1740,25 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.piercingPatterns)) HasChild(structure.piercingPatterns))
{ {
// //
// TODO: Complete this ... count = DrawBoxes(
structure.piercingPatterns,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
} }
// //
@@ -1251,7 +1767,25 @@ class XCXFIMAPOIDrawer : public XCPOIDrawer
HasChild(structure.signalKeyBarPatterns)) HasChild(structure.signalKeyBarPatterns))
{ {
// //
// TODO: Complete this ... count = DrawBoxes(
structure.signalKeyBarPatterns,
patternObjects //
);
has = IsValidSize(count);
if (has)
{
//
ApplyPatternsStyle(patternObjects);
//
AddObjects(
patternObjects,
objects //
);
}
//
ZeroMemory(patternObjects);
} }
} }
+17 -13
View File
@@ -383,6 +383,8 @@ struct XFIMAMarketStructure
// //
XBoxZone obs[]; XBoxZone obs[];
XBoxZone fvgs[]; XBoxZone fvgs[];
XBoxZone supports[];
XBoxZone resistances[];
// //
XPivot pinBars[]; XPivot pinBars[];
@@ -485,7 +487,9 @@ struct XFIMAMarketStructure
SpecifiedClean(obs); SpecifiedClean(obs);
SpecifiedClean(fvgs); SpecifiedClean(fvgs);
SpecifiedClean(pinBars); SpecifiedClean(pinBars);
SpecifiedClean(supports);
SpecifiedClean(engulfBars); SpecifiedClean(engulfBars);
SpecifiedClean(resistances);
SpecifiedClean(trueGapBars); SpecifiedClean(trueGapBars);
SpecifiedClean(momentumBars); SpecifiedClean(momentumBars);
SpecifiedClean(flagPatterns); SpecifiedClean(flagPatterns);
@@ -518,21 +522,21 @@ struct XFIMAMarketStructureDrawerConfig
// Props ... // Props ...
// //
bool drawOB; // Current Order Block ... bool drawOB; // Current Order Block ...
bool drawFVG; // Current Fair Value Gap ... bool drawFVG; // Current Fair Value Gap ...
// //
bool drawSupports; // Detected Supports ... bool drawSupport; // Detected Supports ...
bool drawResistance; // Detected Resistances ... bool drawResistance; // Detected Resistances ...
// //
bool drawSwingTrend; // Swing Trend ... bool drawSwingTrend; // Swing Trend ...
bool swingTrendRayLeft; // Ray Left Swing Trend ... bool swingTrendRayLeft; // Ray Left Swing Trend ...
bool swingTrendRayRight; // Ray Right Swing Trend ... bool swingTrendRayRight; // Ray Right Swing Trend ...
// //
// Draw Current Detected Patterns ... // Draw Current Detected Patterns ...
// //
bool drawPinned; bool drawPinned;
bool drawMomentum; bool drawMomentum;
@@ -540,11 +544,11 @@ struct XFIMAMarketStructureDrawerConfig
bool drawTrueGaped; bool drawTrueGaped;
// //
bool drawStarPattern; bool drawStarPattern;
bool drawFlagPattern; bool drawFlagPattern;
bool drawRisingPattern; bool drawRisingPattern;
bool drawPiercingPattern; bool drawPiercingPattern;
bool drawSignalKeyBarPattern; bool drawSignalKeyBarPattern;
// //
// Draw Recently Zones ... // Draw Recently Zones ...
@@ -604,7 +608,7 @@ struct XFIMAMarketStructureDrawerConfig
drawFVG = false; drawFVG = false;
drawPinned = false; drawPinned = false;
drawMomentum = false; drawMomentum = false;
drawSupports = false; drawSupport = false;
drawEngulfed = false; drawEngulfed = false;
drawTrueGaped = false; drawTrueGaped = false;
drawResistance = false; drawResistance = false;
@@ -660,7 +664,7 @@ struct XFIMAMarketStructureDrawerConfig
drawFVG = true; drawFVG = true;
drawPinned = true; drawPinned = true;
drawMomentum = true; drawMomentum = true;
drawSupports = true; drawSupport = true;
drawEngulfed = true; drawEngulfed = true;
drawTrueGaped = true; drawTrueGaped = true;
drawResistance = true; drawResistance = true;
@@ -717,7 +721,7 @@ struct XFIMAMarketStructureDrawerConfig
drawFVG = true; drawFVG = true;
drawPinned = true; drawPinned = true;
drawMomentum = true; drawMomentum = true;
drawSupports = true; drawSupport = true;
drawEngulfed = true; drawEngulfed = true;
drawTrueGaped = true; drawTrueGaped = true;
drawResistance = true; drawResistance = true;