last works on XOSCS ...
This commit is contained in:
@@ -62,4 +62,451 @@ XCAlert *eaAlert;
|
||||
XCTrade *eaTrade;
|
||||
|
||||
//
|
||||
XCX121XSTRHelper *strHelper;
|
||||
XSignal eaSignal;
|
||||
XCXSTRCCISignaller *eaSignaller;
|
||||
XSTRCCIStrategyConditions eaConditions;
|
||||
|
||||
//
|
||||
int eaMaxAllowedPositions = 5;
|
||||
double eaMaxAllowedSpread = 25;
|
||||
double eaMaxAllowedDrawdownFactor = 0.3;
|
||||
|
||||
//
|
||||
string eaTag = "";
|
||||
|
||||
//
|
||||
// Event Handlers ...
|
||||
|
||||
//
|
||||
// Initialization ...
|
||||
int OnInit()
|
||||
{
|
||||
//
|
||||
// Validate Inputs and Required Parameters
|
||||
// for EA to Works fine ...
|
||||
if (!ValidateInputs())
|
||||
{
|
||||
return INIT_PARAMETERS_INCORRECT;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize Timer ...
|
||||
if (!InitTimer())
|
||||
{
|
||||
return INIT_FAILED;
|
||||
}
|
||||
|
||||
//
|
||||
// Initial Requirements ...
|
||||
InitRequirements();
|
||||
|
||||
//
|
||||
// Init Succeed ...
|
||||
return INIT_SUCCEEDED;
|
||||
}
|
||||
|
||||
//
|
||||
// DeInitialization ...
|
||||
void OnDeinit(const int reason)
|
||||
{
|
||||
//
|
||||
// REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function
|
||||
// REASON_REMOVE 1 Program removed from a chart
|
||||
// REASON_RECOMPILE 2 Program recompiled
|
||||
// REASON_CHARTCHANGE 3 A symbol or a chart period is changed
|
||||
// REASON_CHARTCLOSE 4 Chart closed
|
||||
// REASON_PARAMETERS 5 Inputs changed by a user
|
||||
// REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings
|
||||
// REASON_TEMPLATE 7 Another chart template applied
|
||||
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
|
||||
// REASON_CLOSE 9 Terminal closed
|
||||
|
||||
//
|
||||
// Destroy Timer ...
|
||||
}
|
||||
|
||||
//
|
||||
// On Tick Handler ...
|
||||
void OnTick()
|
||||
{
|
||||
//
|
||||
int idx = -1;
|
||||
int count = 0;
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
eaSignal.Clean();
|
||||
eaConditions.Clean();
|
||||
|
||||
//
|
||||
double sl = 0;
|
||||
double tp = 0;
|
||||
double r2r = 5;
|
||||
double risk = 0;
|
||||
double entry = 0;
|
||||
double reward = 0;
|
||||
double volume = 0.01;
|
||||
string provider = "XSTRCCI";
|
||||
ENUM_POSITION_TYPE type = POSITION_TYPE_BUY;
|
||||
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
||||
|
||||
//
|
||||
bool hasLong = false;
|
||||
bool hasShort = false;
|
||||
|
||||
//
|
||||
double selectedSL = 0;
|
||||
|
||||
//
|
||||
// Start Calculations ...
|
||||
|
||||
//
|
||||
// Retrieve Common Data ...
|
||||
string symbol = eaSignaller.GetSymbol();
|
||||
ENUM_TIMEFRAMES period = eaSignaller.GetPeriod();
|
||||
|
||||
//
|
||||
datetime cTime = TimeCurrent();
|
||||
|
||||
//
|
||||
// Required Value For SL/TP Calculations ...
|
||||
double points = GetPoints(symbol);
|
||||
double pip = GetPipPrice(symbol);
|
||||
double pip2 = 2 * pip;
|
||||
|
||||
//
|
||||
has = eaSignaller.DetectSignalSetup(
|
||||
r2r,
|
||||
300 // Max Allowed SL Distance ...
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = eaSignaller
|
||||
.AddConditionsIfNotExists();
|
||||
|
||||
//
|
||||
eaSignaller.mConditions.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Check Setuped Conditions Exists ...
|
||||
count = ArraySize(eaSignaller.mConditionsCollection);
|
||||
has = IsValidSize(count);
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
has = eaSignaller
|
||||
.DetectSignalTrigger(eaSignaller
|
||||
.mConditionsCollection[i]);
|
||||
|
||||
//
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
idx = i;
|
||||
eaConditions = eaSignaller.mConditionsCollection[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
has = IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
eaSignaller.mConditionsCollection,
|
||||
idx,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Check EA Conditions is Valid or not ...
|
||||
has = eaConditions.IsSetuped() &&
|
||||
eaConditions.CanTrigger();
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
eaConditions.Clean();
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Trigger Direction ...
|
||||
hasLong = eaConditions.HasBullishSignal();
|
||||
hasShort = eaConditions.HasBearishSignal();
|
||||
has = hasLong ||
|
||||
hasShort;
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
eaConditions.Clean();
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Preparing Signal ...
|
||||
//
|
||||
eaSignal.sl = sl;
|
||||
eaSignal.tp = tp;
|
||||
eaSignal.type = type;
|
||||
eaSignal.mode = mode;
|
||||
eaSignal.entry = entry;
|
||||
eaSignal.volume = volume;
|
||||
eaSignal.symbol = symbol;
|
||||
eaSignal.period = period;
|
||||
eaSignal.provider = provider;
|
||||
eaSignal.time = TimeCurrent();
|
||||
|
||||
//
|
||||
Copy(
|
||||
eaConditions.targets,
|
||||
eaSignal.targets //
|
||||
);
|
||||
|
||||
//
|
||||
has = eaSignal.IsValid();
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
eaSignal.Clean();
|
||||
eaConditions.Clean();
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Signal ...
|
||||
|
||||
//
|
||||
// Execute Signal ...
|
||||
|
||||
//
|
||||
Print("Execute Signal ...");
|
||||
|
||||
//
|
||||
eaSignal.Clean();
|
||||
eaConditions.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Handle On Trade Event ...
|
||||
void OnTrade()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// On Timer ...
|
||||
void OnTimer()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Chart Event Handler ...
|
||||
void OnChartEvent(
|
||||
const int id,
|
||||
const long &lparam,
|
||||
const double &dparam,
|
||||
const string &sparam //
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Event Listeners ...
|
||||
|
||||
/**
|
||||
* Handle StopLoss Triggered Positions ...
|
||||
*
|
||||
* @param deal: XDeal instance ...
|
||||
*/
|
||||
void OnStopLossTriggered(const XDeal &deal)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Take Profit Triggered Positions ...
|
||||
*
|
||||
* @param deal: XDeal instance ...
|
||||
*/
|
||||
void OnTakeProfitTriggered(const XDeal &deal)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Force Close a Position ...
|
||||
*
|
||||
* @param ticket: ULONG ...
|
||||
* @param position: XPosition instance ...
|
||||
* @param comment: String ...
|
||||
*/
|
||||
void OnPositionForceClosed(
|
||||
const ulong ticket,
|
||||
const XPosition &position,
|
||||
const string comment //
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Deals Changes ...
|
||||
*
|
||||
* @param count: Integer, Number of Changes ...
|
||||
*/
|
||||
void OnDealsChanged(int count)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Orders Changes ...
|
||||
*
|
||||
* @param count: Integer, Number of Changes ...
|
||||
*/
|
||||
void OnOrdersChanged(int count)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle Positions Changes ...
|
||||
*
|
||||
* @param count: Integer, Number of Changes ...
|
||||
*/
|
||||
void OnPositionsChanged(int count)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Custom Functions ...
|
||||
|
||||
/**
|
||||
* Validate all Inputs of Expert Adviser ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool ValidateInputs()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
string errMessage = "";
|
||||
|
||||
//
|
||||
bool isCommonValid = (
|
||||
//
|
||||
eaSlippage > 0 &&
|
||||
eaMagicNumber > 0
|
||||
//
|
||||
);
|
||||
if (!isCommonValid)
|
||||
{
|
||||
//
|
||||
errMessage += "common configurations error;" + "\n";
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
// Common ...
|
||||
isCommonValid &&
|
||||
//
|
||||
// Otere ...
|
||||
true
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
// Since here Logger not Initiallized, we Use Raw Print Command ...
|
||||
Print(ShortName + " Errors: \n", errMessage);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize Timer ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool InitTimer()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// TODO: Initialize Timer if necessary ...
|
||||
// result = EventSetTimer(1);
|
||||
// result = EventSetMillisecondTimer(100);
|
||||
result = true;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy Timer ...
|
||||
*/
|
||||
void DestroyTimer()
|
||||
{
|
||||
//
|
||||
// TODO: Use This ...
|
||||
// EventKillTimer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial Requirements of EA ...
|
||||
*
|
||||
*/
|
||||
void InitRequirements()
|
||||
{
|
||||
//
|
||||
// Preparing Tags ...
|
||||
eaTag =
|
||||
(IsValid(eaLogSuffix)
|
||||
? eaLogSuffix + "_"
|
||||
: "") +
|
||||
ShortName;
|
||||
|
||||
//
|
||||
// EA Alert ...
|
||||
eaAlert = new XCAlert(
|
||||
eaTag,
|
||||
eaEnableAlerts,
|
||||
eaLogAlerts,
|
||||
eaTerminalAlerts,
|
||||
eaMailAlerts,
|
||||
eaPushAlerts //
|
||||
);
|
||||
|
||||
//
|
||||
// EA Trade ...
|
||||
eaTrade = new XCTrade(
|
||||
eaSlippage,
|
||||
eaMagicNumber,
|
||||
eaMaxAllowedSpread,
|
||||
eaMaxAllowedPositions,
|
||||
eaMaxAllowedDrawdownFactor //
|
||||
);
|
||||
|
||||
//
|
||||
// EA Signaller ...
|
||||
eaSignaller = new XCXSTRCCISignaller(
|
||||
_Symbol,
|
||||
_Period //
|
||||
);
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,12 +38,10 @@ enum ENUM_X121_XSTR_BUFFERS
|
||||
X121_XSTR_DOWN_LINE = 3,
|
||||
X121_XSTR_HSM_LINE = 4,
|
||||
X121_XSTR_LSM_LINE = 5,
|
||||
X121_XSTR_MID_LINE = 6,
|
||||
X121_XSTR_MID_STATE_LINE = 7,
|
||||
X121_XSTR_XVIDYA_LINE = 8,
|
||||
X121_XSTR_ATR_LINE = 9,
|
||||
X121_XSTR_PRICE_LINE = 10,
|
||||
X121_XSTR_STATE_LINE = 11,
|
||||
X121_XSTR_XVIDYA_LINE = 6,
|
||||
X121_XSTR_ATR_LINE = 7,
|
||||
X121_XSTR_PRICE_LINE = 8,
|
||||
X121_XSTR_STATE_LINE = 9,
|
||||
};
|
||||
|
||||
//
|
||||
@@ -63,7 +61,6 @@ struct X121XSTRInputs
|
||||
//
|
||||
bool showStr; // Show Str
|
||||
bool showVidya; // Show Vidya
|
||||
bool showStrMid; // Show Str Mid
|
||||
bool showStrUpper; // Show Str Upper
|
||||
bool showStrLower; // Show Str Lower
|
||||
bool showStrSMLow; // Show Str SM Low
|
||||
@@ -95,7 +92,6 @@ struct X121XSTRInputs
|
||||
//
|
||||
showStr = false;
|
||||
showVidya = false;
|
||||
showStrMid = false;
|
||||
showStrUpper = false;
|
||||
showStrLower = false;
|
||||
showStrSMLow = false;
|
||||
@@ -120,7 +116,6 @@ struct X121XSTRInputs
|
||||
//
|
||||
showStr = true;
|
||||
showVidya = true;
|
||||
showStrMid = true;
|
||||
showStrUpper = true;
|
||||
showStrLower = true;
|
||||
showStrSMLow = true;
|
||||
@@ -177,17 +172,18 @@ struct X121XSTRConditions
|
||||
double atrBuffer[];
|
||||
double vidyaBuffer[];
|
||||
double strUpBuffer[];
|
||||
double strMidBuffer[];
|
||||
double strDownBuffer[];
|
||||
double strPriceBuffer[];
|
||||
double strStateBuffer[];
|
||||
double strSMLowBuffer[];
|
||||
double strSMHighBuffer[];
|
||||
double strMidStateBuffer[];
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
// STR ...
|
||||
|
||||
//
|
||||
bool isStrBullish;
|
||||
bool isStrBearish;
|
||||
@@ -196,6 +192,91 @@ struct X121XSTRConditions
|
||||
bool isStrSwitchedToBullish;
|
||||
bool isStrSwitchedToBearish;
|
||||
|
||||
//
|
||||
// VIDYA ...
|
||||
|
||||
//
|
||||
bool isRejectUpVidya;
|
||||
bool isClosedOverVidya;
|
||||
bool isCrossedOverVidya;
|
||||
|
||||
//
|
||||
bool isRejectDownVidya;
|
||||
bool isCloseUnderVidya;
|
||||
bool isCrossedUnderVidya;
|
||||
|
||||
//
|
||||
// HMS ...
|
||||
|
||||
//
|
||||
bool isRejectUpLSM;
|
||||
bool isCloseOverLSM;
|
||||
bool isCrossedOverLSM;
|
||||
|
||||
//
|
||||
bool isRejectDownLSM;
|
||||
bool isCloseUnderLSM;
|
||||
bool isCrossedUnderLSM;
|
||||
|
||||
//
|
||||
// HSM ..
|
||||
|
||||
//
|
||||
bool isRejectUpHSM;
|
||||
bool isCloseOverHSM;
|
||||
bool isCrossedOverHSM;
|
||||
|
||||
//
|
||||
bool isRejectDownHSM;
|
||||
bool isCloseUnderHSM;
|
||||
bool isCrossedUnderHSM;
|
||||
|
||||
//
|
||||
// STR ...
|
||||
|
||||
//
|
||||
bool isRejectUpStr;
|
||||
bool isCloseOverStr;
|
||||
bool isCrossedOverStr;
|
||||
|
||||
//
|
||||
bool isRejectDownStr;
|
||||
bool isCloseUnderStr;
|
||||
bool isCrossedUnderStr;
|
||||
|
||||
//
|
||||
// HSM / ViDYA ...
|
||||
|
||||
//
|
||||
bool isVidyaOverHSM;
|
||||
bool isVidyaCrossedOverHSM;
|
||||
|
||||
//
|
||||
bool isVidyaUnderHSM;
|
||||
bool isVidyaCrossedUnderHSM;
|
||||
|
||||
//
|
||||
// LSM / VIDYA ...
|
||||
|
||||
//
|
||||
bool isVidyaOverLSM;
|
||||
bool isVidyaCrossedOverLSM;
|
||||
|
||||
//
|
||||
bool isVidyaUnderLSM;
|
||||
bool isVidyaCrossedUnderLSM;
|
||||
|
||||
//
|
||||
// STR / VIDYA ...
|
||||
|
||||
//
|
||||
bool isVidyaOverStr;
|
||||
bool isVidyaCrossedOverStr;
|
||||
|
||||
//
|
||||
bool isVidyaUnderStr;
|
||||
bool isVidyaCrossedUnderStr;
|
||||
|
||||
//
|
||||
// bool isCloseLower
|
||||
|
||||
@@ -228,35 +309,64 @@ struct X121XSTRConditions
|
||||
Clean(atrBuffer);
|
||||
Clean(vidyaBuffer);
|
||||
Clean(strUpBuffer);
|
||||
Clean(strMidBuffer);
|
||||
Clean(strDownBuffer);
|
||||
Clean(strPriceBuffer);
|
||||
Clean(strStateBuffer);
|
||||
Clean(strSMLowBuffer);
|
||||
Clean(strSMHighBuffer);
|
||||
Clean(strMidStateBuffer);
|
||||
|
||||
//
|
||||
ArraySetAsSeries(strBuffer, true);
|
||||
ArraySetAsSeries(atrBuffer, true);
|
||||
ArraySetAsSeries(vidyaBuffer, true);
|
||||
ArraySetAsSeries(strUpBuffer, true);
|
||||
ArraySetAsSeries(strMidBuffer, true);
|
||||
ArraySetAsSeries(strDownBuffer, true);
|
||||
ArraySetAsSeries(strPriceBuffer, true);
|
||||
ArraySetAsSeries(strStateBuffer, true);
|
||||
ArraySetAsSeries(strSMLowBuffer, true);
|
||||
ArraySetAsSeries(strSMHighBuffer, true);
|
||||
ArraySetAsSeries(strMidStateBuffer, true);
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
isStrBullish = false;
|
||||
isStrBearish = false;
|
||||
|
||||
//
|
||||
isRejectUpLSM = false;
|
||||
isRejectUpHSM = false;
|
||||
isRejectUpStr = false;
|
||||
isCloseOverHSM = false;
|
||||
isCloseOverLSM = false;
|
||||
isCloseOverStr = false;
|
||||
isVidyaOverHSM = false;
|
||||
isVidyaOverLSM = false;
|
||||
isVidyaOverStr = false;
|
||||
isRejectDownLSM = false;
|
||||
isRejectDownHSM = false;
|
||||
isVidyaUnderStr = false;
|
||||
isVidyaUnderHSM = false;
|
||||
isVidyaUnderLSM = false;
|
||||
isCloseUnderStr = false;
|
||||
isRejectDownStr = false;
|
||||
isRejectUpVidya = false;
|
||||
isCloseUnderHSM = false;
|
||||
isCloseUnderLSM = false;
|
||||
isCrossedOverLSM = false;
|
||||
isCrossedOverHSM = false;
|
||||
isCrossedOverStr = false;
|
||||
isCrossedUnderHSM = false;
|
||||
isCrossedUnderLSM = false;
|
||||
isCrossedUnderStr = false;
|
||||
isClosedOverVidya = false;
|
||||
isRejectDownVidya = false;
|
||||
isCloseUnderVidya = false;
|
||||
isCrossedOverVidya = false;
|
||||
isCrossedUnderVidya = false;
|
||||
isVidyaCrossedOverHSM = false;
|
||||
isVidyaCrossedOverStr = false;
|
||||
isVidyaCrossedOverLSM = false;
|
||||
isVidyaCrossedUnderHSM = false;
|
||||
isVidyaCrossedUnderLSM = false;
|
||||
isVidyaCrossedUnderStr = false;
|
||||
isStrSwitchedToBullish = false;
|
||||
isStrSwitchedToBearish = false;
|
||||
|
||||
@@ -293,6 +403,78 @@ struct X121XSTRConditions
|
||||
{
|
||||
bullishScore += score;
|
||||
}
|
||||
if (isRejectUpVidya)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isClosedOverVidya)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isCrossedOverVidya)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isRejectUpLSM)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isCloseOverLSM)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isCrossedOverLSM)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isRejectUpHSM)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isCloseOverHSM)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isCrossedOverHSM)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isRejectUpStr)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isCloseOverStr)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isCrossedOverStr)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isVidyaOverHSM)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isVidyaCrossedOverHSM)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isVidyaOverLSM)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isVidyaCrossedOverLSM)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isVidyaOverStr)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
if (isVidyaCrossedOverStr)
|
||||
{
|
||||
bullishScore += minScore;
|
||||
}
|
||||
|
||||
//
|
||||
if (isStrBearish)
|
||||
@@ -303,6 +485,78 @@ struct X121XSTRConditions
|
||||
{
|
||||
bearishScore += score;
|
||||
}
|
||||
if (isRejectDownVidya)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isCloseUnderVidya)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isCrossedUnderVidya)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isRejectDownLSM)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isCloseUnderLSM)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isCrossedUnderLSM)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isRejectDownHSM)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isCloseUnderHSM)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isCrossedUnderHSM)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isRejectDownStr)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isCloseUnderStr)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isCrossedUnderStr)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isVidyaUnderHSM)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isVidyaCrossedUnderHSM)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isVidyaUnderLSM)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isVidyaCrossedUnderLSM)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isVidyaUnderStr)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
if (isVidyaCrossedUnderStr)
|
||||
{
|
||||
bearishScore += minScore;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -363,6 +617,42 @@ struct X121XSTRConditions
|
||||
ToString("isStrBearish", isStrBearish, ignoreFalseConditions, separator) +
|
||||
ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) +
|
||||
ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) +
|
||||
ToString("isRejectUpVidya", isRejectUpVidya, ignoreFalseConditions, separator) +
|
||||
ToString("isClosedOverVidya", isClosedOverVidya, ignoreFalseConditions, separator) +
|
||||
ToString("isCrossedOverVidya", isCrossedOverVidya, ignoreFalseConditions, separator) +
|
||||
ToString("isRejectDownVidya", isRejectDownVidya, ignoreFalseConditions, separator) +
|
||||
ToString("isCloseUnderVidya", isCloseUnderVidya, ignoreFalseConditions, separator) +
|
||||
ToString("isCrossedUnderVidya", isCrossedUnderVidya, ignoreFalseConditions, separator) +
|
||||
ToString("isRejectUpLSM", isRejectUpLSM, ignoreFalseConditions, separator) +
|
||||
ToString("isCloseOverLSM", isCloseOverLSM, ignoreFalseConditions, separator) +
|
||||
ToString("isCrossedOverLSM", isCrossedOverLSM, ignoreFalseConditions, separator) +
|
||||
ToString("isRejectDownLSM", isRejectDownLSM, ignoreFalseConditions, separator) +
|
||||
ToString("isCloseUnderLSM", isCloseUnderLSM, ignoreFalseConditions, separator) +
|
||||
ToString("isCrossedUnderLSM", isCrossedUnderLSM, ignoreFalseConditions, separator) +
|
||||
ToString("isRejectUpHSM", isRejectUpHSM, ignoreFalseConditions, separator) +
|
||||
ToString("isCloseOverHSM", isCloseOverHSM, ignoreFalseConditions, separator) +
|
||||
ToString("isCrossedOverHSM", isCrossedOverHSM, ignoreFalseConditions, separator) +
|
||||
ToString("isRejectDownHSM", isRejectDownHSM, ignoreFalseConditions, separator) +
|
||||
ToString("isCloseUnderHSM", isCloseUnderHSM, ignoreFalseConditions, separator) +
|
||||
ToString("isCrossedUnderHSM", isCrossedUnderHSM, ignoreFalseConditions, separator) +
|
||||
ToString("isRejectUpStr", isRejectUpStr, ignoreFalseConditions, separator) +
|
||||
ToString("isCloseOverStr", isCloseOverStr, ignoreFalseConditions, separator) +
|
||||
ToString("isCrossedOverStr", isCrossedOverStr, ignoreFalseConditions, separator) +
|
||||
ToString("isRejectDownStr", isRejectDownStr, ignoreFalseConditions, separator) +
|
||||
ToString("isCloseUnderStr", isCloseUnderStr, ignoreFalseConditions, separator) +
|
||||
ToString("isCrossedUnderStr", isCrossedUnderStr, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaOverHSM", isVidyaOverHSM, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaCrossedOverHSM", isVidyaCrossedOverHSM, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaUnderHSM", isVidyaUnderHSM, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaCrossedUnderHSM", isVidyaCrossedUnderHSM, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaOverLSM", isVidyaOverLSM, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaCrossedOverLSM", isVidyaCrossedOverLSM, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaUnderLSM", isVidyaUnderLSM, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaCrossedUnderLSM", isVidyaCrossedUnderLSM, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaOverStr", isVidyaOverStr, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaCrossedOverStr", isVidyaCrossedOverStr, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaUnderStr", isVidyaUnderStr, ignoreFalseConditions, separator) +
|
||||
ToString("isVidyaCrossedUnderStr", isVidyaCrossedUnderStr, ignoreFalseConditions, separator) +
|
||||
//
|
||||
""
|
||||
//
|
||||
@@ -463,13 +753,11 @@ class XCX121XSTRHelper : public XCBaseHelper
|
||||
ArraySetAsSeries(atrBuffer, true);
|
||||
ArraySetAsSeries(vidyaBuffer, true);
|
||||
ArraySetAsSeries(strUpBuffer, true);
|
||||
ArraySetAsSeries(strMidBuffer, true);
|
||||
ArraySetAsSeries(strDownBuffer, true);
|
||||
ArraySetAsSeries(strPriceBuffer, true);
|
||||
ArraySetAsSeries(strStateBuffer, true);
|
||||
ArraySetAsSeries(strSMLowBuffer, true);
|
||||
ArraySetAsSeries(strSMHighBuffer, true);
|
||||
ArraySetAsSeries(strMidStateBuffer, true);
|
||||
|
||||
//
|
||||
mInputs = inputs;
|
||||
@@ -495,7 +783,6 @@ class XCX121XSTRHelper : public XCBaseHelper
|
||||
"",
|
||||
mInputs.showStr,
|
||||
mInputs.showVidya,
|
||||
mInputs.showStrMid,
|
||||
mInputs.showStrUpper,
|
||||
mInputs.showStrLower,
|
||||
mInputs.showStrSMLow,
|
||||
@@ -740,104 +1027,6 @@ class XCX121XSTRHelper : public XCBaseHelper
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double GetSTRMid(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate(barIndex);
|
||||
|
||||
//
|
||||
int count = ArraySize(strMidBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return strMidBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopySTRMid(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate(start);
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
0,
|
||||
count,
|
||||
strMidBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double GetSTRMidState(
|
||||
int barIndex // Bar Index
|
||||
)
|
||||
{
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
Calculate(barIndex);
|
||||
|
||||
//
|
||||
int count = ArraySize(strMidStateBuffer);
|
||||
if (barIndex >= count)
|
||||
{
|
||||
barIndex = count - 1;
|
||||
}
|
||||
|
||||
//
|
||||
return strMidStateBuffer[barIndex];
|
||||
}
|
||||
|
||||
//
|
||||
int CopySTRMidState(
|
||||
int start, // Start
|
||||
int count, // Number of Items for read
|
||||
double &buffer[], // Dest Buffer
|
||||
bool forceClean = true // Force To Clean buffer
|
||||
)
|
||||
{
|
||||
//
|
||||
// Update Calculations ...
|
||||
Calculate(start);
|
||||
|
||||
//
|
||||
// Copy Items ...
|
||||
return Copy(
|
||||
0,
|
||||
count,
|
||||
strMidStateBuffer,
|
||||
buffer,
|
||||
forceClean
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double GetSTRPrice(
|
||||
int barIndex // Bar Index
|
||||
@@ -1239,20 +1428,6 @@ class XCX121XSTRHelper : public XCBaseHelper
|
||||
conditions.strStateBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopySTRMid(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.strMidBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopySTRMidState(
|
||||
zIndex,
|
||||
loopback,
|
||||
conditions.strMidStateBuffer //
|
||||
);
|
||||
|
||||
//
|
||||
CopySTRPrice(
|
||||
zIndex,
|
||||
@@ -1295,6 +1470,9 @@ class XCX121XSTRHelper : public XCBaseHelper
|
||||
int cIDX = 1;
|
||||
int pIDX = cIDX + 1;
|
||||
|
||||
//
|
||||
// STR ...
|
||||
|
||||
//
|
||||
bool isStrBullish = strStateBuffer[cIDX] > 0;
|
||||
bool isStrBullishPrev = strStateBuffer[pIDX] > 0;
|
||||
@@ -1309,9 +1487,202 @@ class XCX121XSTRHelper : public XCBaseHelper
|
||||
bool isStrSwitchedToBearish = isStrBearish &&
|
||||
!isStrBearishPrev;
|
||||
|
||||
//
|
||||
// VIDYA ...
|
||||
|
||||
//
|
||||
bool isRejectUpVidya = cBar.IsRejected(
|
||||
vidyaBuffer[cIDX],
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
|
||||
//
|
||||
bool isClosedOverVidya = cBar.close > vidyaBuffer[cIDX];
|
||||
bool isClosedOverVidyaPrev = pBar.close > vidyaBuffer[pIDX];
|
||||
bool isCrossedOverVidya = isClosedOverVidya &&
|
||||
!isClosedOverVidyaPrev;
|
||||
|
||||
//
|
||||
bool isRejectDownVidya = cBar.IsRejected(
|
||||
vidyaBuffer[cIDX],
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
|
||||
//
|
||||
bool isCloseUnderVidya = cBar.close < vidyaBuffer[cIDX];
|
||||
bool isCloseUnderVidyaPrev = pBar.close < vidyaBuffer[pIDX];
|
||||
bool isCrossedUnderVidya = isCloseUnderVidya &&
|
||||
!isCloseUnderVidyaPrev;
|
||||
|
||||
//
|
||||
// LMS ...
|
||||
|
||||
//
|
||||
bool isRejectUpLSM = cBar.IsRejected(
|
||||
strSMLowBuffer[cIDX],
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
|
||||
//
|
||||
bool isCloseOverLSM = cBar.close > strSMLowBuffer[cIDX];
|
||||
bool isCloseOverLSMPrev = pBar.close > strSMLowBuffer[pIDX];
|
||||
bool isCrossedOverLSM = isCloseOverLSM &&
|
||||
!isCloseOverLSMPrev;
|
||||
|
||||
//
|
||||
bool isRejectDownLSM = cBar.IsRejected(
|
||||
strSMLowBuffer[cIDX],
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
|
||||
//
|
||||
bool isCloseUnderLSM = cBar.close < strSMLowBuffer[cIDX];
|
||||
bool isCloseUnderLSMPrev = pBar.close < strSMLowBuffer[pIDX];
|
||||
bool isCrossedUnderLSM = isCloseUnderLSM &&
|
||||
!isCloseUnderLSMPrev;
|
||||
|
||||
//
|
||||
// HSM ..
|
||||
|
||||
//
|
||||
bool isRejectUpHSM = cBar.IsRejected(
|
||||
strSMHighBuffer[cIDX],
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
|
||||
//
|
||||
bool isCloseOverHSM = cBar.close > strSMHighBuffer[cIDX];
|
||||
bool isCloseOverHSMPrev = pBar.close > strSMHighBuffer[pIDX];
|
||||
bool isCrossedOverHSM = isCloseOverHSM &&
|
||||
!isCloseOverHSMPrev;
|
||||
|
||||
//
|
||||
bool isRejectDownHSM = cBar.IsRejected(
|
||||
strSMHighBuffer[cIDX],
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
|
||||
//
|
||||
bool isCloseUnderHSM = cBar.close > strSMHighBuffer[cIDX];
|
||||
bool isCloseUnderHSMPrev = pBar.close > strSMHighBuffer[pIDX];
|
||||
bool isCrossedUnderHSM = isCloseUnderHSM &&
|
||||
!isCloseUnderHSMPrev;
|
||||
|
||||
//
|
||||
// STR ...
|
||||
|
||||
//
|
||||
bool isRejectUpStr = cBar.IsRejected(
|
||||
strBuffer[cIDX],
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
|
||||
//
|
||||
bool isCloseOverStr = cBar.close > strBuffer[cIDX];
|
||||
bool isCloseOverStrPrev = pBar.close > strBuffer[pIDX];
|
||||
bool isCrossedOverStr = isCloseOverStr &&
|
||||
!isCloseOverStrPrev;
|
||||
|
||||
//
|
||||
bool isRejectDownStr = cBar.IsRejected(
|
||||
strBuffer[cIDX],
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
|
||||
//
|
||||
bool isCloseUnderStr = cBar.close < strBuffer[cIDX];
|
||||
bool isCloseUnderStrPrev = pBar.close < strBuffer[pIDX];
|
||||
bool isCrossedUnderStr = isCloseUnderStr &&
|
||||
!isCloseUnderStrPrev;
|
||||
|
||||
//
|
||||
// HSM / ViDYA ...
|
||||
|
||||
//
|
||||
bool isVidyaOverHSM = vidyaBuffer[cIDX] > strSMHighBuffer[cIDX];
|
||||
bool isVidyaOverHSMPrev = vidyaBuffer[pIDX] > strSMHighBuffer[pIDX];
|
||||
bool isVidyaCrossedOverHSM = isVidyaOverHSM &&
|
||||
!isVidyaOverHSMPrev;
|
||||
|
||||
//
|
||||
bool isVidyaUnderHSM = vidyaBuffer[cIDX] < strSMHighBuffer[cIDX];
|
||||
bool isVidyaUnderHSMPrev = vidyaBuffer[pIDX] < strSMHighBuffer[pIDX];
|
||||
bool isVidyaCrossedUnderHSM = isVidyaUnderHSM &&
|
||||
!isVidyaUnderHSMPrev;
|
||||
|
||||
//
|
||||
// LSM / VIDYA ...
|
||||
|
||||
//
|
||||
bool isVidyaOverLSM = vidyaBuffer[cIDX] > strSMLowBuffer[cIDX];
|
||||
bool isVidyaOverLSMPrev = vidyaBuffer[pIDX] > strSMLowBuffer[pIDX];
|
||||
bool isVidyaCrossedOverLSM = isVidyaOverLSM &&
|
||||
!isVidyaOverLSMPrev;
|
||||
|
||||
//
|
||||
bool isVidyaUnderLSM = vidyaBuffer[cIDX] < strSMLowBuffer[cIDX];
|
||||
bool isVidyaUnderLSMPrev = vidyaBuffer[pIDX] < strSMLowBuffer[pIDX];
|
||||
bool isVidyaCrossedUnderLSM = isVidyaUnderLSM &&
|
||||
!isVidyaUnderLSMPrev;
|
||||
|
||||
//
|
||||
// STR / VIDYA ...
|
||||
|
||||
//
|
||||
bool isVidyaOverStr = vidyaBuffer[cIDX] > strBuffer[cIDX];
|
||||
bool isVidyaOverStrPrev = vidyaBuffer[pIDX] > strBuffer[pIDX];
|
||||
bool isVidyaCrossedOverStr = isVidyaOverStr &&
|
||||
!isVidyaOverStrPrev;
|
||||
|
||||
//
|
||||
bool isVidyaUnderStr = vidyaBuffer[cIDX] < strBuffer[cIDX];
|
||||
bool isVidyaUnderStrPrev = vidyaBuffer[pIDX] < strBuffer[pIDX];
|
||||
bool isVidyaCrossedUnderStr = isVidyaUnderStr &&
|
||||
!isVidyaUnderStrPrev;
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
conditions.isStrBullish = isStrBullish;
|
||||
conditions.isStrBearish = isStrBearish;
|
||||
conditions.isRejectUpLSM = isRejectUpLSM;
|
||||
conditions.isRejectUpHSM = isRejectUpHSM;
|
||||
conditions.isRejectUpStr = isRejectUpStr;
|
||||
conditions.isCloseOverHSM = isCloseOverHSM;
|
||||
conditions.isCloseOverLSM = isCloseOverLSM;
|
||||
conditions.isCloseOverStr = isCloseOverStr;
|
||||
conditions.isVidyaOverHSM = isVidyaOverHSM;
|
||||
conditions.isVidyaOverLSM = isVidyaOverLSM;
|
||||
conditions.isVidyaOverStr = isVidyaOverStr;
|
||||
conditions.isRejectDownLSM = isRejectDownLSM;
|
||||
conditions.isRejectDownHSM = isRejectDownHSM;
|
||||
conditions.isVidyaUnderStr = isVidyaUnderStr;
|
||||
conditions.isVidyaUnderHSM = isVidyaUnderHSM;
|
||||
conditions.isVidyaUnderLSM = isVidyaUnderLSM;
|
||||
conditions.isCloseUnderStr = isCloseUnderStr;
|
||||
conditions.isRejectDownStr = isRejectDownStr;
|
||||
conditions.isRejectUpVidya = isRejectUpVidya;
|
||||
conditions.isCloseUnderHSM = isCloseUnderHSM;
|
||||
conditions.isCloseUnderLSM = isCloseUnderLSM;
|
||||
conditions.isCrossedOverLSM = isCrossedOverLSM;
|
||||
conditions.isCrossedOverHSM = isCrossedOverHSM;
|
||||
conditions.isCrossedOverStr = isCrossedOverStr;
|
||||
conditions.isCrossedUnderHSM = isCrossedUnderHSM;
|
||||
conditions.isCrossedUnderLSM = isCrossedUnderLSM;
|
||||
conditions.isCrossedUnderStr = isCrossedUnderStr;
|
||||
conditions.isClosedOverVidya = isClosedOverVidya;
|
||||
conditions.isRejectDownVidya = isRejectDownVidya;
|
||||
conditions.isCloseUnderVidya = isCloseUnderVidya;
|
||||
conditions.isCrossedOverVidya = isCrossedOverVidya;
|
||||
conditions.isCrossedUnderVidya = isCrossedUnderVidya;
|
||||
conditions.isVidyaCrossedOverHSM = isVidyaCrossedOverHSM;
|
||||
conditions.isVidyaCrossedOverStr = isVidyaCrossedOverStr;
|
||||
conditions.isVidyaCrossedOverLSM = isVidyaCrossedOverLSM;
|
||||
conditions.isVidyaCrossedUnderHSM = isVidyaCrossedUnderHSM;
|
||||
conditions.isVidyaCrossedUnderLSM = isVidyaCrossedUnderLSM;
|
||||
conditions.isVidyaCrossedUnderStr = isVidyaCrossedUnderStr;
|
||||
conditions.isStrSwitchedToBullish = isStrSwitchedToBullish;
|
||||
conditions.isStrSwitchedToBearish = isStrSwitchedToBearish;
|
||||
|
||||
@@ -1343,13 +1714,11 @@ class XCX121XSTRHelper : public XCBaseHelper
|
||||
double atrBuffer[];
|
||||
double vidyaBuffer[];
|
||||
double strUpBuffer[];
|
||||
double strMidBuffer[];
|
||||
double strDownBuffer[];
|
||||
double strPriceBuffer[];
|
||||
double strStateBuffer[];
|
||||
double strSMLowBuffer[];
|
||||
double strSMHighBuffer[];
|
||||
double strMidStateBuffer[];
|
||||
|
||||
//
|
||||
void Calculate(
|
||||
@@ -1397,26 +1766,6 @@ class XCX121XSTRHelper : public XCBaseHelper
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
X121_XSTR_MID_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
strMidBuffer
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
CopyBuffer(
|
||||
mHandler,
|
||||
X121_XSTR_MID_STATE_LINE,
|
||||
barIndex,
|
||||
maxRequiredBars,
|
||||
strMidStateBuffer
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
// Price ...
|
||||
CopyBuffer(
|
||||
@@ -1513,12 +1862,6 @@ class XCX121XSTRHelper : public XCBaseHelper
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
strMidBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
strDownBuffer,
|
||||
@@ -1548,12 +1891,6 @@ class XCX121XSTRHelper : public XCBaseHelper
|
||||
strSMHighBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
CleanupArray(
|
||||
strMidStateBuffer,
|
||||
maxAllowed //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -46,7 +46,6 @@ input ENUM_APPLIED_PRICE vidyaAppliedTo = PRICE_CLOSE; // Smoothing Applied To
|
||||
input group "Presentation";
|
||||
input bool showStr = true; // Show Str
|
||||
input bool showVidya = true; // Show Vidya
|
||||
input bool showStrMid = true; // Show Str Mid
|
||||
input bool showStrUpper = true; // Show Str Upper
|
||||
input bool showStrLower = true; // Show Str Lower
|
||||
input bool showStrLowMa = true; // Show Low Smoothed Buffer
|
||||
@@ -68,8 +67,8 @@ input bool showStrHighMa = true; // Show High Smoothed Buffer
|
||||
#property indicator_chart_window
|
||||
|
||||
//
|
||||
#property indicator_buffers 12
|
||||
#property indicator_plots 7
|
||||
#property indicator_buffers 10
|
||||
#property indicator_plots 6
|
||||
|
||||
//
|
||||
// STR ...
|
||||
@@ -139,40 +138,24 @@ double strLowMaBuffer[];
|
||||
#property indicator_style5 STYLE_SOLID
|
||||
#property indicator_width5 1
|
||||
|
||||
//
|
||||
// STR Mmid ...
|
||||
#define strMidBufferIndex 6
|
||||
double strMidBuffer[];
|
||||
|
||||
#define strMidColorBufferIndex 7
|
||||
double strMidColorBuffer[];
|
||||
|
||||
//
|
||||
#define strMidPlotBufferIndex 5
|
||||
#property indicator_label6 "X121 STR Mid"
|
||||
#property indicator_type6 DRAW_COLOR_LINE
|
||||
#property indicator_color6 CLR_NONE, clrLime, clrRed, clrGray
|
||||
#property indicator_style6 STYLE_SOLID
|
||||
#property indicator_width6 1
|
||||
|
||||
//
|
||||
// VIDYA ...
|
||||
#define vidyaBufferIndex 8
|
||||
#define vidyaBufferIndex 6
|
||||
double vidyaBuffer[];
|
||||
|
||||
//
|
||||
#define vidyaPlotBufferIndex 6
|
||||
#property indicator_label7 "X121 VIDYA"
|
||||
#property indicator_type7 DRAW_LINE
|
||||
#property indicator_color7 clrYellow
|
||||
#property indicator_style7 STYLE_SOLID
|
||||
#property indicator_width7 1
|
||||
#define vidyaPlotBufferIndex 5
|
||||
#property indicator_label6 "X121 VIDYA"
|
||||
#property indicator_type6 DRAW_LINE
|
||||
#property indicator_color6 clrYellow
|
||||
#property indicator_style6 STYLE_SOLID
|
||||
#property indicator_width6 1
|
||||
|
||||
//
|
||||
// Data Buffers ...
|
||||
|
||||
//
|
||||
int mLastBufferIndex = 8;
|
||||
int mLastBufferIndex = 6;
|
||||
|
||||
//
|
||||
// STR ...
|
||||
@@ -577,14 +560,6 @@ void DefineBuffers()
|
||||
PlotIndexSetInteger(vidyaPlotBufferIndex, PLOT_SHOW_DATA, showVidya);
|
||||
PlotIndexSetInteger(vidyaPlotBufferIndex, PLOT_DRAW_TYPE, vidyaDrawType);
|
||||
|
||||
//
|
||||
ENUM_DRAW_TYPE strMidDrawType = showStrMid ? DRAW_COLOR_LINE : DRAW_NONE;
|
||||
SetIndexBuffer(strMidBufferIndex, strMidBuffer, INDICATOR_DATA);
|
||||
SetIndexBuffer(strMidColorBufferIndex, strMidColorBuffer, INDICATOR_COLOR_INDEX);
|
||||
PlotIndexSetDouble(strMidPlotBufferIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||
PlotIndexSetInteger(strMidPlotBufferIndex, PLOT_SHOW_DATA, showStrMid);
|
||||
PlotIndexSetInteger(strMidPlotBufferIndex, PLOT_DRAW_TYPE, strMidDrawType);
|
||||
|
||||
//
|
||||
// Data Buffers ...
|
||||
|
||||
@@ -650,8 +625,6 @@ void FillBuffersZero(int barIndex)
|
||||
// STR ...
|
||||
strBuffer[barIndex] = emptyValue;
|
||||
strUpBuffer[barIndex] = emptyValue;
|
||||
strMidBuffer[barIndex] = emptyValue;
|
||||
strMidBuffer[barIndex] = emptyValue;
|
||||
strDownBuffer[barIndex] = emptyValue;
|
||||
strPriceBuffer[barIndex] = emptyValue;
|
||||
strLowMaBuffer[barIndex] = emptyValue;
|
||||
@@ -832,15 +805,6 @@ void CalculateStr(
|
||||
|
||||
//
|
||||
double iStrMid = strDownBuffer[bar_index] + ((strUpBuffer[bar_index] - strDownBuffer[bar_index]) / 2);
|
||||
strMidBuffer[bar_index] = iStrMid;
|
||||
|
||||
//
|
||||
double iStrColor = close[bar_index] > strMidBuffer[bar_index]
|
||||
? bullishColorIDX
|
||||
: close[bar_index] < strMidBuffer[bar_index]
|
||||
? bearishColorIDX
|
||||
: neuturalColorIDX;
|
||||
strMidColorBuffer[bar_index] = iStrColor;
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
+1392
-21
File diff suppressed because it is too large
Load Diff
@@ -22,8 +22,400 @@
|
||||
//
|
||||
// Imports ...
|
||||
#include "../../Libraries/x-saherelm.common.lib.mq5"
|
||||
#include "../../Libraries/x-saherelm.x-poi.lib.mq5"
|
||||
#include "../../Libraries/x-saherelm.x-trade.lib.mq5"
|
||||
|
||||
//
|
||||
// Enumeration ...
|
||||
|
||||
//
|
||||
// Guard Actions ...
|
||||
enum ENUM_GUARD_ACTIONS
|
||||
{
|
||||
X_GUARD_ACTION_NONE, // Nothing to Do
|
||||
X_GUARD_ACTION_CLOSE, // Close Specified Position
|
||||
X_GUARD_ACTION_CLOSE_ALL, // Close All Positions
|
||||
X_GUARD_ACTION_CLOSE_LONGS, // Close All Long Positions
|
||||
X_GUARD_ACTION_CLOSE_SHORTS, // Close All Short Position
|
||||
X_GUARD_ACTION_PARTIAL_CLOSE, // Partial Close Specified Position
|
||||
X_GUARD_ACTION_TRAIL_STOP, // Trail Stop of Specified Position
|
||||
X_GUARD_ACTION_TRAIL_TARGET, // Trail Target of Specified Position
|
||||
X_GUARD_ACTION_HEDGE, // Hedge Specified Positions
|
||||
};
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
//
|
||||
// Conditions Struct ...
|
||||
struct XSTRCCIStrategyConditions
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
string symbol;
|
||||
ENUM_TIMEFRAMES period;
|
||||
|
||||
//
|
||||
// Setup Props ...
|
||||
|
||||
//
|
||||
double sl;
|
||||
double tp;
|
||||
double pivot;
|
||||
double point;
|
||||
double sls[];
|
||||
string provider;
|
||||
double targets[];
|
||||
|
||||
//
|
||||
datetime time;
|
||||
datetime setupTime;
|
||||
datetime triggerTime;
|
||||
|
||||
//
|
||||
XBoxZone signalBox;
|
||||
ENUM_X_DIRECTION dir;
|
||||
ENUM_X_POSITION_TYPES type;
|
||||
ENUM_X_DIRECTION signalDir;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XSTRCCIStrategyConditions()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Cleaning Up ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
sl = 0;
|
||||
tp = 0;
|
||||
pivot = 0;
|
||||
point = 0;
|
||||
|
||||
//
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
provider = NULL;
|
||||
|
||||
//
|
||||
time = NULL;
|
||||
setupTime = NULL;
|
||||
triggerTime = NULL;
|
||||
|
||||
//
|
||||
Clean(sls);
|
||||
Clean(targets);
|
||||
|
||||
//
|
||||
signalBox.Clean();
|
||||
|
||||
//
|
||||
dir = X_DIRECTION_NONE;
|
||||
type = X_POSITION_TYPE_NONE;
|
||||
signalDir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// Signalling ...
|
||||
|
||||
/**
|
||||
* Validate ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsValid()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsSpecifiedValid(symbol) &&
|
||||
IsSpecifiedValid(period) &&
|
||||
IsSpecifiedValid(time);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Conditions Has Valid Bullish Signal ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasBullishSignal()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
(sl > 0 ||
|
||||
tp > 0) &&
|
||||
IsValid() &&
|
||||
HasDirection(signalDir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
IsBullish(signalDir);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Conditions Has Valid Bearish Signal ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasBearishSignal()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
(sl > 0 ||
|
||||
tp > 0) &&
|
||||
IsValid() &&
|
||||
HasDirection(signalDir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
IsBearish(signalDir);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Setting Up and Triggering Up ...
|
||||
|
||||
/**
|
||||
* Check Condition is Setting Up ...
|
||||
*
|
||||
* @param dir: ENUM_X_DIRECTION member, Setting Up Direction ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsSetuped()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsValid(setupTime) &&
|
||||
HasDirection(dir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate Setup Age ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int GetSetupAge()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!IsSetuped())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = (int)(TimeCurrent() - setupTime) / PeriodSeconds(period);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect How we Can Trigger Signal ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool CanTrigger()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
sl > 0 &&
|
||||
IsValid(symbol) &&
|
||||
IsValid(period) &&
|
||||
IsValid(triggerTime) &&
|
||||
type != X_POSITION_TYPE_ALL &&
|
||||
type != X_POSITION_TYPE_NONE
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Model a Guard Action ...
|
||||
struct XSTRCCIGuard
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
ENUM_GUARD_ACTIONS action;
|
||||
datetime time;
|
||||
|
||||
//
|
||||
string symbol;
|
||||
string provider;
|
||||
|
||||
//
|
||||
// Specified Position ...
|
||||
ulong ticket;
|
||||
|
||||
//
|
||||
// Partial Close ...
|
||||
double volumeMultiplier;
|
||||
|
||||
//
|
||||
// SL Trial ...
|
||||
double sl;
|
||||
|
||||
//
|
||||
// TP Trial ...
|
||||
double tp;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XSTRCCIGuard()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Cleanup ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
time = NULL;
|
||||
action = X_GUARD_ACTION_NONE;
|
||||
|
||||
//
|
||||
symbol = NULL;
|
||||
provider = NULL;
|
||||
|
||||
//
|
||||
ticket = 0;
|
||||
|
||||
//
|
||||
volumeMultiplier = 0;
|
||||
|
||||
//
|
||||
sl = 0;
|
||||
tp = 0;
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsValid()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsValid(time) &&
|
||||
IsValid(symbol) &&
|
||||
IsValid(provider) &&
|
||||
action != X_GUARD_ACTION_NONE
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Model Based On Specified Guard Actions ...
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Add Guard to Collection ...
|
||||
*
|
||||
* @param guard: XSTRCCIGuard instance ...
|
||||
* @param guards: XSTRCCIGuard instance Collection ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int AddGuard(
|
||||
XSTRCCIGuard &guard,
|
||||
XSTRCCIGuard &guards[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (!guard.IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
AddRef(
|
||||
guard,
|
||||
guards //
|
||||
);
|
||||
|
||||
//
|
||||
result = ArraySize(guards);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -22,6 +22,7 @@
|
||||
//
|
||||
// Imports ...
|
||||
#include "../../Classes/x-saherelm.base.class.mq5"
|
||||
#include "../../Classes/x-saherelm.x-cobject.class.mq5"
|
||||
#include "../Helpers/xstrcci.helper.mq5"
|
||||
#include "../Libraries/xstrcci.signaller.lib.mq5"
|
||||
|
||||
@@ -35,25 +36,340 @@ class XCXSTRCCISignaller : XCBase
|
||||
public:
|
||||
//
|
||||
// Props ...
|
||||
bool useGuards;
|
||||
double rfReward;
|
||||
bool isPassedBoxes;
|
||||
XSTRCCIInputs inputs;
|
||||
XCXSTRCCIHelper *helper;
|
||||
bool continuesRFTillTarget;
|
||||
XSTRCCIStrategyConditions mConditions;
|
||||
XSTRCCIStrategyConditions mConditionsCollection[];
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XCXSTRCCISignaller()
|
||||
XCXSTRCCISignaller(
|
||||
string _symbol,
|
||||
ENUM_TIMEFRAMES _period //
|
||||
)
|
||||
{
|
||||
//
|
||||
symbol = _symbol;
|
||||
period = _period;
|
||||
Init();
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
~XCXSTRCCISignaller()
|
||||
{
|
||||
DeInit();
|
||||
}
|
||||
|
||||
//
|
||||
// Properties ...
|
||||
|
||||
string GetSymbol()
|
||||
{
|
||||
return symbol;
|
||||
}
|
||||
|
||||
ENUM_TIMEFRAMES GetPeriod()
|
||||
{
|
||||
return period;
|
||||
}
|
||||
|
||||
//
|
||||
// Signaller Tools ...
|
||||
|
||||
/**
|
||||
* Detect Setup Conditions based on Signalling ...
|
||||
*
|
||||
* @param maxAllowedSLDistanceInPoint: int, Max Allowed SL Distance in Points (if Bigger thn Zero Provided) ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectSignalSetup(
|
||||
double tpReward = 3,
|
||||
double maxAllowedSLDistanceInPoint = 300 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Trigger Conditions for Specified Signal ...
|
||||
*
|
||||
* @param conditions: XSTRCCIStrategyConditions instance Reference, Specified Signal Conditions ...
|
||||
* @param maxAllowedSetupAge: specified Setup Age for Expiration (if bigger than Zero) ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectSignalTrigger(
|
||||
XSTRCCIStrategyConditions &conditions,
|
||||
int maxAllowedSetupAge = 60 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = conditions.IsSetuped();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
datetime setupTime = conditions.setupTime;
|
||||
ENUM_X_DIRECTION setupDir = conditions.dir;
|
||||
|
||||
//
|
||||
bool isBullish = IsBullish(setupDir);
|
||||
bool isBearish = IsBearish(setupDir);
|
||||
|
||||
//
|
||||
int zIndex = 0;
|
||||
int cIndex = zIndex + 1;
|
||||
int pIndex = cIndex + 1;
|
||||
int ppIndex = pIndex + 1;
|
||||
|
||||
//
|
||||
int loopback = 10;
|
||||
|
||||
//
|
||||
double ask = GetAsk(symbol);
|
||||
double bid = GetBid(symbol);
|
||||
datetime cTime = TimeCurrent();
|
||||
double points = GetPoints(symbol);
|
||||
|
||||
//
|
||||
// Check Signal Validation ...
|
||||
// IMPORTANT: since all Validations done in SetUp Process ...
|
||||
// here we only Execute Signal ...
|
||||
|
||||
//
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
conditions.triggerTime = cTime;
|
||||
conditions.type = isBullish
|
||||
? X_POSITION_TYPE_LONG
|
||||
: X_POSITION_TYPE_SHORT;
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup ...
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Guards bsed on Signalling Class ...
|
||||
*
|
||||
* @param guards: XSTRCCIGuard instance Collection, Holds Provided Guards ...
|
||||
* @param positions: XPosition instance Collection, Provides Signalling Based Positions for Apply Guards on them ...
|
||||
* @param provider: X121SMCStrategySignalProviderData instance Reference, Specified Data for Cycles ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectGuards(
|
||||
XSTRCCIGuard &guards[],
|
||||
const XPosition &positions[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Conditions to Conditions Collection if not Exists ...
|
||||
*
|
||||
* @param maxAllowed: int, Specified Max Allowed Holding Conditions ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int AddConditionsIfNotExists(
|
||||
int maxAllowed = 10 //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
bool isSetuped = IsValid(mConditions.setupTime) &&
|
||||
HasDirection(mConditions.dir);
|
||||
if (!isSetuped)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(mConditionsCollection);
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
// Copy Original Items ...
|
||||
XSTRCCIStrategyConditions tmpItems[];
|
||||
Copy(
|
||||
mConditionsCollection,
|
||||
tmpItems //
|
||||
);
|
||||
|
||||
//
|
||||
// Prese Item Data ...
|
||||
bool isBullish = IsBullish(mConditions.dir);
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XSTRCCIStrategyConditions iItem = tmpItems[i];
|
||||
|
||||
//
|
||||
bool canRemove = mConditions.dir == iItem.dir &&
|
||||
mConditions.pivot == iItem.pivot;
|
||||
if (canRemove)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
mConditionsCollection,
|
||||
i,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Clean(tmpItems);
|
||||
}
|
||||
|
||||
//
|
||||
AddRef(
|
||||
mConditions,
|
||||
mConditionsCollection //
|
||||
);
|
||||
|
||||
//
|
||||
// Remove Olds ...
|
||||
CleanupArray(
|
||||
mConditionsCollection,
|
||||
maxAllowed //
|
||||
);
|
||||
|
||||
//
|
||||
result = ArraySize(mConditionsCollection);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
//
|
||||
|
||||
//
|
||||
// Private ...
|
||||
private:
|
||||
//
|
||||
// Props ...
|
||||
string symbol;
|
||||
ENUM_TIMEFRAMES period;
|
||||
CArrayObj mObjects;
|
||||
CArrayObj mBarObjects;
|
||||
|
||||
/**
|
||||
* Initialize ...
|
||||
*/
|
||||
void Init()
|
||||
{
|
||||
//
|
||||
rfReward = 2;
|
||||
useGuards = false;
|
||||
isPassedBoxes = false;
|
||||
continuesRFTillTarget = true;
|
||||
|
||||
//
|
||||
inputs.Default();
|
||||
|
||||
//
|
||||
// Configure Indicators ...
|
||||
|
||||
//
|
||||
// XCC ...
|
||||
inputs.ccInputs.showCandles = true;
|
||||
|
||||
//
|
||||
// XCT ...
|
||||
inputs.ctInputs.showCandleTime = true;
|
||||
|
||||
//
|
||||
// XSTR ...
|
||||
inputs.strInputs.showStr = true;
|
||||
inputs.strInputs.showVidya = true;
|
||||
inputs.strInputs.showStrUpper = false;
|
||||
inputs.strInputs.showStrLower = false;
|
||||
inputs.strInputs.showStrSMLow = true;
|
||||
inputs.strInputs.showStrSMHigh = true;
|
||||
|
||||
//
|
||||
// XOSCS ...
|
||||
inputs.oscsInputs.rsiLength = 5;
|
||||
inputs.oscsInputs.mfiLength = 5;
|
||||
inputs.oscsInputs.rviLength = 5;
|
||||
inputs.oscsInputs.cciLength = 5;
|
||||
|
||||
//
|
||||
// Oscillators Views ...
|
||||
inputs.showCCI = false;
|
||||
inputs.showRSI = false;
|
||||
inputs.showMFI = false;
|
||||
inputs.showRVI = false;
|
||||
inputs.showMACD = false;
|
||||
|
||||
//
|
||||
// XSTRCCI Helper ...
|
||||
helper = new XCXSTRCCIHelper();
|
||||
helper.Init(
|
||||
symbol,
|
||||
period,
|
||||
inputs //
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* DeInitialize ...
|
||||
*/
|
||||
void DeInit()
|
||||
{
|
||||
//
|
||||
inputs.Clean();
|
||||
ZeroMemory(helper);
|
||||
|
||||
//
|
||||
mConditions.Clean();
|
||||
Clean(mConditionsCollection);
|
||||
|
||||
//
|
||||
mObjects.Clear();
|
||||
mBarObjects.Clear();
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user