last ...
This commit is contained in:
+1217
-165
File diff suppressed because it is too large
Load Diff
@@ -1805,10 +1805,14 @@ int GetLowest(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Oldest Box Index ...
|
* Get Oldest Index ...
|
||||||
*
|
*
|
||||||
* @param source: XBoxZone instance Reference Collection ...
|
* @param source: XConsolidationZone instance Reference Collection ...
|
||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
@@ -1868,9 +1872,9 @@ int GetOldest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Youngest Box Index ...
|
* Get Youngest Index ...
|
||||||
*
|
*
|
||||||
* @param source: XBoxZone instance Reference Collection ...
|
* @param source: XConsolidationZone instance Reference Collection ...
|
||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
@@ -1930,9 +1934,9 @@ int GetYoungest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Highest Box Index ...
|
* Get Highest Index ...
|
||||||
*
|
*
|
||||||
* @param source: XBoxZone instance Reference Collection ...
|
* @param source: XConsolidationZone instance Reference Collection ...
|
||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
@@ -1992,9 +1996,9 @@ int GetHighest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Lowest Box Index ...
|
* Get Lowest Index ...
|
||||||
*
|
*
|
||||||
* @param source: XBoxZone instance Reference Collection ...
|
* @param source: XConsolidationZone instance Reference Collection ...
|
||||||
*
|
*
|
||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
@@ -2053,6 +2057,10 @@ int GetLowest(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void SortZones(
|
void SortZones(
|
||||||
|
|||||||
@@ -3857,6 +3857,16 @@ int ExtractOBFVGs(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extensions Functions ...
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update to Time of Specifiex Collection ...
|
||||||
|
*
|
||||||
|
* @param items: XOBFVG instance Collection ...
|
||||||
|
* @param value: datetime ...
|
||||||
|
*/
|
||||||
void SpecifiedUpdateTo(
|
void SpecifiedUpdateTo(
|
||||||
XOBFVG &items[],
|
XOBFVG &items[],
|
||||||
datetime value = NULL //
|
datetime value = NULL //
|
||||||
@@ -3880,4 +3890,335 @@ void SpecifiedUpdateTo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts to XBoxZone ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool ToBox(
|
||||||
|
XBoxZone &box,
|
||||||
|
XOBFVG &item //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ToBox(
|
||||||
|
box,
|
||||||
|
item.ob //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts to XBoxZone ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
int ToBox(
|
||||||
|
XOBFVG &source[],
|
||||||
|
XBoxZone &dest[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(dest);
|
||||||
|
int count = ArraySize(source);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOBFVG iZone = source[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone iBox;
|
||||||
|
bool hasBox = ToBox(
|
||||||
|
iBox,
|
||||||
|
iZone //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasBox)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iBox,
|
||||||
|
dest //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
iZone.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(dest);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Oldest Index ...
|
||||||
|
*
|
||||||
|
* @param source: XOBFVG instance Reference Collection ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
int GetOldest(
|
||||||
|
XOBFVG &source[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(source);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
int boxesCount = ToBox(
|
||||||
|
source,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
if (!IsValidSize(boxesCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone selected;
|
||||||
|
for (int i = 0; i < boxesCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone iBox = tmpBoxes[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canSet =
|
||||||
|
!selected.IsValid()
|
||||||
|
? true
|
||||||
|
: selected.from > iBox.from;
|
||||||
|
if (canSet)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = i;
|
||||||
|
selected = iBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
selected.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Youngest Index ...
|
||||||
|
*
|
||||||
|
* @param source: XOBFVG instance Reference Collection ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
int GetYoungest(
|
||||||
|
XOBFVG &source[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(source);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
int boxesCount = ToBox(
|
||||||
|
source,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
if (!IsValidSize(boxesCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone selected;
|
||||||
|
for (int i = 0; i < boxesCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone iBox = tmpBoxes[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canSet =
|
||||||
|
!selected.IsValid()
|
||||||
|
? true
|
||||||
|
: selected.from < iBox.from;
|
||||||
|
if (canSet)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = i;
|
||||||
|
selected = iBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
selected.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Highest Index ...
|
||||||
|
*
|
||||||
|
* @param source: XOBFVG instance Reference Collection ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
int GetHighest(
|
||||||
|
XOBFVG &source[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(source);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
int boxesCount = ToBox(
|
||||||
|
source,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
if (!IsValidSize(boxesCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone selected;
|
||||||
|
for (int i = 0; i < boxesCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone iBox = tmpBoxes[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canSet =
|
||||||
|
!selected.IsValid()
|
||||||
|
? true
|
||||||
|
: selected.upper < iBox.upper;
|
||||||
|
if (canSet)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = i;
|
||||||
|
selected = iBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
selected.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Lowest Index ...
|
||||||
|
*
|
||||||
|
* @param source: XOBFVG instance Reference Collection ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
int GetLowest(
|
||||||
|
XOBFVG &source[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(source);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
int boxesCount = ToBox(
|
||||||
|
source,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
if (!IsValidSize(boxesCount))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone selected;
|
||||||
|
for (int i = 0; i < boxesCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone iBox = tmpBoxes[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canSet =
|
||||||
|
!selected.IsValid()
|
||||||
|
? true
|
||||||
|
: selected.lower > iBox.lower;
|
||||||
|
if (canSet)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = i;
|
||||||
|
selected = iBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
selected.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -69,7 +69,9 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
XC121SMCCycleHelper *decisionCycleHelper,
|
XC121SMCCycleHelper *decisionCycleHelper,
|
||||||
XC121SMCCycleHelper *analyseCycleHelper,
|
XC121SMCCycleHelper *analyseCycleHelper,
|
||||||
XC121SMCCycleHelper *consolidationCycleHelper,
|
XC121SMCCycleHelper *consolidationCycleHelper,
|
||||||
XC121SMCCycleHelper *visionCycleHelper
|
XC121SMCCycleHelper *visionCycleHelper,
|
||||||
|
//
|
||||||
|
double maxAllowedSLDistanceInPoint = 300
|
||||||
//
|
//
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -118,14 +120,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
datetime cTime = TimeCurrent();
|
datetime cTime = TimeCurrent();
|
||||||
double points = GetPoints(symbol);
|
double points = GetPoints(symbol);
|
||||||
|
|
||||||
//
|
|
||||||
double pivot = 0;
|
|
||||||
double point = 0;
|
|
||||||
double target = 0;
|
|
||||||
double reward = 0;
|
|
||||||
double amountPercent = 0;
|
|
||||||
ENUM_X121SMC_XWZ_PRIORITY priority = X121SMC_XWZ_PRIORITY_NONE;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cycles Conditions ...
|
// Cycles Conditions ...
|
||||||
|
|
||||||
@@ -312,9 +306,22 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Setup Conditions ...
|
// Setup Conditions ...
|
||||||
|
double sls[];
|
||||||
|
double pivot = 0;
|
||||||
|
double point = 0;
|
||||||
|
double targets[];
|
||||||
|
double reward = 0;
|
||||||
XOBFVG selectedZone;
|
XOBFVG selectedZone;
|
||||||
|
double amountPercent = 0;
|
||||||
|
bool hasPriority = false;
|
||||||
|
bool hasRewardAmount = false;
|
||||||
bool hasSelectedZone = false;
|
bool hasSelectedZone = false;
|
||||||
bool isSelectedZoneReversal = false;
|
bool isSelectedZoneReversal = false;
|
||||||
|
bool hasSelectedConsolidationZone = false;
|
||||||
|
XConsolidationZone selectedConsolidationZone;
|
||||||
|
ENUM_X_DIRECTION selectedZoneDir = X_DIRECTION_NONE;
|
||||||
|
ENUM_X121SMC_XWZ_PRIORITY priority = X121SMC_XWZ_PRIORITY_NONE;
|
||||||
|
ENUM_X121SMC_XWZ_PROVIDERS provider = X121SMC_XWZ_PROVIDER_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// First We Have to Has Working Zone ...
|
// First We Have to Has Working Zone ...
|
||||||
@@ -328,7 +335,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
zIndex,
|
zIndex,
|
||||||
visionState,
|
visionState,
|
||||||
consolidationState,
|
consolidationState,
|
||||||
analyseState //
|
analyseState,
|
||||||
|
decisionState //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,11 +360,17 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
zIndex,
|
zIndex,
|
||||||
visionState,
|
visionState,
|
||||||
consolidationState,
|
consolidationState,
|
||||||
analyseState //
|
analyseState,
|
||||||
|
decisionState //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
bool hasWaitingZones = hasWorkingZone &&
|
||||||
|
workingZone.HasWaitingZones();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Conditions if Has Inside Zones ...
|
||||||
bool hasInsideZones = hasWorkingZone &&
|
bool hasInsideZones = hasWorkingZone &&
|
||||||
workingZone.HasInsideZones();
|
workingZone.HasInsideZones();
|
||||||
if (hasInsideZones)
|
if (hasInsideZones)
|
||||||
@@ -398,10 +412,12 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
hasSelectedZone = selectedZone.IsValid();
|
hasSelectedZone = selectedZone.IsValid();
|
||||||
|
provider = X121SMC_XWZ_PROVIDER_PRICE_INSIDE_ZONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Check Conditions if Has Breaked Zones ...
|
||||||
bool hasBreakedZones = hasWorkingZone &&
|
bool hasBreakedZones = hasWorkingZone &&
|
||||||
workingZone.HasBreakedZones();
|
workingZone.HasBreakedZones();
|
||||||
if (hasBreakedZones)
|
if (hasBreakedZones)
|
||||||
@@ -446,21 +462,164 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
hasSelectedZone = selectedZone.IsValid();
|
hasSelectedZone = selectedZone.IsValid();
|
||||||
|
provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Double Check and Prepare Signal Conditions ...
|
||||||
|
// including Targets and SLs ...
|
||||||
if (hasSelectedZone)
|
if (hasSelectedZone)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Print("Has Selected Zone ...");
|
int idx = -1;
|
||||||
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Consolidation Zones for SL Handling ...
|
||||||
|
selectedZoneDir =
|
||||||
|
!isSelectedZoneReversal
|
||||||
|
? selectedZone.GetDirection()
|
||||||
|
: Opposit(selectedZone.GetDirection());
|
||||||
|
bool isSelectedZonDirBullish = IsBullish(selectedZoneDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isSelectedZoneReversal)
|
||||||
|
{
|
||||||
|
provider = X121SMC_XWZ_PROVIDER_ACTIVATED_CHOCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Priority ...
|
||||||
|
hasPriority =
|
||||||
|
hasWorkingZone &&
|
||||||
|
workingZone
|
||||||
|
.DetectPriority(
|
||||||
|
priority,
|
||||||
|
selectedZoneDir,
|
||||||
|
zIndex,
|
||||||
|
period //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Risk Reward Ration based on Priority ...
|
||||||
|
hasRewardAmount = CalculateRiskReward(
|
||||||
|
priority,
|
||||||
|
reward,
|
||||||
|
amountPercent //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate Pivot and Point ...
|
||||||
|
|
||||||
|
//
|
||||||
|
pivot =
|
||||||
|
isSelectedZonDirBullish
|
||||||
|
? selectedZone.ob.Lower()
|
||||||
|
: selectedZone.ob.Upper();
|
||||||
|
|
||||||
|
//
|
||||||
|
point =
|
||||||
|
isSelectedZonDirBullish
|
||||||
|
? selectedZone.ob.Upper()
|
||||||
|
: selectedZone.ob.Lower();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Targets ...
|
||||||
|
DetectSelectedZonesTargets(
|
||||||
|
targets,
|
||||||
|
selectedZone,
|
||||||
|
selectedZoneDir,
|
||||||
|
priority,
|
||||||
|
workingZone,
|
||||||
|
zIndex //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect SLs ...
|
||||||
|
double iAtr = decisionXConditions.atrBuffer[0];
|
||||||
|
iAtr *= 1.5;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Default SL is Pivot ...
|
||||||
|
if (pivot > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
pivot,
|
||||||
|
sls //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double iSL = iAtr * pivot;
|
||||||
|
Add(
|
||||||
|
iSL,
|
||||||
|
sls //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
DetectSelectedZoneSLCandidates(
|
||||||
|
sls,
|
||||||
|
selectedZone,
|
||||||
|
selectedZoneDir,
|
||||||
|
workingZone,
|
||||||
|
zIndex,
|
||||||
|
maxAllowedSLDistanceInPoint //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Summaries Conditions ...
|
||||||
|
result =
|
||||||
|
pivot > 0 &&
|
||||||
|
point > 0 &&
|
||||||
|
hasPriority &&
|
||||||
|
hasRewardAmount &&
|
||||||
|
HasDirection(selectedZoneDir);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isBullish = IsBullish(selectedZoneDir);
|
||||||
|
isBearish = IsBearish(selectedZoneDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
sls,
|
||||||
|
mConditions.sls //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
targets,
|
||||||
|
mConditions.targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
mConditions.pivot = pivot;
|
||||||
|
mConditions.point = point;
|
||||||
|
mConditions.reward = reward;
|
||||||
|
mConditions.setupTime = cTime;
|
||||||
|
mConditions.priority = priority;
|
||||||
|
mConditions.provider = provider;
|
||||||
|
mConditions.dir = selectedZoneDir;
|
||||||
|
mConditions.signalZone = selectedZone;
|
||||||
|
mConditions.amountPercent = amountPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Resources ...
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(sls);
|
||||||
|
Clean(targets);
|
||||||
|
selectedZone.Clean();
|
||||||
|
selectedConsolidationZone.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
UpdateTo(cTime);
|
UpdateTo(cTime);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Draw Working Zone ...
|
||||||
if (hasWorkingZone)
|
if (hasWorkingZone)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -478,9 +637,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup Resources ...
|
// Cleanup Resources ...
|
||||||
|
|
||||||
@@ -515,7 +671,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
consolidationXConditions.Clean();
|
consolidationXConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
// mConditions.Clean();
|
|
||||||
consolidationZBar.Clean();
|
consolidationZBar.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -528,9 +683,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
X121SMCStrategyXWZSignalConditions &conditions,
|
X121SMCStrategyXWZSignalConditions &conditions,
|
||||||
//
|
//
|
||||||
string _symbol,
|
|
||||||
ENUM_TIMEFRAMES _period,
|
|
||||||
//
|
|
||||||
XC121SMCCycleHelper *decisionCycleHelper,
|
XC121SMCCycleHelper *decisionCycleHelper,
|
||||||
XC121SMCCycleHelper *analyseCycleHelper,
|
XC121SMCCycleHelper *analyseCycleHelper,
|
||||||
XC121SMCCycleHelper *consolidationCycleHelper,
|
XC121SMCCycleHelper *consolidationCycleHelper,
|
||||||
@@ -587,9 +739,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
datetime cTime = TimeCurrent();
|
datetime cTime = TimeCurrent();
|
||||||
double points = GetPoints(symbol);
|
double points = GetPoints(symbol);
|
||||||
|
|
||||||
//
|
|
||||||
double sls[];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cycles Conditions ...
|
// Cycles Conditions ...
|
||||||
|
|
||||||
@@ -662,95 +811,57 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
X121Conditions analyseXConditions = analyseConditions.x121Conditions;
|
X121Conditions analyseXConditions = analyseConditions.x121Conditions;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Signal Validation ...
|
double iAtr = decisionXConditions.atrBuffer[1];
|
||||||
|
iAtr *= 1.5;
|
||||||
|
|
||||||
//
|
//
|
||||||
XOHCL cBar;
|
// Check Signal Validation ...
|
||||||
bool isInited = cBar.Init(
|
// IMPORTANT: since all Validations done in SetUp Process ...
|
||||||
conditions.symbol,
|
// here we only Execute Signal ...
|
||||||
conditions.period,
|
|
||||||
cIndex //
|
//
|
||||||
);
|
result = isBullish ||
|
||||||
XOHCL pBar;
|
isBearish;
|
||||||
isInited =
|
|
||||||
isInited &&
|
//
|
||||||
cBar.GetPreviousBar(pBar);
|
if (result)
|
||||||
bool isLowerBreaked =
|
|
||||||
//
|
|
||||||
isInited &&
|
|
||||||
cBar.high < conditions.point &&
|
|
||||||
pBar.high >= conditions.point
|
|
||||||
//
|
|
||||||
;
|
|
||||||
bool isUpperBreaked =
|
|
||||||
//
|
|
||||||
isInited &&
|
|
||||||
cBar.low > conditions.point &&
|
|
||||||
pBar.low <= conditions.point
|
|
||||||
//
|
|
||||||
;
|
|
||||||
bool isZoneBreaked =
|
|
||||||
(isBullish &&
|
|
||||||
isLowerBreaked) ||
|
|
||||||
(isBearish &&
|
|
||||||
isUpperBreaked);
|
|
||||||
result = !isZoneBreaked;
|
|
||||||
if (!result)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
cBar.Clean();
|
// Retrieve Entry Price ...
|
||||||
pBar.Clean();
|
double entry = GetEntry(
|
||||||
conditions.Clean();
|
conditions.symbol,
|
||||||
|
setupDir //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
Clean(decisionPoiEvents);
|
// Select and Apply SL ...
|
||||||
Clean(decisionCycleEvents);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
decisionState.Clean();
|
double slsMin = GetMin(conditions.sls);
|
||||||
decisionConditions.Clean();
|
double slsMax = GetMax(conditions.sls);
|
||||||
decisionXConditions.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Clean(analysePoiEvents);
|
double longSL = slsMin;
|
||||||
Clean(analyseCycleEvents);
|
double shortSL = slsMax;
|
||||||
|
|
||||||
|
//
|
||||||
|
double sl = isBullish
|
||||||
|
? longSL
|
||||||
|
: shortSL;
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.sl = sl;
|
||||||
|
conditions.triggerTime = cTime;
|
||||||
|
conditions.type = isBullish
|
||||||
|
? X_POSITION_TYPE_LONG
|
||||||
|
: X_POSITION_TYPE_SHORT;
|
||||||
|
|
||||||
//
|
//
|
||||||
analyseState.Clean();
|
|
||||||
analyseConditions.Clean();
|
|
||||||
analyseXConditions.Clean();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
cBar.Clean();
|
|
||||||
pBar.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
double bullishScore = 0;
|
|
||||||
double bearishScore = 0;
|
|
||||||
decisionXConditions.GenerateScore(
|
|
||||||
bullishScore,
|
|
||||||
bearishScore //
|
|
||||||
);
|
|
||||||
bool isBullishScorePassed =
|
|
||||||
isBullish &&
|
|
||||||
bullishScore > (bearishScore * 1.5);
|
|
||||||
bool isBearishScorePassed =
|
|
||||||
isBearish &&
|
|
||||||
bearishScore > (bullishScore * 1.5);
|
|
||||||
bool isScorePassed = isBullishScorePassed ||
|
|
||||||
isBearishScorePassed;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Base SL Used Pivot of Conditions ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup ...
|
// Cleanup ...
|
||||||
|
|
||||||
//
|
|
||||||
cBar.Clean();
|
|
||||||
pBar.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Clean(decisionPoiEvents);
|
Clean(decisionPoiEvents);
|
||||||
Clean(decisionCycleEvents);
|
Clean(decisionCycleEvents);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -592,8 +592,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
canTrigger = mXWZSignalDetector
|
canTrigger = mXWZSignalDetector
|
||||||
.DetectSignalTrigger(
|
.DetectSignalTrigger(
|
||||||
mTmpConditions[i],
|
mTmpConditions[i],
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
mDecisionCycleHelper,
|
mDecisionCycleHelper,
|
||||||
mAnalyseCycleHelper,
|
mAnalyseCycleHelper,
|
||||||
mConsolidationCycleHelper,
|
mConsolidationCycleHelper,
|
||||||
|
|||||||
Reference in New Issue
Block a user