last ...
This commit is contained in:
@@ -605,6 +605,7 @@ class XCBaseExpert : public XCBase
|
|||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool HandleCanAnalyseEventTriggered(
|
bool HandleCanAnalyseEventTriggered(
|
||||||
|
string name,
|
||||||
string symbol,
|
string symbol,
|
||||||
ENUM_TIMEFRAMES period,
|
ENUM_TIMEFRAMES period,
|
||||||
datetime time //
|
datetime time //
|
||||||
@@ -612,6 +613,7 @@ class XCBaseExpert : public XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
return eaTradeManager.CanAnalyse(
|
return eaTradeManager.CanAnalyse(
|
||||||
|
name,
|
||||||
symbol,
|
symbol,
|
||||||
period,
|
period,
|
||||||
time //
|
time //
|
||||||
|
|||||||
@@ -442,6 +442,11 @@ class XCBaseSignaller : public XCBase
|
|||||||
signal.period = period;
|
signal.period = period;
|
||||||
signal.volume = volume;
|
signal.volume = volume;
|
||||||
signal.time = TimeCurrent();
|
signal.time = TimeCurrent();
|
||||||
|
signal.type =
|
||||||
|
isBullish
|
||||||
|
? POSITION_TYPE_BUY
|
||||||
|
: POSITION_TYPE_SELL;
|
||||||
|
signal.mode = X_ORDER_MODE_MARKET;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate Signal ...
|
// Validate Signal ...
|
||||||
|
|||||||
@@ -239,59 +239,79 @@ class XCTradeManager : public XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Determines Required Parts ...
|
// Determines Required Parts ...
|
||||||
bool hasSymbol = iPartsCount >= 1;
|
bool hasName = iPartsCount >= 1;
|
||||||
bool hasPeriod = iPartsCount >= 2;
|
bool hasSymbol = iPartsCount >= 2;
|
||||||
bool hasSessionsDescriptor = iPartsCount >= 3;
|
bool hasPeriod = iPartsCount >= 3;
|
||||||
bool hasMaxAllowedSpred = iPartsCount >= 4;
|
bool hasSessionsDescriptor = iPartsCount >= 4;
|
||||||
bool hasMaxAllowedPositios = iPartsCount >= 5;
|
bool hasMaxAllowedSpred = iPartsCount >= 5;
|
||||||
bool hasRestrictionDescriptor = iPartsCount >= 6;
|
bool hasMaxAllowedPositios = iPartsCount >= 6;
|
||||||
|
bool hasRestrictionDescriptor = iPartsCount >= 7;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Parts IDX ...
|
||||||
|
int partsIDX = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract Name ...
|
||||||
|
string iName =
|
||||||
|
hasName
|
||||||
|
? iParts[partsIDX]
|
||||||
|
: "";
|
||||||
|
iName = EscapeString(iName);
|
||||||
|
partsIDX++;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract Symbol ...
|
// Extract Symbol ...
|
||||||
string iSymbol =
|
string iSymbol =
|
||||||
hasSymbol
|
hasSymbol
|
||||||
? iParts[0]
|
? iParts[partsIDX]
|
||||||
: _Symbol;
|
: _Symbol;
|
||||||
iSymbol = EscapeString(iSymbol);
|
iSymbol = EscapeString(iSymbol);
|
||||||
iSymbol = NormalizeSymbol(iSymbol);
|
iSymbol = NormalizeSymbol(iSymbol);
|
||||||
|
partsIDX++;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract Period ...
|
// Extract Period ...
|
||||||
ENUM_TIMEFRAMES iPeriod =
|
ENUM_TIMEFRAMES iPeriod =
|
||||||
hasPeriod
|
hasPeriod
|
||||||
? ToPeriod(EscapeString(iParts[1]))
|
? ToPeriod(EscapeString(iParts[partsIDX]))
|
||||||
: _Period;
|
: _Period;
|
||||||
iPeriod = NormalizePeriod(iPeriod);
|
iPeriod = NormalizePeriod(iPeriod);
|
||||||
|
partsIDX++;
|
||||||
//
|
|
||||||
// Extract Max Allowed Sspread ...
|
|
||||||
double iMaxAllowedSpread =
|
|
||||||
hasMaxAllowedSpred
|
|
||||||
? (double)(EscapeString(iParts[3]))
|
|
||||||
: 25;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Extract Max Allowedd Positions ...
|
|
||||||
int iMaxAllowedPositions =
|
|
||||||
hasMaxAllowedPositios
|
|
||||||
? (int)(EscapeString(iParts[4]))
|
|
||||||
: 5;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract Sessions Descriptor ...
|
// Extract Sessions Descriptor ...
|
||||||
string iSessionsDescriptor =
|
string iSessionsDescriptor =
|
||||||
hasSessionsDescriptor
|
hasSessionsDescriptor
|
||||||
? iParts[2]
|
? iParts[partsIDX]
|
||||||
: "";
|
: "";
|
||||||
iSessionsDescriptor = EscapeString(iSessionsDescriptor);
|
iSessionsDescriptor = EscapeString(iSessionsDescriptor);
|
||||||
|
partsIDX++;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract Max Allowed Sspread ...
|
||||||
|
double iMaxAllowedSpread =
|
||||||
|
hasMaxAllowedSpred
|
||||||
|
? (double)(EscapeString(iParts[partsIDX]))
|
||||||
|
: 25;
|
||||||
|
partsIDX++;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract Max Allowedd Positions ...
|
||||||
|
int iMaxAllowedPositions =
|
||||||
|
hasMaxAllowedPositios
|
||||||
|
? (int)(EscapeString(iParts[partsIDX]))
|
||||||
|
: 5;
|
||||||
|
partsIDX++;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract Restrictions Descriptor ...
|
// Extract Restrictions Descriptor ...
|
||||||
string iRestrictionsDescriptor =
|
string iRestrictionsDescriptor =
|
||||||
hasRestrictionDescriptor
|
hasRestrictionDescriptor
|
||||||
? iParts[5]
|
? iParts[partsIDX]
|
||||||
: "";
|
: "";
|
||||||
iRestrictionsDescriptor = EscapeString(iRestrictionsDescriptor);
|
iRestrictionsDescriptor = EscapeString(iRestrictionsDescriptor);
|
||||||
|
partsIDX++;
|
||||||
|
|
||||||
//
|
//
|
||||||
XSymbolTradeConfig iConfig;
|
XSymbolTradeConfig iConfig;
|
||||||
@@ -299,6 +319,7 @@ class XCTradeManager : public XCBase
|
|||||||
//
|
//
|
||||||
// Initialize Config ...
|
// Initialize Config ...
|
||||||
has = iConfig.Init(
|
has = iConfig.Init(
|
||||||
|
iName,
|
||||||
iSymbol,
|
iSymbol,
|
||||||
iPeriod,
|
iPeriod,
|
||||||
iSessionsDescriptor,
|
iSessionsDescriptor,
|
||||||
@@ -731,6 +752,7 @@ class XCTradeManager : public XCBase
|
|||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool CanAnalyse(
|
bool CanAnalyse(
|
||||||
|
string name,
|
||||||
string symbol,
|
string symbol,
|
||||||
ENUM_TIMEFRAMES period,
|
ENUM_TIMEFRAMES period,
|
||||||
datetime time //
|
datetime time //
|
||||||
@@ -743,7 +765,8 @@ class XCTradeManager : public XCBase
|
|||||||
// Finding Symbol Configuration Index ...
|
// Finding Symbol Configuration Index ...
|
||||||
int idx = FindSymbolConfigurationIndex(
|
int idx = FindSymbolConfigurationIndex(
|
||||||
symbol,
|
symbol,
|
||||||
period //
|
period,
|
||||||
|
name //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -834,6 +857,7 @@ class XCTradeManager : public XCBase
|
|||||||
//
|
//
|
||||||
// Check Sessions and Restrictions ...
|
// Check Sessions and Restrictions ...
|
||||||
result = CanAnalyse(
|
result = CanAnalyse(
|
||||||
|
signal.provider,
|
||||||
signal.symbol,
|
signal.symbol,
|
||||||
signal.period,
|
signal.period,
|
||||||
signal.time //
|
signal.time //
|
||||||
@@ -847,6 +871,47 @@ class XCTradeManager : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Signal Spread ...
|
||||||
|
int idx = FindSymbolConfigurationIndex(
|
||||||
|
signal.symbol,
|
||||||
|
signal.period,
|
||||||
|
signal.provider //
|
||||||
|
);
|
||||||
|
if (IsValidIndex(idx))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double spread = GetSpread(signal.symbol);
|
||||||
|
result =
|
||||||
|
symbolTradeConfigs[idx].maxAllowedSpread > 0
|
||||||
|
? spread <= symbolTradeConfigs[idx].maxAllowedSpread
|
||||||
|
: true;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
executionResult = X_SIGNAL_EXECUTION_FAILED_SPREAD;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Max Allowed Positions ...
|
||||||
|
XPosition positions[];
|
||||||
|
ENUM_X_POSITION_TYPES mType = IsLong(signal.type)
|
||||||
|
? X_POSITION_TYPE_LONG
|
||||||
|
: X_POSITION_TYPE_SHORT;
|
||||||
|
int positionsCount = trader.GetPositions(
|
||||||
|
positions,
|
||||||
|
symbolTradeConfigs[idx].symbol,
|
||||||
|
signal.provider,
|
||||||
|
symbolTradeConfigs[idx].period,
|
||||||
|
mType,
|
||||||
|
true, // Filter By Magic ...
|
||||||
|
true // Force Clean ...
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -954,9 +1019,6 @@ class XCTradeManager : public XCBase
|
|||||||
//
|
//
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// TODO: Complete this ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create Trade Struct ...
|
// Create Trade Struct ...
|
||||||
XTradeInfo iTrade;
|
XTradeInfo iTrade;
|
||||||
@@ -2202,7 +2264,8 @@ class XCTradeManager : public XCBase
|
|||||||
//
|
//
|
||||||
int FindSymbolConfigurationIndex(
|
int FindSymbolConfigurationIndex(
|
||||||
string symbol,
|
string symbol,
|
||||||
ENUM_TIMEFRAMES period //
|
ENUM_TIMEFRAMES period,
|
||||||
|
string name //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2211,6 +2274,7 @@ class XCTradeManager : public XCBase
|
|||||||
//
|
//
|
||||||
// Validate Args ...
|
// Validate Args ...
|
||||||
if (
|
if (
|
||||||
|
!IsSpecifiedValid(name) ||
|
||||||
!IsSpecifiedValid(symbol) ||
|
!IsSpecifiedValid(symbol) ||
|
||||||
!IsSpecifiedValid(period) ||
|
!IsSpecifiedValid(period) ||
|
||||||
!HasChild(symbolTradeConfigs))
|
!HasChild(symbolTradeConfigs))
|
||||||
@@ -2223,7 +2287,8 @@ class XCTradeManager : public XCBase
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (symbolTradeConfigs[i].symbol == symbol &&
|
if (symbolTradeConfigs[i].name == name &&
|
||||||
|
symbolTradeConfigs[i].symbol == symbol &&
|
||||||
symbolTradeConfigs[i].period == period)
|
symbolTradeConfigs[i].period == period)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ input string eaLogSuffix = ""; // Log Suffix
|
|||||||
//
|
//
|
||||||
// Symbols
|
// Symbols
|
||||||
// [
|
// [
|
||||||
|
// Name|
|
||||||
// Symbol|
|
// Symbol|
|
||||||
// period|
|
// period|
|
||||||
// (ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|
|
// (ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|
|
||||||
@@ -55,8 +56,8 @@ input string eaLogSuffix = ""; // Log Suffix
|
|||||||
// ]
|
// ]
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// [XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,1,0,2,0)]
|
// [XNAME|XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,1,0,2,0)]
|
||||||
input string eaSymbolConfiguration = "[XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,3,0,2,0)]"; // Symbol Configurations
|
input string eaSymbolConfiguration = "[XNAME|XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,3,0,2,0)]"; // Symbol Configurations
|
||||||
|
|
||||||
//
|
//
|
||||||
// Management ...
|
// Management ...
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ input string eaLogSuffix = ""; // Log Suffix
|
|||||||
//
|
//
|
||||||
// Symbols
|
// Symbols
|
||||||
// [
|
// [
|
||||||
|
// Name|
|
||||||
// Symbol|
|
// Symbol|
|
||||||
// period|
|
// period|
|
||||||
// (ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|
|
// (ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|
|
||||||
@@ -55,10 +56,10 @@ input string eaLogSuffix = ""; // Log Suffix
|
|||||||
// ]
|
// ]
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// [EURUSDb|M5||25.0|5|]
|
// [XFIMA1|EURUSDb|M5||25.0|5|]
|
||||||
// [XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,1,0,2,0)]
|
// [XFIMA1|XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,1,0,2,0)]
|
||||||
// [XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,3,0,2,0)]
|
// [XFIMA1|XAUUSDb|M5|(ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)|25.0|5|(XTRADE_RESTRICATION_DAILY,3,0,2,0)]
|
||||||
input string eaSymbolConfiguration = "[EURUSDb|M5||25.0|5|]"; // Symbol Configurations
|
input string eaSymbolConfiguration = "[XFIMA1|EURUSDb|M5||25.0|5|]"; // Symbol Configurations
|
||||||
|
|
||||||
//
|
//
|
||||||
// Management ...
|
// Management ...
|
||||||
|
|||||||
@@ -2919,6 +2919,7 @@ struct XSymbolTradeConfig
|
|||||||
int trades; // All Trades
|
int trades; // All Trades
|
||||||
int losses; // All Loosing Trades
|
int losses; // All Loosing Trades
|
||||||
int profits; // All Winning Trades
|
int profits; // All Winning Trades
|
||||||
|
string name; // Provider Name
|
||||||
string symbol; // Trading Symbol
|
string symbol; // Trading Symbol
|
||||||
int managedSLs; // Managed SL(s)
|
int managedSLs; // Managed SL(s)
|
||||||
int managedTPs; // Managed TP(s)
|
int managedTPs; // Managed TP(s)
|
||||||
@@ -2953,6 +2954,7 @@ struct XSymbolTradeConfig
|
|||||||
void Clean()
|
void Clean()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
name = NULL;
|
||||||
symbol = NULL;
|
symbol = NULL;
|
||||||
period = NULL;
|
period = NULL;
|
||||||
SpecifiedClean(sessions);
|
SpecifiedClean(sessions);
|
||||||
@@ -3003,6 +3005,7 @@ struct XSymbolTradeConfig
|
|||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool Init(
|
bool Init(
|
||||||
|
string _name,
|
||||||
string _symbol = NULL,
|
string _symbol = NULL,
|
||||||
ENUM_TIMEFRAMES _period = NULL,
|
ENUM_TIMEFRAMES _period = NULL,
|
||||||
string _sessionsDescriptor = NULL,
|
string _sessionsDescriptor = NULL,
|
||||||
@@ -3020,6 +3023,7 @@ struct XSymbolTradeConfig
|
|||||||
_period = NormalizePeriod(_period);
|
_period = NormalizePeriod(_period);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
name = name;
|
||||||
symbol = _symbol;
|
symbol = _symbol;
|
||||||
period = _period;
|
period = _period;
|
||||||
maxAllowedSpread = _maxAllowedSpread;
|
maxAllowedSpread = _maxAllowedSpread;
|
||||||
@@ -3052,6 +3056,7 @@ struct XSymbolTradeConfig
|
|||||||
// Validate ...
|
// Validate ...
|
||||||
result = IsValid() &&
|
result = IsValid() &&
|
||||||
dest.IsValid() &&
|
dest.IsValid() &&
|
||||||
|
name == dest.name &&
|
||||||
symbol == dest.symbol &&
|
symbol == dest.symbol &&
|
||||||
period == dest.period;
|
period == dest.period;
|
||||||
|
|
||||||
@@ -3067,8 +3072,10 @@ struct XSymbolTradeConfig
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
result = IsSpecifiedValid(symbol) &&
|
result =
|
||||||
IsSpecifiedValid(period);
|
IsSpecifiedValid(name) &&
|
||||||
|
IsSpecifiedValid(symbol) &&
|
||||||
|
IsSpecifiedValid(period);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -3765,6 +3772,7 @@ typedef void (*TOnSignal)(XSignal &signal);
|
|||||||
|
|
||||||
//
|
//
|
||||||
typedef bool (*TCanAnalyse)(
|
typedef bool (*TCanAnalyse)(
|
||||||
|
string name,
|
||||||
string _symbol,
|
string _symbol,
|
||||||
ENUM_TIMEFRAMES _period,
|
ENUM_TIMEFRAMES _period,
|
||||||
datetime _time //
|
datetime _time //
|
||||||
|
|||||||
@@ -56,40 +56,42 @@ class XCXFIMAExpret : public XCBaseExpert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Instantiate Signaller ...
|
// Instantiate Signaller ...
|
||||||
|
if (symbolConfig.name == "XFIMA1")
|
||||||
//
|
|
||||||
// XFIMA Inputs ...
|
|
||||||
|
|
||||||
//
|
|
||||||
XFIMAInputs fimaInputs;
|
|
||||||
fimaInputs.Default();
|
|
||||||
fimaInputs.Hide();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Instantiate Signaller Class ...
|
|
||||||
XCXFIMAStrategy1Signaller *fima1Signaller = new XCXFIMAStrategy1Signaller(
|
|
||||||
symbolConfig.symbol,
|
|
||||||
symbolConfig.period,
|
|
||||||
fimaInputs,
|
|
||||||
false // Process All Ticks ...
|
|
||||||
);
|
|
||||||
if (!fima1Signaller.IsValid())
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
fima1Signaller.Destroy();
|
// XFIMA Inputs ...
|
||||||
delete fima1Signaller;
|
|
||||||
|
//
|
||||||
|
XFIMAInputs fimaInputs;
|
||||||
|
fimaInputs.Default();
|
||||||
|
fimaInputs.Hide();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Instantiate Signaller Class ...
|
||||||
|
XCXFIMAStrategy1Signaller *fima1Signaller = new XCXFIMAStrategy1Signaller(
|
||||||
|
symbolConfig.symbol,
|
||||||
|
symbolConfig.period,
|
||||||
|
fimaInputs,
|
||||||
|
false // Process All Ticks ...
|
||||||
|
);
|
||||||
|
if (!fima1Signaller.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
fima1Signaller.Destroy();
|
||||||
|
delete fima1Signaller;
|
||||||
|
ZeroMemory(fima1Signaller);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Register Signaller ...
|
||||||
|
RegisterSignaller((XCBaseSignaller *)fima1Signaller);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Resources ...
|
||||||
|
fimaInputs.Clean();
|
||||||
ZeroMemory(fima1Signaller);
|
ZeroMemory(fima1Signaller);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Register Signaller ...
|
|
||||||
RegisterSignaller((XCBaseSignaller *)fima1Signaller);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Cleanup Resources ...
|
|
||||||
fimaInputs.Clean();
|
|
||||||
ZeroMemory(fima1Signaller);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -262,14 +262,16 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
|||||||
XOHCL bar;
|
XOHCL bar;
|
||||||
XSignal signal;
|
XSignal signal;
|
||||||
bool has = false;
|
bool has = false;
|
||||||
|
int cIdx = barIndex + 1;
|
||||||
|
int pIdx = cIdx + 1;
|
||||||
ENUM_X_DIRECTION signalDir = X_DIRECTION_NONE;
|
ENUM_X_DIRECTION signalDir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize Bar ...
|
// Initialize Bar as CBar ...
|
||||||
has = bar.Init(
|
has = bar.Init(
|
||||||
symbol,
|
symbol,
|
||||||
period,
|
period,
|
||||||
barIndex //
|
cIdx //
|
||||||
);
|
);
|
||||||
if (!has)
|
if (!has)
|
||||||
{
|
{
|
||||||
@@ -299,6 +301,58 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
|||||||
//
|
//
|
||||||
// Analyse Conditions for Finding Signal ...
|
// Analyse Conditions for Finding Signal ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// TODO: Remove this ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isFastCrossedOverSlow =
|
||||||
|
fimaConditions.maFastBuffer[cIdx] > fimaConditions.maSlowBuffer[cIdx] &&
|
||||||
|
fimaConditions.maFastBuffer[pIdx] < fimaConditions.maSlowBuffer[pIdx];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isFastCrossedUnderSlow =
|
||||||
|
fimaConditions.maFastBuffer[cIdx] < fimaConditions.maSlowBuffer[cIdx] &&
|
||||||
|
fimaConditions.maFastBuffer[pIdx] > fimaConditions.maSlowBuffer[pIdx];
|
||||||
|
|
||||||
|
//
|
||||||
|
has =
|
||||||
|
isFastCrossedOverSlow ||
|
||||||
|
isFastCrossedUnderSlow;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Do Conditions Validating ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Validation ...
|
||||||
|
bool isBullish =
|
||||||
|
//
|
||||||
|
isFastCrossedOverSlow
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Validation ...
|
||||||
|
bool isBearish =
|
||||||
|
//
|
||||||
|
isFastCrossedUnderSlow
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
has =
|
||||||
|
(isBullish && !isBearish) ||
|
||||||
|
(isBearish && !isBullish);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
signalDir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Signal Founded ...
|
// Check Signal Founded ...
|
||||||
has = HasDirection(signalDir);
|
has = HasDirection(signalDir);
|
||||||
|
|||||||
Reference in New Issue
Block a user