Last ...
This commit is contained in:
@@ -887,7 +887,7 @@ class XC121SMCCycleHelper : public XCBase
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int FillConsolidations(
|
||||
int FillConsolidationZones(
|
||||
XConsolidationZone &consolidations[] //
|
||||
)
|
||||
{
|
||||
|
||||
@@ -468,6 +468,111 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
|
||||
double bid = GetBid(symbol);
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
int consolidationsCount = mTriggerCycleHelper.CountConsolidationZones();
|
||||
result = IsValidSize(consolidationsCount);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
conditions.Clean();
|
||||
return result;
|
||||
}
|
||||
XConsolidationZone consolidations[];
|
||||
mTriggerCycleHelper.FillConsolidationZones(consolidations);
|
||||
|
||||
//
|
||||
// Detect Bid inside Of Zones ...
|
||||
bool hasSupply = false;
|
||||
bool hasDemand = false;
|
||||
XCSupplyZone *supplyZone;
|
||||
XCDemandZone *demandZone;
|
||||
bool isBidInsideZone = false;
|
||||
XConsolidationZone bidContainsConsolidationZone;
|
||||
for (int i = consolidationsCount - 1; i >= 0; i--)
|
||||
{
|
||||
//
|
||||
XConsolidationZone iZone = consolidations[i];
|
||||
|
||||
//
|
||||
// Check Supply or Demand Zone ...
|
||||
hasSupply = iZone.HasSupplyZone(supplyZone);
|
||||
hasDemand = iZone.HasDemandZone(demandZone);
|
||||
|
||||
//
|
||||
result = hasSupply ||
|
||||
hasDemand;
|
||||
if (!result)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Bid inside Zone ...
|
||||
if (hasSupply)
|
||||
{
|
||||
//
|
||||
result = bid < supplyZone.Upper() &&
|
||||
bid > supplyZone.Lower();
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
result = bid < demandZone.Upper() &&
|
||||
bid > demandZone.Lower();
|
||||
}
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
conditions.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (hasSupply)
|
||||
{
|
||||
//
|
||||
supplyZone.To(cTime);
|
||||
XCSupplyZoneObject *iSupplyZoneObj;
|
||||
result = mPOIDrawer.CreateSupplyZone(
|
||||
supplyZone,
|
||||
iSupplyZoneObj //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
conditions.Clean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (hasDemand)
|
||||
{
|
||||
//
|
||||
demandZone.To(cTime);
|
||||
XCDemandZoneObject *iDemandZoneObj;
|
||||
result = mPOIDrawer.CreateDemandZone(
|
||||
demandZone,
|
||||
iDemandZoneObj //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
conditions.Clean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Print("BID Inside Zone ...");
|
||||
|
||||
//
|
||||
if (!result)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user