last ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -4032,7 +4032,7 @@ public:
|
||||
// Handle Support of Supports here ...
|
||||
void OnPositionsChangedHandler(int count) override
|
||||
{
|
||||
EQMHandleSupportProtection(count);
|
||||
// EQMHandleSupportProtection(count);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -4784,9 +4784,8 @@ private:
|
||||
}
|
||||
|
||||
//
|
||||
bool isDIRInDIRSupport = position.provider == XEQMSupportToken + XDirectionalToken ||
|
||||
position.provider == XEQMSupportToken + XINDirectionalToken;
|
||||
if (!isDIRInDIRSupport)
|
||||
bool isINDIRSupport = position.provider == XEQMSupportToken + XINDirectionalToken;
|
||||
if (!isINDIRSupport)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -4828,7 +4827,7 @@ private:
|
||||
//
|
||||
XSignal signal;
|
||||
X121SignalGenerator signalGenerator;
|
||||
bool hasSupport = signalGenerator.UpdateSupportSignals(
|
||||
bool hasSupport = signalGenerator.PrepareDirectionalSupportSignals(
|
||||
position,
|
||||
parent,
|
||||
signal //
|
||||
|
||||
@@ -1099,16 +1099,16 @@ protected:
|
||||
|
||||
//
|
||||
// Check At Least One Support Positions Open For Hedging ...
|
||||
XPosition supports[];
|
||||
int supportsCount = ExtractSupports(
|
||||
positions,
|
||||
supports //
|
||||
);
|
||||
result = IsValidSize(supportsCount);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
// XPosition supports[];
|
||||
// int supportsCount = ExtractSupports(
|
||||
// positions,
|
||||
// supports //
|
||||
// );
|
||||
// result = IsValidSize(supportsCount);
|
||||
// if (!result)
|
||||
// {
|
||||
// return result;
|
||||
// }
|
||||
|
||||
//
|
||||
double profits = SpecifiedCalculatePositionsProfit(positions);
|
||||
@@ -1139,6 +1139,9 @@ protected:
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
SyncSupports();
|
||||
|
||||
//
|
||||
string message = XEQMSupportToken + " Hedge: " + ToString(profits) + " ...";
|
||||
|
||||
|
||||
@@ -120,7 +120,8 @@ public:
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
void ~XSCTrend() {
|
||||
void ~XSCTrend()
|
||||
{
|
||||
Remove();
|
||||
}
|
||||
|
||||
@@ -340,6 +341,77 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Chart Line Values ...
|
||||
|
||||
//
|
||||
// Get Lows Line Price at Specific Time ...
|
||||
double GetLows(datetime time = NULL)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
result = GetObjectPrice(
|
||||
lowsName,
|
||||
time //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Highs Line Price at Specific Time ...
|
||||
double GetHighs(datetime time = NULL)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
result = GetObjectPrice(
|
||||
highsName,
|
||||
time //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Support Line Price at Specific Time ...
|
||||
double GetSupport(datetime time = NULL)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
result = GetObjectPrice(
|
||||
supportName,
|
||||
time //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Get Resistance Line Price at Specific Time ...
|
||||
double GetResistance(datetime time = NULL)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
result = GetObjectPrice(
|
||||
resistanceName,
|
||||
time //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Remove Draws ...
|
||||
bool Remove(
|
||||
@@ -377,6 +449,7 @@ public:
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Trend Object on Chart ...
|
||||
bool Draw(
|
||||
long chartId = 0,
|
||||
string prefix = NULL,
|
||||
@@ -438,7 +511,7 @@ public:
|
||||
secondSwingLowBar.time > secondSwingHighBar.time
|
||||
? secondSwingHighBar.time
|
||||
: secondSwingLowBar.time;
|
||||
string supportName =
|
||||
supportName =
|
||||
//
|
||||
identifier +
|
||||
(IsSpecifiedValid(prefix)
|
||||
@@ -455,8 +528,7 @@ public:
|
||||
secondSwingLowBar.time > secondSwingHighBar.time
|
||||
? secondSwingHighBar.time
|
||||
: secondSwingLowBar.time;
|
||||
|
||||
string resistanceName =
|
||||
resistanceName =
|
||||
//
|
||||
identifier +
|
||||
(IsSpecifiedValid(prefix)
|
||||
@@ -474,7 +546,7 @@ public:
|
||||
//
|
||||
double oldLow = secondSwingLowBar.low;
|
||||
datetime oldLowTime = secondSwingLowBar.time;
|
||||
string lowsName =
|
||||
lowsName =
|
||||
//
|
||||
identifier +
|
||||
(IsSpecifiedValid(prefix)
|
||||
@@ -492,7 +564,7 @@ public:
|
||||
//
|
||||
double oldHigh = secondSwingHighBar.high;
|
||||
datetime oldHighTime = secondSwingHighBar.time;
|
||||
string highsName =
|
||||
highsName =
|
||||
//
|
||||
identifier +
|
||||
(IsSpecifiedValid(prefix)
|
||||
@@ -598,6 +670,53 @@ public:
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
//
|
||||
double GetObjectPrice(
|
||||
string objName,
|
||||
datetime objTime,
|
||||
long chartId = 0,
|
||||
int subWindow = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (!IsSpecifiedValid(objName))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
objTime = NormalizeTime(objTime);
|
||||
|
||||
//
|
||||
string objectName = FindObjectName(
|
||||
objName,
|
||||
chartId,
|
||||
subWindow //
|
||||
);
|
||||
|
||||
//
|
||||
result = ObjectGetValueByTime(
|
||||
chartId,
|
||||
objectName,
|
||||
objTime //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
@@ -615,6 +734,13 @@ private:
|
||||
XOHCL secondSwingLowBar;
|
||||
XOHCL firstSwingHighBar;
|
||||
XOHCL secondSwingHighBar;
|
||||
|
||||
//
|
||||
// Object Names ...
|
||||
string lowsName;
|
||||
string highsName;
|
||||
string supportName;
|
||||
string resistanceName;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -2339,3 +2339,734 @@
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
if (canUseCF)
|
||||
{
|
||||
//
|
||||
signal.cf.Draw();
|
||||
XOHCL cfBULLBar = signal.cf.GetBullishBar();
|
||||
XOHCL cfBEARBar = signal.cf.GetBearishBar();
|
||||
|
||||
//
|
||||
if (isLong)
|
||||
{
|
||||
//
|
||||
// Supports For Longs ...
|
||||
|
||||
//
|
||||
// CF Bullish ...
|
||||
|
||||
//
|
||||
// HIGH ...
|
||||
|
||||
//
|
||||
condition = entryPrice < cfBULLBar.high;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBULLBar.high;
|
||||
rType = POSITION_TYPE_SELL;
|
||||
rMode = X_ORDER_MODE_LIMIT;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
condition = entryPrice > cfBULLBar.high;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBULLBar.high;
|
||||
rType = POSITION_TYPE_SELL;
|
||||
rMode = X_ORDER_MODE_STOP;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// LOW ...
|
||||
|
||||
//
|
||||
condition = entryPrice > cfBULLBar.low;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBULLBar.low;
|
||||
rType = POSITION_TYPE_SELL;
|
||||
rMode = X_ORDER_MODE_STOP;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
condition = entryPrice < cfBULLBar.low;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBULLBar.low;
|
||||
rType = POSITION_TYPE_SELL;
|
||||
rMode = X_ORDER_MODE_LIMIT;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CF Bearish ...
|
||||
|
||||
//
|
||||
// HIGH ...
|
||||
|
||||
//
|
||||
condition = entryPrice < cfBEARBar.high;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBEARBar.high;
|
||||
rType = POSITION_TYPE_SELL;
|
||||
rMode = X_ORDER_MODE_LIMIT;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
condition = entryPrice > cfBEARBar.high;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBEARBar.high;
|
||||
rType = POSITION_TYPE_SELL;
|
||||
rMode = X_ORDER_MODE_STOP;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// LOW ...
|
||||
|
||||
//
|
||||
condition = entryPrice > cfBEARBar.low;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBEARBar.low;
|
||||
rType = POSITION_TYPE_SELL;
|
||||
rMode = X_ORDER_MODE_STOP;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
condition = entryPrice < cfBEARBar.low;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBEARBar.low;
|
||||
rType = POSITION_TYPE_SELL;
|
||||
rMode = X_ORDER_MODE_LIMIT;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Supports For Shorts ...
|
||||
|
||||
//
|
||||
// CF Bullish ...
|
||||
|
||||
//
|
||||
// HIGH ...
|
||||
|
||||
//
|
||||
condition = entryPrice < cfBULLBar.high;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBULLBar.high;
|
||||
rType = POSITION_TYPE_BUY;
|
||||
rMode = X_ORDER_MODE_STOP;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
condition = entryPrice > cfBULLBar.high;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBULLBar.high;
|
||||
rType = POSITION_TYPE_BUY;
|
||||
rMode = X_ORDER_MODE_LIMIT;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// LOW ...
|
||||
|
||||
//
|
||||
condition = entryPrice > cfBULLBar.low;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBULLBar.low;
|
||||
rType = POSITION_TYPE_BUY;
|
||||
rMode = X_ORDER_MODE_LIMIT;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
condition = entryPrice < cfBULLBar.low;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBULLBar.low;
|
||||
rType = POSITION_TYPE_BUY;
|
||||
rMode = X_ORDER_MODE_STOP;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CF Bearish ...
|
||||
|
||||
//
|
||||
// HIGH ...
|
||||
|
||||
//
|
||||
condition = entryPrice < cfBEARBar.high;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBEARBar.high;
|
||||
rType = POSITION_TYPE_BUY;
|
||||
rMode = X_ORDER_MODE_STOP;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
condition = entryPrice > cfBEARBar.high;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBEARBar.high;
|
||||
rType = POSITION_TYPE_BUY;
|
||||
rMode = X_ORDER_MODE_LIMIT;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// LOW ...
|
||||
|
||||
//
|
||||
condition = entryPrice > cfBEARBar.low;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBEARBar.low;
|
||||
rType = POSITION_TYPE_BUY;
|
||||
rMode = X_ORDER_MODE_LIMIT;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
condition = entryPrice < cfBEARBar.low;
|
||||
if (condition)
|
||||
{
|
||||
//
|
||||
// InDirectional ...
|
||||
rEntry = cfBEARBar.low;
|
||||
rType = POSITION_TYPE_BUY;
|
||||
rMode = X_ORDER_MODE_STOP;
|
||||
rVolume = signal.volume * inDirectionalVolumeMultiplier;
|
||||
|
||||
//
|
||||
isSignalPrepared = rSignal.Prepare(
|
||||
signal.symbol,
|
||||
XEQMSupportToken + XINDirectionalToken,
|
||||
signal.period,
|
||||
rType,
|
||||
rMode,
|
||||
rEntry,
|
||||
rVolume,
|
||||
rSL,
|
||||
rTP //
|
||||
);
|
||||
if (isSignalPrepared)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
rSignal,
|
||||
signal.supports //
|
||||
);
|
||||
|
||||
//
|
||||
rSignal.Clean();
|
||||
|
||||
//
|
||||
rSL = 0;
|
||||
rTP = 0;
|
||||
rEntry = 0;
|
||||
isSignalPrepared = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# Supporting Senarios
|
||||
|
||||
first check current Position Direction's
|
||||
|
||||
## Short
|
||||
|
||||
InDirectional
|
||||
for short positions we only have Long Supports;
|
||||
entry price must below the Lines;
|
||||
and Lines Must below the SL of Positions, if it's Exists;
|
||||
|
||||
### Long Orders
|
||||
|
||||
after putting orders of InDirectionals;
|
||||
set EQM Provider;
|
||||
|
||||
### Long Orders Supporting
|
||||
|
||||
now we have to find out when orders Executed;
|
||||
after each InDirectional EQM Order Execution, we Have to Prepare a Directional Order
|
||||
by it's volume on Signal Entry.
|
||||
|
||||
## Long
|
||||
|
||||
InDirectional
|
||||
for long positions we only have short Supports;
|
||||
entry price must above the Lines;
|
||||
and Lines Must Above the SL of Positions, if it's Exists;
|
||||
|
||||
### Short Orders
|
||||
|
||||
after putting orders of InDirectionals;
|
||||
set EQM Provider;
|
||||
|
||||
### Short Orders Supporting
|
||||
|
||||
now we have to find out when orders Executed;
|
||||
after each InDirectional EQM Order Execution, we Have to Prepare a Directional Order
|
||||
by it's volume on Signal Entry.
|
||||
@@ -485,6 +485,39 @@ bool IsDrawExists(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Specific Object Name ...
|
||||
string FindObjectName(
|
||||
string suggest,
|
||||
long chartId = 0,
|
||||
int subWindow = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
string result = NULL;
|
||||
|
||||
//
|
||||
int objectsCount = ObjectsTotal(chartId, subWindow);
|
||||
if (objectsCount <= 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = objectsCount - 1; i >= 0; i--) {
|
||||
//
|
||||
string iObjectName = ObjectName(chartId, i, subWindow);
|
||||
bool isExists = StringFind(iObjectName, suggest) >= 0;
|
||||
if (isExists) {
|
||||
//
|
||||
result = iObjectName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Regular Draws ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user