last ...
This commit is contained in:
@@ -2657,8 +2657,8 @@ class XCPOI : public XSCBaseAlert
|
||||
int rejectionBarLoopBackBarIndex = RejectionBarLoopBack() + 1;
|
||||
XOHCL iRBar;
|
||||
bool isIRBarInited = iRBar.Init(
|
||||
Symbol(),
|
||||
Period(),
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
rejectionBarLoopBackBarIndex //
|
||||
);
|
||||
if (isIRBarInited)
|
||||
@@ -2808,7 +2808,7 @@ class XCPOI : public XSCBaseAlert
|
||||
datetime endTime = cBar.time;
|
||||
XOHCL cSupplyBar;
|
||||
bool isSupplyBarInited = cSupplyBar.Init(
|
||||
Symbol(),
|
||||
mSymbol,
|
||||
SupplyZonePeriod(),
|
||||
0 //
|
||||
);
|
||||
@@ -2816,14 +2816,14 @@ class XCPOI : public XSCBaseAlert
|
||||
{
|
||||
//
|
||||
datetime lastSupplyBarTime = cSupplyBar
|
||||
.GetLastBarTimeOfPeriod(Period());
|
||||
.GetLastBarTimeOfPeriod(mPeriod);
|
||||
if (zBar.time == lastSupplyBarTime)
|
||||
{
|
||||
//
|
||||
datetime startTime = cSupplyBar.time;
|
||||
int cSupplyZonePeriodIndex = iBarShift(
|
||||
Symbol(),
|
||||
Period(),
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
cSupplyBar.time //
|
||||
);
|
||||
|
||||
@@ -2835,8 +2835,8 @@ class XCPOI : public XSCBaseAlert
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isIBarInited = iBar.Init(
|
||||
Symbol(),
|
||||
Period(),
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
i //
|
||||
);
|
||||
if (!isIBarInited)
|
||||
@@ -2936,10 +2936,10 @@ class XCPOI : public XSCBaseAlert
|
||||
if (allowDemandZones)
|
||||
{
|
||||
//
|
||||
endTime = cBar.time;
|
||||
datetime endTime = cBar.time;
|
||||
XOHCL cDemandBar;
|
||||
bool isDemandBarInited = cDemandBar.Init(
|
||||
Symbol(),
|
||||
mSymbol,
|
||||
DemandZonePeriod(),
|
||||
0 //
|
||||
);
|
||||
@@ -2947,14 +2947,14 @@ class XCPOI : public XSCBaseAlert
|
||||
{
|
||||
//
|
||||
datetime lastDemandBarTime = cDemandBar
|
||||
.GetLastBarTimeOfPeriod(Period());
|
||||
.GetLastBarTimeOfPeriod(mPeriod);
|
||||
if (zBar.time == lastDemandBarTime)
|
||||
{
|
||||
//
|
||||
datetime startTime = cDemandBar.time;
|
||||
int cDemandZonePeriodIndex = iBarShift(
|
||||
Symbol(),
|
||||
Period(),
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
cDemandBar.time //
|
||||
);
|
||||
|
||||
@@ -2966,8 +2966,8 @@ class XCPOI : public XSCBaseAlert
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isIBarInited = iBar.Init(
|
||||
Symbol(),
|
||||
Period(),
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
i //
|
||||
);
|
||||
if (!isIBarInited)
|
||||
@@ -3281,7 +3281,7 @@ class XCPOI : public XSCBaseAlert
|
||||
/**
|
||||
* Set All POIs Detection States ...
|
||||
*
|
||||
* @param state: Argument 1
|
||||
* @param state: Argument 1
|
||||
*/
|
||||
void ChangePOIsState(bool state)
|
||||
{
|
||||
@@ -3370,8 +3370,8 @@ class XCPOI : public XSCBaseAlert
|
||||
state.Clean();
|
||||
|
||||
//
|
||||
state.symbol = Symbol();
|
||||
state.period = Period();
|
||||
state.symbol = mSymbol;
|
||||
state.period = mPeriod;
|
||||
state.reportedAt = TimeCurrent();
|
||||
|
||||
//
|
||||
@@ -3565,14 +3565,14 @@ class XCPOI : public XSCBaseAlert
|
||||
SupplyZoneWidth(1);
|
||||
SupplyZoneColor(clrDarkRed);
|
||||
SupplyZoneStyle(STYLE_DASH);
|
||||
SupplyZonePeriod(GetHindMostPeriod(Period()));
|
||||
SupplyZonePeriod(GetHindMostPeriod(mPeriod));
|
||||
|
||||
//
|
||||
// Demand Zones ...
|
||||
DemandZoneWidth(1);
|
||||
DemandZoneColor(clrDarkGreen);
|
||||
DemandZoneStyle(STYLE_DASH);
|
||||
DemandZonePeriod(GetHindMostPeriod(Period()));
|
||||
DemandZonePeriod(GetHindMostPeriod(mPeriod));
|
||||
|
||||
//
|
||||
// Order Blocks ...
|
||||
@@ -4496,7 +4496,7 @@ class XCPOI : public XSCBaseAlert
|
||||
|
||||
//
|
||||
datetime cSupplyZoneStartTime = iTime(
|
||||
Symbol(),
|
||||
mSymbol,
|
||||
SupplyZonePeriod(),
|
||||
supplyZonesCount + 1 //
|
||||
);
|
||||
@@ -4504,8 +4504,8 @@ class XCPOI : public XSCBaseAlert
|
||||
|
||||
//
|
||||
int cSupplyZoneStartIndex = iBarShift(
|
||||
Symbol(),
|
||||
Period(),
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
cSupplyZoneStartTime //
|
||||
);
|
||||
|
||||
@@ -4516,8 +4516,8 @@ class XCPOI : public XSCBaseAlert
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isIBarInited = iBar.Init(
|
||||
Symbol(),
|
||||
Period(),
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
i //
|
||||
);
|
||||
if (!isIBarInited)
|
||||
@@ -4596,7 +4596,7 @@ class XCPOI : public XSCBaseAlert
|
||||
|
||||
//
|
||||
datetime cDemandZoneStartTime = iTime(
|
||||
Symbol(),
|
||||
mSymbol,
|
||||
DemandZonePeriod(),
|
||||
demandZonesCount + 1 //
|
||||
);
|
||||
@@ -4604,8 +4604,8 @@ class XCPOI : public XSCBaseAlert
|
||||
|
||||
//
|
||||
int cDemandZoneStartIndex = iBarShift(
|
||||
Symbol(),
|
||||
Period(),
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
cDemandZoneStartTime //
|
||||
);
|
||||
|
||||
@@ -4616,8 +4616,8 @@ class XCPOI : public XSCBaseAlert
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isIBarInited = iBar.Init(
|
||||
Symbol(),
|
||||
Period(),
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
i //
|
||||
);
|
||||
if (!isIBarInited)
|
||||
@@ -4666,7 +4666,7 @@ class XCPOI : public XSCBaseAlert
|
||||
bool isInited = zone.Init(
|
||||
selectedSwing.high,
|
||||
selectedSwing.low,
|
||||
ToString(X_POI_DEMAND_ZONE) + "_" + ToString(SupplyZonePeriod()),
|
||||
ToString(X_POI_DEMAND_ZONE) + "_" + ToString(DemandZonePeriod()),
|
||||
startTime,
|
||||
endTime //
|
||||
);
|
||||
@@ -7773,7 +7773,7 @@ class XCPOI : public XSCBaseAlert
|
||||
NormalizeTime(endTime);
|
||||
|
||||
//
|
||||
datetime startTime = (datetime)((int)ob.time - (PeriodSeconds(Period()) * 2));
|
||||
datetime startTime = (datetime)((int)ob.time - (PeriodSeconds(mPeriod) * 2));
|
||||
|
||||
//
|
||||
result = zone.Init(
|
||||
@@ -8641,8 +8641,8 @@ class XCPOI : public XSCBaseAlert
|
||||
{
|
||||
//
|
||||
cBarTime = iTime(
|
||||
Symbol(),
|
||||
Period(),
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
bar.Index() - 10 //
|
||||
);
|
||||
}
|
||||
@@ -8712,8 +8712,8 @@ class XCPOI : public XSCBaseAlert
|
||||
{
|
||||
//
|
||||
cBarTime = iTime(
|
||||
Symbol(),
|
||||
Period(),
|
||||
mSymbol,
|
||||
mPeriod,
|
||||
bar.Index() - 10 //
|
||||
);
|
||||
}
|
||||
|
||||
@@ -191,6 +191,101 @@ enum ENUM_X_MARKET_CYCLES
|
||||
//
|
||||
// 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 ...
|
||||
struct XBarRemainsTime
|
||||
@@ -1125,6 +1220,8 @@ struct XOHCL
|
||||
int destSeconds = PeriodSeconds(smallerPeriod);
|
||||
if (destSeconds >= sourceSeconds)
|
||||
{
|
||||
//
|
||||
result = time;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1359,3 +1359,289 @@ string ToString(ENUM_XPOI_EVENTS value)
|
||||
//
|
||||
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;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -47,7 +47,17 @@ struct X121SMCStrategyConditions
|
||||
datetime time;
|
||||
|
||||
//
|
||||
// Helper Conditions ...
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
XZone supplyZone;
|
||||
XZone bearishOrderBlock;
|
||||
XZone bearishFVG;
|
||||
|
||||
//
|
||||
XZone demandZone;
|
||||
XZone bullishOrderBlock;
|
||||
XZone bullishFVG;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user