This commit is contained in:
2024-05-25 22:20:20 +03:30
parent b8515c9d05
commit 1f661d4de3
6 changed files with 1072 additions and 512 deletions
+11 -53
View File
@@ -582,10 +582,13 @@ public:
DoGuards(guards);
}
//
XSignal signals[];
//
// Second Check for Position Management or Equity Management
// Actions like Supports or etc ...
bool isIgnored = HandleStateManagement();
bool isIgnored = HandleStateManagement(signals);
if (isIgnored)
{
return;
@@ -594,7 +597,6 @@ public:
//
// Second Check For Signals ...
// then Execute Signals if Provided ...
XSignal signals[];
int signalsCount = RequestForSignal(signals);
if (signalsCount <= 0)
{
@@ -740,7 +742,7 @@ public:
//
// Handle Position(s)/ Order(s) or EQM Supporting Action ...
// if returns false, prevent for process Tick ...
virtual bool HandleStateManagement()
virtual bool HandleStateManagement(XSignal &signals[])
{
return false;
}
@@ -929,38 +931,11 @@ protected:
)
{
//
double result = 0;
//
int positionsCount = ArraySize(positions);
if (positionsCount <= 0)
{
return result;
}
//
bool isHedgingEnable = mMinProfitPerTrade > 0 && mMinProfitPerVolumeFactor > 0;
if (!isHedgingEnable)
{
return result;
}
//
for (int i = 0; i < positionsCount; i++)
{
//
XPosition iPosition = positions[i];
//
if (mMinProfitPerTrade > 0 && mMinProfitPerVolumeFactor > 0)
{
//
result +=
((iPosition.volume / mMinProfitPerVolumeFactor) *
mMinProfitPerTrade) +
(-1 * iPosition.swap);
}
}
double result = SpecifiedCalculateRequiredProfitForHedge(
positions,
mMinProfitPerTrade,
mMinProfitPerVolumeFactor //
);
//
return result;
@@ -973,24 +948,7 @@ protected:
)
{
//
double result = 0;
//
int positionsCount = ArraySize(positions);
if (positionsCount <= 0)
{
return result;
}
//
for (int i = 0; i < positionsCount; i++)
{
//
XPosition iPosition = positions[i];
//
result += iPosition.profit;
}
double result = SpecifiedCalculatePositionsProfit(positions);
//
return result;