last works ...
This commit is contained in:
@@ -1556,14 +1556,24 @@ class XCGuard : public XCBase
|
||||
//
|
||||
// Validate Action and Requirements ...
|
||||
has =
|
||||
guard.sl > 0 &&
|
||||
guard.sl >= 0 &&
|
||||
NotEmpty(guard.ticket) &&
|
||||
(guard.sl <= 0
|
||||
? guard.force
|
||||
: true) &&
|
||||
guard.action == X_GUARD_ACTION_TRAIL_STOP;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Normalize SL ...
|
||||
if (guard.sl < 0)
|
||||
{
|
||||
guard.sl = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Position ...
|
||||
XPosition position;
|
||||
@@ -1582,6 +1592,16 @@ class XCGuard : public XCBase
|
||||
|
||||
//
|
||||
bool isLong = IsLong(position.type);
|
||||
bool isGuardPassed =
|
||||
guard.sl > 0
|
||||
? (isLong
|
||||
? position.price > guard.sl &&
|
||||
(position.sl == 0 ||
|
||||
position.sl < guard.sl)
|
||||
: position.price < guard.sl &&
|
||||
(position.sl == 0 ||
|
||||
position.sl > guard.sl))
|
||||
: (guard.sl == 0 && guard.force);
|
||||
|
||||
//
|
||||
// Check Can Trail Stop or not ...
|
||||
@@ -1594,13 +1614,7 @@ class XCGuard : public XCBase
|
||||
position.profit > 0 &&
|
||||
//
|
||||
// Validate SL based on Position Type ...
|
||||
(isLong
|
||||
? position.price > guard.sl &&
|
||||
(position.sl == 0 ||
|
||||
position.sl < guard.sl)
|
||||
: position.price < guard.sl &&
|
||||
(position.sl == 0 ||
|
||||
position.sl > guard.sl));
|
||||
isGuardPassed;
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
@@ -1668,14 +1682,24 @@ class XCGuard : public XCBase
|
||||
//
|
||||
// Validate Action and Requirements ...
|
||||
has =
|
||||
guard.tp > 0 &&
|
||||
guard.tp >= 0 &&
|
||||
NotEmpty(guard.ticket) &&
|
||||
(guard.tp <= 0
|
||||
? guard.force
|
||||
: true) &&
|
||||
guard.action == X_GUARD_ACTION_TRAIL_TARGET;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
if (guard.tp < 0)
|
||||
{
|
||||
guard.tp = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Position ...
|
||||
XPosition position;
|
||||
@@ -1694,6 +1718,12 @@ class XCGuard : public XCBase
|
||||
|
||||
//
|
||||
bool isLong = IsLong(position.type);
|
||||
bool isGuardPassed =
|
||||
guard.tp > 0
|
||||
? (isLong
|
||||
? guard.tp > position.price
|
||||
: guard.tp < position.price)
|
||||
: (guard.tp == 0 && guard.force);
|
||||
|
||||
//
|
||||
// Check Can Trail Stop or not ...
|
||||
@@ -1706,9 +1736,7 @@ class XCGuard : public XCBase
|
||||
guard.tp != position.tp &&
|
||||
//
|
||||
// Validate TP based on Current Price ...
|
||||
(isLong
|
||||
? guard.tp > position.price
|
||||
: guard.tp < position.price);
|
||||
isGuardPassed;
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user