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 eaFilterBasedOnDelta = false; // Filter Based On Delta
|
||||||
input bool eaFilterBasedOnVolume = false; // Filter Based On Volume
|
input bool eaFilterBasedOnVolume = false; // Filter Based On Volume
|
||||||
input bool eaFilterBasedOnSignalBar = false; // Filter Based on Signal Bar
|
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
|
input bool eaFilterBasedOnHKSignalBar = false; // Filter Based On HK Signal Bar
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -110,7 +109,7 @@ input double eaConstantBalance = 0.0; // Constant Ba
|
|||||||
//
|
//
|
||||||
// Management ...
|
// Management ...
|
||||||
// eaSymbols => comma separated Symbols for Trading, use Default if not Provided ...
|
// 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 group "Management";
|
||||||
input string eaSymbols = ""; // Allowed Trading Symbols
|
input string eaSymbols = ""; // Allowed Trading Symbols
|
||||||
input bool eaAllowGuards = false; // Allow Guards
|
input bool eaAllowGuards = false; // Allow Guards
|
||||||
@@ -256,7 +255,6 @@ int OnInit()
|
|||||||
eaExpert.eaFilterBasedOnDelta = eaFilterBasedOnDelta;
|
eaExpert.eaFilterBasedOnDelta = eaFilterBasedOnDelta;
|
||||||
eaExpert.eaFilterBasedOnVolume = eaFilterBasedOnVolume;
|
eaExpert.eaFilterBasedOnVolume = eaFilterBasedOnVolume;
|
||||||
eaExpert.eaFilterBasedOnSignalBar = eaFilterBasedOnSignalBar;
|
eaExpert.eaFilterBasedOnSignalBar = eaFilterBasedOnSignalBar;
|
||||||
eaExpert.eaFilterBasedOnRoundPrice = eaFilterBasedOnRoundPrice;
|
|
||||||
eaExpert.eaFilterBasedOnHKSignalBar = eaFilterBasedOnHKSignalBar;
|
eaExpert.eaFilterBasedOnHKSignalBar = eaFilterBasedOnHKSignalBar;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ class XCXCATBEAExpert : public XCBase
|
|||||||
bool eaFilterBasedOnDelta; // Filter Based On Delta
|
bool eaFilterBasedOnDelta; // Filter Based On Delta
|
||||||
bool eaFilterBasedOnVolume; // Filter Based On Volume
|
bool eaFilterBasedOnVolume; // Filter Based On Volume
|
||||||
bool eaFilterBasedOnSignalBar; // Filter Based on Signal Bar
|
bool eaFilterBasedOnSignalBar; // Filter Based on Signal Bar
|
||||||
bool eaFilterBasedOnRoundPrice; // Filter Based On Round Prices
|
|
||||||
bool eaFilterBasedOnHKSignalBar; // Filter Based On HK Signal Bar
|
bool eaFilterBasedOnHKSignalBar; // Filter Based On HK Signal Bar
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -535,7 +534,6 @@ class XCXCATBEAExpert : public XCBase
|
|||||||
iSignallerInputs.filters.filterBasedOnDelta = eaFilterBasedOnDelta;
|
iSignallerInputs.filters.filterBasedOnDelta = eaFilterBasedOnDelta;
|
||||||
iSignallerInputs.filters.filterBasedOnVolume = eaFilterBasedOnVolume;
|
iSignallerInputs.filters.filterBasedOnVolume = eaFilterBasedOnVolume;
|
||||||
iSignallerInputs.filters.filterBasedOnSignalBar = eaFilterBasedOnSignalBar;
|
iSignallerInputs.filters.filterBasedOnSignalBar = eaFilterBasedOnSignalBar;
|
||||||
iSignallerInputs.filters.filterBasedOnRoundPrice = eaFilterBasedOnRoundPrice;
|
|
||||||
iSignallerInputs.filters.filterBasedOnHKSignalBar = eaFilterBasedOnHKSignalBar;
|
iSignallerInputs.filters.filterBasedOnHKSignalBar = eaFilterBasedOnHKSignalBar;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -680,6 +678,10 @@ class XCXCATBEAExpert : public XCBase
|
|||||||
XPosition iPositions[]; // Retrieve Signaller Positions ...
|
XPosition iPositions[]; // Retrieve Signaller Positions ...
|
||||||
XCATBEAStrategyConditions iConditions; // Recieve Triggered Conditions ...
|
XCATBEAStrategyConditions iConditions; // Recieve Triggered Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Active Session ...
|
||||||
|
bool isActiveSession = eaTradeManager.IsActiveSession(iSymbol);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Reading Signaller Positions ...
|
// Reading Signaller Positions ...
|
||||||
eaTradeManager.GetPositions(
|
eaTradeManager.GetPositions(
|
||||||
@@ -694,7 +696,8 @@ class XCXCATBEAExpert : public XCBase
|
|||||||
iSignaller.ProcessTick(
|
iSignaller.ProcessTick(
|
||||||
iPositions,
|
iPositions,
|
||||||
iGuards,
|
iGuards,
|
||||||
iConditions //
|
iConditions,
|
||||||
|
isActiveSession //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -182,7 +182,8 @@ class XCXCATBEASignaller : XCBase
|
|||||||
void ProcessTick(
|
void ProcessTick(
|
||||||
XPosition &positions[],
|
XPosition &positions[],
|
||||||
XGuard &guards[],
|
XGuard &guards[],
|
||||||
XCATBEAStrategyConditions &conditions //
|
XCATBEAStrategyConditions &conditions,
|
||||||
|
bool isActiveSession = true //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -293,6 +294,16 @@ class XCXCATBEASignaller : XCBase
|
|||||||
return;
|
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 ...
|
// Initialize Bar ...
|
||||||
bar.Init(
|
bar.Init(
|
||||||
@@ -504,9 +515,27 @@ class XCXCATBEASignaller : XCBase
|
|||||||
if (result &&
|
if (result &&
|
||||||
conditions.triggerBlock.IsValid())
|
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 ...
|
// 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 ...
|
* Check Signal Execution Conditions ...
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -204,7 +204,6 @@ struct XTriggerBlockFilters
|
|||||||
bool filterBasedOnDelta; // Filter Based On Delta ...
|
bool filterBasedOnDelta; // Filter Based On Delta ...
|
||||||
bool filterBasedOnVolume; // Filter Based On Volume ...
|
bool filterBasedOnVolume; // Filter Based On Volume ...
|
||||||
bool filterBasedOnSignalBar; // Filter Based on Signal Bar ...
|
bool filterBasedOnSignalBar; // Filter Based on Signal Bar ...
|
||||||
bool filterBasedOnRoundPrice; // Filter Based On Round Prices ...
|
|
||||||
bool filterBasedOnHKSignalBar; // Filter Based On HK Signal Bar ...
|
bool filterBasedOnHKSignalBar; // Filter Based On HK Signal Bar ...
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -263,7 +262,6 @@ struct XTriggerBlockFilters
|
|||||||
filterBasedOnDelta = false;
|
filterBasedOnDelta = false;
|
||||||
filterBasedOnVolume = false;
|
filterBasedOnVolume = false;
|
||||||
filterBasedOnSignalBar = false;
|
filterBasedOnSignalBar = false;
|
||||||
filterBasedOnRoundPrice = false;
|
|
||||||
filterBasedOnHKSignalBar = false;
|
filterBasedOnHKSignalBar = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1361,34 +1359,52 @@ bool FilterTriggerBlock(
|
|||||||
iPFSarState >= 0;
|
iPFSarState >= 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Creating Filters ...
|
// Check SAR Direction ...
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isToFilterPassed =
|
if (result &&
|
||||||
!filters.forceSarSwitched
|
!filters.forceSarSwitched)
|
||||||
? (isBullish
|
{
|
||||||
? isSarBullish
|
//
|
||||||
: isSarBearish)
|
result = isBullish
|
||||||
: (isBullish
|
? isSarBullish
|
||||||
? isSarSwitchedToBullish
|
: isSarBearish;
|
||||||
: isSarSwitchedToBearish);
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isFromFilterPassed =
|
if (result &&
|
||||||
!filters.forceSarSwitched
|
filters.forceSarSwitched)
|
||||||
? (isBullish
|
{
|
||||||
? isFSarBullish
|
//
|
||||||
: isFSarBearish)
|
result = isBullish
|
||||||
: (isBullish
|
? isSarSwitchedToBullish
|
||||||
? isFSarSwitchedToBullish
|
: isSarSwitchedToBearish;
|
||||||
: isFSarSwitchedToBearish);
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
if (result &&
|
||||||
!filters.forceSarOnBothSide
|
filters.forceSarOnBothSide)
|
||||||
? isToFilterPassed
|
{
|
||||||
: isToFilterPassed &&
|
//
|
||||||
isFromFilterPassed;
|
if (result &&
|
||||||
|
!filters.forceSarSwitched)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = isBullish
|
||||||
|
? isFSarBullish
|
||||||
|
: isFSarBearish;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result &&
|
||||||
|
filters.forceSarSwitched)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = isBullish
|
||||||
|
? isFSarSwitchedToBullish
|
||||||
|
: isFSarSwitchedToBearish;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Sar Has Reversal Direction inside Trigger Block ...
|
// 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)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user