last ...
This commit is contained in:
@@ -3051,6 +3051,25 @@ public:
|
||||
mTradeHandler.SetSave(value);
|
||||
}
|
||||
|
||||
//
|
||||
double ForceCloseProfit()
|
||||
{
|
||||
return mForceCloseProfit;
|
||||
}
|
||||
|
||||
//
|
||||
void ForceCloseProfit(double value)
|
||||
{
|
||||
//
|
||||
if (value < 0)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
|
||||
//
|
||||
mForceCloseProfit = value;
|
||||
}
|
||||
|
||||
//
|
||||
// Overrides ...
|
||||
|
||||
@@ -3888,6 +3907,9 @@ public:
|
||||
//
|
||||
DoHedge();
|
||||
|
||||
//
|
||||
DoEQMForceClose();
|
||||
|
||||
//
|
||||
// Handle Close All Positions on Specific Time ...
|
||||
DoEQMCloseOnSpecificTime();
|
||||
@@ -4080,6 +4102,7 @@ private:
|
||||
// Signals ...
|
||||
bool mAllowLong; // Allow Long
|
||||
bool mAllowShort; // Allow Short
|
||||
double mForceCloseProfit; // Close All Positions Regardless of Policies when Profit Reached
|
||||
int mReuiredSignalVerifications; // Required Verifications for Validate Signals
|
||||
bool mGetVerificationFromOtherTimeFrames; // Get Verifications from Other Time Frames
|
||||
|
||||
@@ -4264,27 +4287,40 @@ private:
|
||||
// EQM Functions ...
|
||||
|
||||
//
|
||||
bool EnableTrailling()
|
||||
void DoEQMForceClose()
|
||||
{
|
||||
return mTradeHandler.EnableTrailling();
|
||||
}
|
||||
//
|
||||
bool canDo = mForceCloseProfit > 0;
|
||||
if (!canDo)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool EnableGrid()
|
||||
{
|
||||
return mTradeHandler.EnableGrid();
|
||||
}
|
||||
//
|
||||
XPosition positions[];
|
||||
int positionsCount = mTrader.GetPositions(positions);
|
||||
if (!IsValidSize(positionsCount))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool EnableRecovery()
|
||||
{
|
||||
return mTradeHandler.EnableRecovery();
|
||||
}
|
||||
//
|
||||
double profit = SpecifiedCalculatePositionsProfit(positions);
|
||||
if (profit > 0 && profit > mForceCloseProfit)
|
||||
{
|
||||
//
|
||||
string comment = XEQMSupportToken + " Hedge ...";
|
||||
int closed = Close(
|
||||
positions,
|
||||
comment //
|
||||
);
|
||||
|
||||
//
|
||||
bool EnableProtection()
|
||||
{
|
||||
return EnableGrid() || EnableRecovery() || EnableTrailling() || AllowSupport();
|
||||
//
|
||||
if (IsValidSize(closed))
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user