last ...
This commit is contained in:
@@ -87,7 +87,6 @@ input bool eaForceHasTrendDirOnBothSide = false; // TREND Must Has Following Dir
|
||||
input bool eaFilterBasedOnDelta = false; // Filter Based On Delta
|
||||
input bool eaFilterBasedOnVolume = false; // Filter Based On Volume
|
||||
input bool eaFilterBasedOnSignalBar = false; // Filter Based on Signal Bar
|
||||
input bool eaFilterBasedOnRoundPrice = false; // Filter Based On Round Prices
|
||||
input bool eaFilterBasedOnHKSignalBar = false; // Filter Based On HK Signal Bar
|
||||
|
||||
//
|
||||
@@ -110,7 +109,7 @@ input double eaConstantBalance = 0.0; // Constant Ba
|
||||
//
|
||||
// Management ...
|
||||
// eaSymbols => comma separated Symbols for Trading, use Default if not Provided ...
|
||||
// eaSessions => (SYDNEY_02:00_14:00),(NY_19:00_23:00)
|
||||
// eaSessions => (ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_19:00)
|
||||
input group "Management";
|
||||
input string eaSymbols = ""; // Allowed Trading Symbols
|
||||
input bool eaAllowGuards = false; // Allow Guards
|
||||
@@ -256,7 +255,6 @@ int OnInit()
|
||||
eaExpert.eaFilterBasedOnDelta = eaFilterBasedOnDelta;
|
||||
eaExpert.eaFilterBasedOnVolume = eaFilterBasedOnVolume;
|
||||
eaExpert.eaFilterBasedOnSignalBar = eaFilterBasedOnSignalBar;
|
||||
eaExpert.eaFilterBasedOnRoundPrice = eaFilterBasedOnRoundPrice;
|
||||
eaExpert.eaFilterBasedOnHKSignalBar = eaFilterBasedOnHKSignalBar;
|
||||
|
||||
//
|
||||
|
||||
@@ -96,7 +96,6 @@ class XCXCATBEAExpert : public XCBase
|
||||
bool eaFilterBasedOnDelta; // Filter Based On Delta
|
||||
bool eaFilterBasedOnVolume; // Filter Based On Volume
|
||||
bool eaFilterBasedOnSignalBar; // Filter Based on Signal Bar
|
||||
bool eaFilterBasedOnRoundPrice; // Filter Based On Round Prices
|
||||
bool eaFilterBasedOnHKSignalBar; // Filter Based On HK Signal Bar
|
||||
|
||||
//
|
||||
@@ -535,7 +534,6 @@ class XCXCATBEAExpert : public XCBase
|
||||
iSignallerInputs.filters.filterBasedOnDelta = eaFilterBasedOnDelta;
|
||||
iSignallerInputs.filters.filterBasedOnVolume = eaFilterBasedOnVolume;
|
||||
iSignallerInputs.filters.filterBasedOnSignalBar = eaFilterBasedOnSignalBar;
|
||||
iSignallerInputs.filters.filterBasedOnRoundPrice = eaFilterBasedOnRoundPrice;
|
||||
iSignallerInputs.filters.filterBasedOnHKSignalBar = eaFilterBasedOnHKSignalBar;
|
||||
|
||||
//
|
||||
@@ -680,6 +678,10 @@ class XCXCATBEAExpert : public XCBase
|
||||
XPosition iPositions[]; // Retrieve Signaller Positions ...
|
||||
XCATBEAStrategyConditions iConditions; // Recieve Triggered Conditions ...
|
||||
|
||||
//
|
||||
// Check Active Session ...
|
||||
bool isActiveSession = eaTradeManager.IsActiveSession(iSymbol);
|
||||
|
||||
//
|
||||
// Reading Signaller Positions ...
|
||||
eaTradeManager.GetPositions(
|
||||
@@ -694,7 +696,8 @@ class XCXCATBEAExpert : public XCBase
|
||||
iSignaller.ProcessTick(
|
||||
iPositions,
|
||||
iGuards,
|
||||
iConditions //
|
||||
iConditions,
|
||||
isActiveSession //
|
||||
);
|
||||
|
||||
//
|
||||
|
||||
@@ -182,7 +182,8 @@ class XCXCATBEASignaller : XCBase
|
||||
void ProcessTick(
|
||||
XPosition &positions[],
|
||||
XGuard &guards[],
|
||||
XCATBEAStrategyConditions &conditions //
|
||||
XCATBEAStrategyConditions &conditions,
|
||||
bool isActiveSession = true //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -293,6 +294,16 @@ class XCXCATBEASignaller : XCBase
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Here we Check Active Session ...
|
||||
// and Prevent Moving forward if there is not
|
||||
// Session actives ...
|
||||
// for improvement Calculation Speeds ...
|
||||
if (!isActiveSession)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize Bar ...
|
||||
bar.Init(
|
||||
@@ -504,9 +515,27 @@ class XCXCATBEASignaller : XCBase
|
||||
if (result &&
|
||||
conditions.triggerBlock.IsValid())
|
||||
{
|
||||
//
|
||||
// Checking Score ...
|
||||
double bullishScore = 0;
|
||||
double bearishScore = 0;
|
||||
conditions
|
||||
.conditions
|
||||
.GenerateScore(
|
||||
bullishScore,
|
||||
bearishScore //
|
||||
);
|
||||
bool isScorePassed =
|
||||
isBullish
|
||||
? bullishScore > bearishScore
|
||||
: bearishScore > bullishScore;
|
||||
|
||||
//
|
||||
// Complete Conditions Here ...
|
||||
conditions.triggerTime = TimeCurrent();
|
||||
if (isScorePassed)
|
||||
{
|
||||
conditions.triggerTime = TimeCurrent();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -1296,6 +1296,42 @@ class XCXCATBEATradeManager : public XCBaseAlert
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Specified Symbol is Active for
|
||||
* Analysing or Open Trades ...
|
||||
*/
|
||||
bool IsActiveSession(string symbol)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate Args ...
|
||||
result = IsValid(symbol);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Symbol Session Exists or not ...
|
||||
int symbolSessionIDX = -1;
|
||||
bool isSymbolSessionExists = FindSymbolSession(
|
||||
symbolSessionIDX,
|
||||
symbol //
|
||||
);
|
||||
|
||||
//
|
||||
// Chack Trade Session Validating ...
|
||||
if (isSymbolSessionExists)
|
||||
{
|
||||
result = sessions[symbolSessionIDX].CanTrade();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Signal Execution Conditions ...
|
||||
*
|
||||
|
||||
@@ -204,7 +204,6 @@ struct XTriggerBlockFilters
|
||||
bool filterBasedOnDelta; // Filter Based On Delta ...
|
||||
bool filterBasedOnVolume; // Filter Based On Volume ...
|
||||
bool filterBasedOnSignalBar; // Filter Based on Signal Bar ...
|
||||
bool filterBasedOnRoundPrice; // Filter Based On Round Prices ...
|
||||
bool filterBasedOnHKSignalBar; // Filter Based On HK Signal Bar ...
|
||||
|
||||
//
|
||||
@@ -263,7 +262,6 @@ struct XTriggerBlockFilters
|
||||
filterBasedOnDelta = false;
|
||||
filterBasedOnVolume = false;
|
||||
filterBasedOnSignalBar = false;
|
||||
filterBasedOnRoundPrice = false;
|
||||
filterBasedOnHKSignalBar = false;
|
||||
|
||||
//
|
||||
@@ -1361,34 +1359,52 @@ bool FilterTriggerBlock(
|
||||
iPFSarState >= 0;
|
||||
|
||||
//
|
||||
// Creating Filters ...
|
||||
// Check SAR Direction ...
|
||||
|
||||
//
|
||||
bool isToFilterPassed =
|
||||
!filters.forceSarSwitched
|
||||
? (isBullish
|
||||
? isSarBullish
|
||||
: isSarBearish)
|
||||
: (isBullish
|
||||
? isSarSwitchedToBullish
|
||||
: isSarSwitchedToBearish);
|
||||
if (result &&
|
||||
!filters.forceSarSwitched)
|
||||
{
|
||||
//
|
||||
result = isBullish
|
||||
? isSarBullish
|
||||
: isSarBearish;
|
||||
}
|
||||
|
||||
//
|
||||
bool isFromFilterPassed =
|
||||
!filters.forceSarSwitched
|
||||
? (isBullish
|
||||
? isFSarBullish
|
||||
: isFSarBearish)
|
||||
: (isBullish
|
||||
? isFSarSwitchedToBullish
|
||||
: isFSarSwitchedToBearish);
|
||||
if (result &&
|
||||
filters.forceSarSwitched)
|
||||
{
|
||||
//
|
||||
result = isBullish
|
||||
? isSarSwitchedToBullish
|
||||
: isSarSwitchedToBearish;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
!filters.forceSarOnBothSide
|
||||
? isToFilterPassed
|
||||
: isToFilterPassed &&
|
||||
isFromFilterPassed;
|
||||
if (result &&
|
||||
filters.forceSarOnBothSide)
|
||||
{
|
||||
//
|
||||
if (result &&
|
||||
!filters.forceSarSwitched)
|
||||
{
|
||||
//
|
||||
result = isBullish
|
||||
? isFSarBullish
|
||||
: isFSarBearish;
|
||||
}
|
||||
|
||||
//
|
||||
if (result &&
|
||||
filters.forceSarSwitched)
|
||||
{
|
||||
//
|
||||
result = isBullish
|
||||
? isFSarSwitchedToBullish
|
||||
: isFSarSwitchedToBearish;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check Sar Has Reversal Direction inside Trigger Block ...
|
||||
@@ -2262,15 +2278,6 @@ bool FilterTriggerBlock(
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Filter Based Round Price ...
|
||||
if (result &&
|
||||
filters.filterBasedOnRoundPrice)
|
||||
{
|
||||
//
|
||||
// TODO: Implement this ...
|
||||
}
|
||||
|
||||
//
|
||||
if (!result)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user