Add support for Breaked or Rejected Support and Resistance lines in XOHCL struct ...

This commit is contained in:
2024-05-31 00:48:14 +03:30
parent 159717403f
commit 75ecdc6adf
4 changed files with 523 additions and 104 deletions
+195 -32
View File
@@ -475,8 +475,8 @@ public:
iSignal.provider == XEQMSupportToken
? true
: isLong
? longs < shorts || longProfits > shortProfits
: shorts < longs || shortProfits > longProfits
? longs < shorts // || longProfits > shortProfits
: shorts < longs // || shortProfits > longProfits
//
;
if (!canAccept)
@@ -789,7 +789,7 @@ public:
{
//
return;
//
// TODO:
// Make them Configurable ...
@@ -1350,40 +1350,40 @@ public:
//
mAlert.Alert(message);
//
XPosition position;
bool isRecieved = mTrader.GetPosition(
track.ticket,
position //
);
if (!isRecieved)
{
return;
}
// //
// XPosition position;
// bool isRecieved = mTrader.GetPosition(
// track.ticket,
// position //
// );
// if (!isRecieved)
// {
// return;
// }
//
XSignal signals[];
// //
// XSignal signals[];
//
XSignal signal;
bool isPrepared = signal.PrepareOpposit(position);
if (!isPrepared)
{
return;
}
// //
// XSignal signal;
// bool isPrepared = signal.PrepareOpposit(position);
// if (!isPrepared)
// {
// return;
// }
//
signal.comment = "";
signal.provider = XEQMSupportToken;
// //
// signal.comment = "";
// signal.provider = XEQMSupportToken;
//
AddRef(
signal,
signals //
);
// //
// AddRef(
// signal,
// signals //
// );
//
HandleEQMState(signals);
// //
// HandleEQMState(signals);
}
//
@@ -1839,6 +1839,169 @@ private:
);
}
//
// Signal Pivots ...
// --------------------------------------------------------
// Here we Save Entry of Positions as Best Pivots ...
// then when bar break down this pivots and reject them ...
// open an Opposit Position:
// - SL the Breaked Down or Up distance;
// - TP using Risk to Reward Ratio 1.5;
//
double XPosition mPositionPivcots[];
//
// Check if Breake Up a Pivot Fill a Signal ...
bool IsPivotBreakUp(XSignal &signal)
{
//
bool result = false;
//
signal.Clean();
//
int pivotsCount = CountPositionPivots();
result = IsValidSize(pivotsCount);
if (!result)
{
return result;
}
//
// Loop Through Pivots ...
for (int i = 0; i < pivotsCount; i++)
{
//
XPosition iPosition = mPositionPivots[i];
//
XOHCL zBar;
result = zBar.Init(
iPosition.symbol,
iPosition.period,
0 //
);
if (!result)
{
continue;
}
//
XOHCL cBar;
result = cBar.Init(
iPosition.symbol,
iPosition.period,
1 //
);
if (!result)
{
continue;
}
//
XOHCL pBar;
result = pBar.Init(
iPosition.symbol,
iPosition.period,
2 //
);
if (!result)
{
continue;
}
//
// Here we have Bar 0, 1 and 2 ...
//
// Check Entry Break Down ...
}
//
return result;
}
//
// Check if Breake Down a Pivot Fill a Signal ...
bool IsPivotBreakDown(XSignal signal)
{
//
bool result = false;
//
signal.Clean();
//
return result;
}
//
// Count Exists Position's Pivots ...
int CountPositionPivots()
{
//
int result = 0;
//
result = ArraySize(mPositionPivots);
//
return result;
}
//
// Add Specific Position's Pivots
void AddPositionPivots(XPosition &position)
{
//
if (!position.IsValid())
{
return;
}
//
AddRef(
position,
mPositionPivots //
);
}
//
// Remove Specific Position's Pivots
bool RemovePositionPivots(XPosition &positions)
{
//
bool result = false;
//
if (!position.IsValid())
{
return result;
}
//
int idx = position.FindIndex(mPositionPivots);
result = idx >= 0;
if (!result)
{
return result;
}
//
result = ArrayRemove(
mPositionPivots,
idx,
1 //
);
//
return result;
}
//
// Tools ...
};