This commit is contained in:
2024-10-26 19:48:36 +03:30
parent ce1db83914
commit 5f9a14bf7d
5 changed files with 1631 additions and 333 deletions
+36 -36
View File
@@ -2657,8 +2657,8 @@ class XCPOI : public XSCBaseAlert
int rejectionBarLoopBackBarIndex = RejectionBarLoopBack() + 1; int rejectionBarLoopBackBarIndex = RejectionBarLoopBack() + 1;
XOHCL iRBar; XOHCL iRBar;
bool isIRBarInited = iRBar.Init( bool isIRBarInited = iRBar.Init(
Symbol(), mSymbol,
Period(), mPeriod,
rejectionBarLoopBackBarIndex // rejectionBarLoopBackBarIndex //
); );
if (isIRBarInited) if (isIRBarInited)
@@ -2808,7 +2808,7 @@ class XCPOI : public XSCBaseAlert
datetime endTime = cBar.time; datetime endTime = cBar.time;
XOHCL cSupplyBar; XOHCL cSupplyBar;
bool isSupplyBarInited = cSupplyBar.Init( bool isSupplyBarInited = cSupplyBar.Init(
Symbol(), mSymbol,
SupplyZonePeriod(), SupplyZonePeriod(),
0 // 0 //
); );
@@ -2816,14 +2816,14 @@ class XCPOI : public XSCBaseAlert
{ {
// //
datetime lastSupplyBarTime = cSupplyBar datetime lastSupplyBarTime = cSupplyBar
.GetLastBarTimeOfPeriod(Period()); .GetLastBarTimeOfPeriod(mPeriod);
if (zBar.time == lastSupplyBarTime) if (zBar.time == lastSupplyBarTime)
{ {
// //
datetime startTime = cSupplyBar.time; datetime startTime = cSupplyBar.time;
int cSupplyZonePeriodIndex = iBarShift( int cSupplyZonePeriodIndex = iBarShift(
Symbol(), mSymbol,
Period(), mPeriod,
cSupplyBar.time // cSupplyBar.time //
); );
@@ -2835,8 +2835,8 @@ class XCPOI : public XSCBaseAlert
// //
XOHCL iBar; XOHCL iBar;
bool isIBarInited = iBar.Init( bool isIBarInited = iBar.Init(
Symbol(), mSymbol,
Period(), mPeriod,
i // i //
); );
if (!isIBarInited) if (!isIBarInited)
@@ -2936,10 +2936,10 @@ class XCPOI : public XSCBaseAlert
if (allowDemandZones) if (allowDemandZones)
{ {
// //
endTime = cBar.time; datetime endTime = cBar.time;
XOHCL cDemandBar; XOHCL cDemandBar;
bool isDemandBarInited = cDemandBar.Init( bool isDemandBarInited = cDemandBar.Init(
Symbol(), mSymbol,
DemandZonePeriod(), DemandZonePeriod(),
0 // 0 //
); );
@@ -2947,14 +2947,14 @@ class XCPOI : public XSCBaseAlert
{ {
// //
datetime lastDemandBarTime = cDemandBar datetime lastDemandBarTime = cDemandBar
.GetLastBarTimeOfPeriod(Period()); .GetLastBarTimeOfPeriod(mPeriod);
if (zBar.time == lastDemandBarTime) if (zBar.time == lastDemandBarTime)
{ {
// //
datetime startTime = cDemandBar.time; datetime startTime = cDemandBar.time;
int cDemandZonePeriodIndex = iBarShift( int cDemandZonePeriodIndex = iBarShift(
Symbol(), mSymbol,
Period(), mPeriod,
cDemandBar.time // cDemandBar.time //
); );
@@ -2966,8 +2966,8 @@ class XCPOI : public XSCBaseAlert
// //
XOHCL iBar; XOHCL iBar;
bool isIBarInited = iBar.Init( bool isIBarInited = iBar.Init(
Symbol(), mSymbol,
Period(), mPeriod,
i // i //
); );
if (!isIBarInited) if (!isIBarInited)
@@ -3281,7 +3281,7 @@ class XCPOI : public XSCBaseAlert
/** /**
* Set All POIs Detection States ... * Set All POIs Detection States ...
* *
* @param state: Argument 1 * @param state: Argument 1
*/ */
void ChangePOIsState(bool state) void ChangePOIsState(bool state)
{ {
@@ -3370,8 +3370,8 @@ class XCPOI : public XSCBaseAlert
state.Clean(); state.Clean();
// //
state.symbol = Symbol(); state.symbol = mSymbol;
state.period = Period(); state.period = mPeriod;
state.reportedAt = TimeCurrent(); state.reportedAt = TimeCurrent();
// //
@@ -3565,14 +3565,14 @@ class XCPOI : public XSCBaseAlert
SupplyZoneWidth(1); SupplyZoneWidth(1);
SupplyZoneColor(clrDarkRed); SupplyZoneColor(clrDarkRed);
SupplyZoneStyle(STYLE_DASH); SupplyZoneStyle(STYLE_DASH);
SupplyZonePeriod(GetHindMostPeriod(Period())); SupplyZonePeriod(GetHindMostPeriod(mPeriod));
// //
// Demand Zones ... // Demand Zones ...
DemandZoneWidth(1); DemandZoneWidth(1);
DemandZoneColor(clrDarkGreen); DemandZoneColor(clrDarkGreen);
DemandZoneStyle(STYLE_DASH); DemandZoneStyle(STYLE_DASH);
DemandZonePeriod(GetHindMostPeriod(Period())); DemandZonePeriod(GetHindMostPeriod(mPeriod));
// //
// Order Blocks ... // Order Blocks ...
@@ -4496,7 +4496,7 @@ class XCPOI : public XSCBaseAlert
// //
datetime cSupplyZoneStartTime = iTime( datetime cSupplyZoneStartTime = iTime(
Symbol(), mSymbol,
SupplyZonePeriod(), SupplyZonePeriod(),
supplyZonesCount + 1 // supplyZonesCount + 1 //
); );
@@ -4504,8 +4504,8 @@ class XCPOI : public XSCBaseAlert
// //
int cSupplyZoneStartIndex = iBarShift( int cSupplyZoneStartIndex = iBarShift(
Symbol(), mSymbol,
Period(), mPeriod,
cSupplyZoneStartTime // cSupplyZoneStartTime //
); );
@@ -4516,8 +4516,8 @@ class XCPOI : public XSCBaseAlert
// //
XOHCL iBar; XOHCL iBar;
bool isIBarInited = iBar.Init( bool isIBarInited = iBar.Init(
Symbol(), mSymbol,
Period(), mPeriod,
i // i //
); );
if (!isIBarInited) if (!isIBarInited)
@@ -4596,7 +4596,7 @@ class XCPOI : public XSCBaseAlert
// //
datetime cDemandZoneStartTime = iTime( datetime cDemandZoneStartTime = iTime(
Symbol(), mSymbol,
DemandZonePeriod(), DemandZonePeriod(),
demandZonesCount + 1 // demandZonesCount + 1 //
); );
@@ -4604,8 +4604,8 @@ class XCPOI : public XSCBaseAlert
// //
int cDemandZoneStartIndex = iBarShift( int cDemandZoneStartIndex = iBarShift(
Symbol(), mSymbol,
Period(), mPeriod,
cDemandZoneStartTime // cDemandZoneStartTime //
); );
@@ -4616,8 +4616,8 @@ class XCPOI : public XSCBaseAlert
// //
XOHCL iBar; XOHCL iBar;
bool isIBarInited = iBar.Init( bool isIBarInited = iBar.Init(
Symbol(), mSymbol,
Period(), mPeriod,
i // i //
); );
if (!isIBarInited) if (!isIBarInited)
@@ -4666,7 +4666,7 @@ class XCPOI : public XSCBaseAlert
bool isInited = zone.Init( bool isInited = zone.Init(
selectedSwing.high, selectedSwing.high,
selectedSwing.low, selectedSwing.low,
ToString(X_POI_DEMAND_ZONE) + "_" + ToString(SupplyZonePeriod()), ToString(X_POI_DEMAND_ZONE) + "_" + ToString(DemandZonePeriod()),
startTime, startTime,
endTime // endTime //
); );
@@ -7773,7 +7773,7 @@ class XCPOI : public XSCBaseAlert
NormalizeTime(endTime); NormalizeTime(endTime);
// //
datetime startTime = (datetime)((int)ob.time - (PeriodSeconds(Period()) * 2)); datetime startTime = (datetime)((int)ob.time - (PeriodSeconds(mPeriod) * 2));
// //
result = zone.Init( result = zone.Init(
@@ -8641,8 +8641,8 @@ class XCPOI : public XSCBaseAlert
{ {
// //
cBarTime = iTime( cBarTime = iTime(
Symbol(), mSymbol,
Period(), mPeriod,
bar.Index() - 10 // bar.Index() - 10 //
); );
} }
@@ -8712,8 +8712,8 @@ class XCPOI : public XSCBaseAlert
{ {
// //
cBarTime = iTime( cBarTime = iTime(
Symbol(), mSymbol,
Period(), mPeriod,
bar.Index() - 10 // bar.Index() - 10 //
); );
} }
+97
View File
@@ -191,6 +191,101 @@ enum ENUM_X_MARKET_CYCLES
// //
// Structs ... // Structs ...
//
// Model Specified Ticks Info ...
struct XTick
{
//
string symbol; // Symbol ...
datetime time; // Time ...
double bid; // Bid ...
double ask; // Ask ...
//
// Constructor ...
void XTick()
{
Clean();
}
//
// Tools Functions ...
/**
* Initial ...
*
* @param _symbol: Symbol ...
* @param _time: Time ...
* @param _bid: Bid Price ...
* @param _ask: Ask Price ...
*/
bool Init(
string _symbol,
datetime _time,
double _bid,
double _ask //
)
{
//
bool result = false;
//
result = IsValid(_symbol) &&
IsValid(_time) &&
_bid > 0 &&
_ask > 0;
if (!result) {
return result;
}
//
symbol = _symbol;
time = _time;
bid = _bid;
ask = _ask;
//
result = IsValid();
//
return result;
}
/**
* Cleanup ...
*/
void Clean()
{
//
bid = 0;
ask = 0;
time = NULL;
symbol = NULL;
}
/**
* Validate ...
*
* @return ( bool )
*/
bool IsValid()
{
//
bool result = false;
//
result = IsValid(symbol) &&
IsValid(time) &&
bid > 0 &&
ask > 0;
//
return result;
}
//
};
// //
// Model a Bar Remains Time ... // Model a Bar Remains Time ...
struct XBarRemainsTime struct XBarRemainsTime
@@ -1125,6 +1220,8 @@ struct XOHCL
int destSeconds = PeriodSeconds(smallerPeriod); int destSeconds = PeriodSeconds(smallerPeriod);
if (destSeconds >= sourceSeconds) if (destSeconds >= sourceSeconds)
{ {
//
result = time;
return result; return result;
} }
+287 -1
View File
@@ -1358,4 +1358,290 @@ string ToString(ENUM_XPOI_EVENTS value)
// //
return result; return result;
} }
//
// XOHCL Extensions ...
/**
* Check two Bar is Same or not ...
*
* @param source: XOHCL instance ...
* @param dest: XOHCL instance ...
* @param force: Check also it's Dates ...
*
* @return ( bool )
*/
bool IsSame(
XOHCL &source,
XOHCL &dest //
)
{
//
bool result = false;
//
result = source.IsValid() &&
dest.IsValid();
if (!result)
{
return result;
}
//
result =
source.open == dest.open &&
source.close == dest.close &&
source.high == dest.high &&
source.low == dest.low;
if (!result)
{
return result;
}
//
return result;
}
/**
* Find Specific Items Index inside a Collection ...
*
* @param source: XOHCL instance ...
* @param dest: XOHCL instance Collection ...
*
* @return ( int )
*/
int FindIndex(
XOHCL &source,
XOHCL &dest[] //
)
{
//
int result = -1;
//
if (!source.IsValid())
{
return result;
}
//
int count = ArraySize(dest);
if (!IsValidSize(count))
{
return result;
}
//
for (int i = 0; i < count; i++)
{
//
XOHCL iBar = dest[i];
//
bool isSame = IsSame(
source,
iBar //
);
if (isSame)
{
//
result = i;
break;
}
}
//
return result;
}
/**
* Add Specific Bar to List only if Not Exists ...
*
* @param source: XOHCL instance ...
* @param dest: XOHCL instance Collection ...
*
* @return ( bool )
*/
bool AddIfNotExists(
XOHCL &source,
XOHCL &dest[] //
)
{
//
bool result = false;
//
int count = ArraySize(dest);
result = source.IsValid();
if (!result)
{
return result;
}
//
int idx = FindIndex(source, dest);
bool isExists = IsValidIndex(idx);
if (isExists)
{
//
AddRef(
source,
dest //
);
//
result = isExists;
}
//
return result;
}
//
// XZone Extensions ...
/**
* Check two Zone is Same or not ...
*
* @param source: XZone instance ...
* @param dest: XZone instance ...
* @param force: Check also it's Dates ...
*
* @return ( bool )
*/
bool IsSame(
XZone &source,
XZone &dest,
bool force = false //
)
{
//
bool result = false;
//
result = source.IsValid() &&
dest.IsValid();
if (!result)
{
return result;
}
//
result =
source.upper == dest.upper &&
source.lower == dest.lower;
if (!result)
{
return result;
}
//
if (force)
{
//
result =
source.from == dest.from &&
source.to == dest.to;
}
//
return result;
}
/**
* Find Specific Items Index inside a Collection ...
*
* @param source: XZone instance ...
* @param dest: XZone instance Collection ...
*
* @return ( int )
*/
int FindIndex(
XZone &source,
XZone &dest[] //
)
{
//
int result = -1;
//
if (!source.IsValid())
{
return result;
}
//
int count = ArraySize(dest);
if (!IsValidSize(count))
{
return result;
}
//
for (int i = 0; i < count; i++)
{
//
XZone iZone = dest[i];
//
bool isSame = IsSame(
source,
iZone //
);
if (isSame)
{
//
result = i;
break;
}
}
//
return result;
}
/**
* Add Specific Zone to List only if Not Exists ...
*
* @param source: XZone instance ...
* @param dest: XZone instance Collection ...
*
* @return ( bool )
*/
bool AddIfNotExists(
XZone &source,
XZone &dest[] //
)
{
//
bool result = false;
//
int count = ArraySize(dest);
result = source.IsValid();
if (!result)
{
return result;
}
//
int idx = FindIndex(source, dest);
bool isExists = IsValidIndex(idx);
if (isExists)
{
//
AddRef(
source,
dest //
);
//
result = isExists;
}
//
return result;
}
//
+11 -1
View File
@@ -47,7 +47,17 @@ struct X121SMCStrategyConditions
datetime time; datetime time;
// //
// Helper Conditions ... // Conditions ...
//
XZone supplyZone;
XZone bearishOrderBlock;
XZone bearishFVG;
//
XZone demandZone;
XZone bullishOrderBlock;
XZone bullishFVG;
// //
// Constructor ... // Constructor ...
File diff suppressed because it is too large Load Diff