Cleanup Work Space after Backup 14040203 ...
This commit is contained in:
@@ -1,481 +0,0 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Indicator
|
||||
// -------------------------------------------------
|
||||
// Name: XCXCAEAPOIDetector ...
|
||||
// Description: Class for XCAEA POI Detector ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property description "SaherElm Class for XCAEA POI Detector"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include "../../Classes/x-saherelm.x-bar.analyser.class.mq5"
|
||||
#include "../Helpers/xcaea.helper.mq5"
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
// enum ENUM_X_PIVOT_KINDS
|
||||
// {
|
||||
// X_PIVOT_SWL, // SWL
|
||||
// X_PIVOT_SWH, // SWH
|
||||
// };
|
||||
|
||||
// string ToString(ENUM_X_PIVOT_KINDS value)
|
||||
// {
|
||||
// //
|
||||
// string result = NULL;
|
||||
|
||||
// //
|
||||
// result = EnumToString(value);
|
||||
|
||||
// //
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// struct XSamePivot
|
||||
// {
|
||||
// //
|
||||
// // Props ...
|
||||
// datetime to;
|
||||
// string type;
|
||||
// double value;
|
||||
// datetime from;
|
||||
// string symbol;
|
||||
// ENUM_X_DIRECTION dir;
|
||||
// ENUM_TIMEFRAMES period;
|
||||
|
||||
// //
|
||||
// // Constructor ...
|
||||
// XSamePivot()
|
||||
// {
|
||||
// Clean();
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Tools ...
|
||||
|
||||
// /**
|
||||
// * Cleanup Model ...
|
||||
// */
|
||||
// void Clean()
|
||||
// {
|
||||
// //
|
||||
// to = NULL;
|
||||
// value = 0;
|
||||
// from = NULL;
|
||||
// type = NULL;
|
||||
// symbol = NULL;
|
||||
// period = NULL;
|
||||
// dir = X_DIRECTION_NONE;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Validate Model ...
|
||||
// *
|
||||
// * @return ( bool )
|
||||
// */
|
||||
// bool IsValid()
|
||||
// {
|
||||
// //
|
||||
// bool result = false;
|
||||
|
||||
// //
|
||||
// result =
|
||||
// //
|
||||
// from < to &&
|
||||
// value != 0 &&
|
||||
// IsValid(to) &&
|
||||
// IsValid(from) &&
|
||||
// IsValid(symbol) &&
|
||||
// IsValid(period) &&
|
||||
// HasDirection(dir)
|
||||
// //
|
||||
// ;
|
||||
|
||||
// //
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Check a Model is Same As Other ...
|
||||
// *
|
||||
// * @return ( bool )
|
||||
// */
|
||||
// bool IsSameAs(XSamePivot &item)
|
||||
// {
|
||||
// //
|
||||
// bool result = false;
|
||||
|
||||
// //
|
||||
// result = IsValid() &&
|
||||
// item.IsValid();
|
||||
// if (!result)
|
||||
// {
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// //
|
||||
// result =
|
||||
// //
|
||||
// to == item.to &&
|
||||
// dir == item.dir &&
|
||||
// from == item.from &&
|
||||
// type == item.type &&
|
||||
// value == item.value &&
|
||||
// symbol == item.symbol &&
|
||||
// period == item.period
|
||||
// //
|
||||
// ;
|
||||
|
||||
// //
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// //
|
||||
// };
|
||||
|
||||
//
|
||||
// Implementations ...
|
||||
class XCXCAEAPOIDetector : public XCBase
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
// Constructors ...
|
||||
XCXCAEAPOIDetector(
|
||||
XCXCAEAHelper *_helper //
|
||||
)
|
||||
{
|
||||
//
|
||||
helper = _helper;
|
||||
barAnalyser = new XCBarAnalyser();
|
||||
|
||||
//
|
||||
Default();
|
||||
}
|
||||
|
||||
//
|
||||
// De Constructors ...
|
||||
~XCXCAEAPOIDetector()
|
||||
{
|
||||
//
|
||||
Clean(tkitrndPivots);
|
||||
|
||||
//
|
||||
ZeroMemory(helper);
|
||||
ZeroMemory(barAnalyser);
|
||||
}
|
||||
|
||||
//
|
||||
// Properties ...
|
||||
|
||||
int TITrndPivotVerification()
|
||||
{
|
||||
return tkitrndPivotVerification;
|
||||
}
|
||||
|
||||
void TKITrndPivotVerification(int value)
|
||||
{
|
||||
//
|
||||
value = NormalizeInt(value, 0);
|
||||
|
||||
//
|
||||
tkitrndPivotVerification = value;
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
virtual void Default()
|
||||
{
|
||||
//
|
||||
TKITrndPivotVerification(10);
|
||||
}
|
||||
|
||||
//
|
||||
void Update(
|
||||
int barIndex = 0,
|
||||
int loopback = 100 //
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
loopback = NormalizeInt(loopback, 100);
|
||||
|
||||
//
|
||||
int index = barIndex;
|
||||
int end = index + loopback;
|
||||
while (index <= end)
|
||||
{
|
||||
//
|
||||
XCAEAConditions iConditions;
|
||||
bool has = helper.GetConditions(
|
||||
iConditions,
|
||||
index,
|
||||
loopback //
|
||||
);
|
||||
|
||||
//
|
||||
// Detecting Same Pivots ...
|
||||
// HandleTKITRNDPivotDetection(iConditions, index);
|
||||
|
||||
//
|
||||
index++;
|
||||
iConditions.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// POI Handlers ...
|
||||
|
||||
// bool HasTKITRNDPivots()
|
||||
// {
|
||||
// return HasChild(tkitrndPivots);
|
||||
// }
|
||||
|
||||
// int CountTKITRNDPivots()
|
||||
// {
|
||||
// return ArraySize(tkitrndPivots);
|
||||
// }
|
||||
|
||||
// int FillTKITRNDPivots(XSamePivot &pivots[])
|
||||
// {
|
||||
// //
|
||||
// int result = 0;
|
||||
|
||||
// //
|
||||
// if (!HasTKITRNDPivots())
|
||||
// {
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// //
|
||||
// Copy(
|
||||
// tkitrndPivots,
|
||||
// pivots //
|
||||
// );
|
||||
|
||||
// //
|
||||
// result = ArraySize(pivots);
|
||||
|
||||
// //
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// bool IsTKITRNDPivotExists(
|
||||
// int &index,
|
||||
// XSamePivot &pivot //
|
||||
// )
|
||||
// {
|
||||
// //
|
||||
// bool result = false;
|
||||
|
||||
// //
|
||||
// index = -1;
|
||||
|
||||
// //
|
||||
// result = pivot.IsValid() &&
|
||||
// HasTKITRNDPivots();
|
||||
// if (!result)
|
||||
// {
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// //
|
||||
// int count = CountTKITRNDPivots();
|
||||
// for (int i = 0; i < count; i++)
|
||||
// {
|
||||
// //
|
||||
// XSamePivot iPivot = tkitrndPivots[i];
|
||||
|
||||
// //
|
||||
// bool isSame =
|
||||
// pivot.IsSameAs(iPivot);
|
||||
// if (isSame)
|
||||
// {
|
||||
// //
|
||||
// index = i;
|
||||
// iPivot.Clean();
|
||||
|
||||
// //
|
||||
// break;
|
||||
// }
|
||||
|
||||
// //
|
||||
// iPivot.Clean();
|
||||
// }
|
||||
|
||||
// //
|
||||
// result = IsValidIndex(index);
|
||||
|
||||
// //
|
||||
// return result;
|
||||
// }
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Props ...
|
||||
|
||||
// //
|
||||
// void HandleTKITRNDPivotDetection(
|
||||
// XCAEAConditions &conditions,
|
||||
// int barIndex = 0 //
|
||||
// )
|
||||
// {
|
||||
// //
|
||||
// if (barIndex < 0)
|
||||
// {
|
||||
// barIndex = 0;
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (tkitrndPivotVerification <= 0)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// //
|
||||
// datetime barTime = GetBarTime(
|
||||
// conditions.symbol,
|
||||
// conditions.period,
|
||||
// barIndex + 1 //
|
||||
// );
|
||||
|
||||
// //
|
||||
// int index = 2;
|
||||
// datetime cTime = barTime;
|
||||
// int end = ArraySize(conditions.swingLowBuffer);
|
||||
|
||||
// //
|
||||
// int swingLowVerified = 0;
|
||||
// datetime swingLowFinishAt = NULL;
|
||||
// datetime swingLowStartAt = barTime;
|
||||
// double swingLow = conditions.swingLowBuffer[1];
|
||||
// bool canLookupSwingLow = true;
|
||||
|
||||
// //
|
||||
// bool isVerified = false;
|
||||
// bool canContinue = true;
|
||||
// while (index < end && canContinue)
|
||||
// {
|
||||
// //
|
||||
// cTime += PeriodSeconds(conditions.period);
|
||||
|
||||
// //
|
||||
// // Swing Low ...
|
||||
// double iSWL = conditions.swingLowBuffer[index];
|
||||
// if (iSWL == swingLow)
|
||||
// {
|
||||
// swingLowVerified++;
|
||||
// }
|
||||
// else if (iSWL != swingLow)
|
||||
// {
|
||||
// //
|
||||
// isVerified = swingLowVerified >= tkitrndPivotVerification;
|
||||
// if (isVerified)
|
||||
// {
|
||||
// //
|
||||
// swingLowFinishAt = cTime;
|
||||
|
||||
// //
|
||||
// XSamePivot iPivot;
|
||||
|
||||
// //
|
||||
// iPivot.value = swingLow;
|
||||
// iPivot.to = swingLowFinishAt;
|
||||
// iPivot.from = swingLowStartAt;
|
||||
// iPivot.dir = X_DIRECTION_BULLISH;
|
||||
// iPivot.symbol = conditions.symbol;
|
||||
// iPivot.period = conditions.period;
|
||||
// iPivot.type = ToString(X_PIVOT_SWL);
|
||||
|
||||
// //
|
||||
// if (iPivot.IsValid())
|
||||
// {
|
||||
// AddOrUpdateTKITRNDPivot(iPivot);
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Reset ...
|
||||
// swingLow = iSWL;
|
||||
// swingLowVerified = 0;
|
||||
// swingLowFinishAt = NULL;
|
||||
// swingLowStartAt = cTime;
|
||||
// canLookupSwingLow = true;
|
||||
// }
|
||||
|
||||
// //
|
||||
// index++;
|
||||
|
||||
// //
|
||||
// canContinue = canLookupSwingLow;
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// void AddOrUpdateTKITRNDPivot(XSamePivot &pivot)
|
||||
// {
|
||||
// //
|
||||
// int idx = -1;
|
||||
// bool isExists = IsTKITRNDPivotExists(
|
||||
// idx,
|
||||
// pivot //
|
||||
// );
|
||||
// if (isExists)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// //
|
||||
// AddRef(
|
||||
// pivot,
|
||||
// tkitrndPivots //
|
||||
// );
|
||||
// }
|
||||
|
||||
//
|
||||
// Prrivate ...
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
int tkitrndPivotVerification; // KI/TKI/Trend Verification ...
|
||||
|
||||
//
|
||||
XCXCAEAHelper *helper;
|
||||
XCBarAnalyser *barAnalyser;
|
||||
|
||||
//
|
||||
// Same Pivots ...
|
||||
// XSamePivot tkitrndPivots[]; // TKITrend is Bullish/Bearish and Swing Low/High Under / Over Min / Max ...
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user