last ...
This commit is contained in:
@@ -35,20 +35,23 @@ enum ENUM_XCHARTOBJECTS
|
||||
{
|
||||
//
|
||||
// Global ...
|
||||
X_ZONE = 7861,
|
||||
X_FROM_TO = 7862,
|
||||
X_ZONE = 7860,
|
||||
X_FROM_TO = 7861,
|
||||
X_BAR_ARROW = 7862,
|
||||
//
|
||||
X_SIGNAL = 8860
|
||||
//
|
||||
// Structured ...
|
||||
X_TRADE_DAY = 7863,
|
||||
X_MARKET_SESSION = 7864,
|
||||
X_SUPPORT_ZONE = 7865,
|
||||
X_RESISTANCE_ZONE = 7866,
|
||||
X_SUPPLY_ZONE = 7867,
|
||||
X_DEMAND_ZONE = 7868,
|
||||
X_BULLISH_ORDERBLOCK = 7869,
|
||||
X_BEARISH_ORDERBLOCK = 78610,
|
||||
X_BULLISH_FVG = 78611,
|
||||
X_BEARISH_FVG = 78612,
|
||||
X_TRADE_DAY = 9860,
|
||||
X_MARKET_SESSION = 9861,
|
||||
X_SUPPORT_ZONE = 9862,
|
||||
X_RESISTANCE_ZONE = 9863,
|
||||
X_SUPPLY_ZONE = 9864,
|
||||
X_DEMAND_ZONE = 9865,
|
||||
X_BULLISH_ORDERBLOCK = 9866,
|
||||
X_BEARISH_ORDERBLOCK = 9867,
|
||||
X_BULLISH_FVG = 9868,
|
||||
X_BEARISH_FVG = 9869,
|
||||
};
|
||||
|
||||
enum ENUM_X_CHART_IDS
|
||||
@@ -168,6 +171,123 @@ class XCBaseObject : public CChartObject
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// Draw Bar ...
|
||||
class XCBarArrow : public XCBaseObject
|
||||
{
|
||||
//
|
||||
public:
|
||||
//
|
||||
|
||||
//
|
||||
// Constructors ...
|
||||
void XCBarArrow()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Deconstructors ...
|
||||
void ~XCBarArrow()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Create XCBarArrow ...
|
||||
*
|
||||
* @param chart_id: Long ...
|
||||
* @param name: String ...
|
||||
* @param window: Integer ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool Create(
|
||||
long chart_id,
|
||||
const string name,
|
||||
const int window,
|
||||
XOHCL &bar,
|
||||
ENUM_X_PRICE priceType,
|
||||
int arrow //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = bar.IsValid() &&
|
||||
IsValid(name);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double time = bar.time;
|
||||
double price = bar.GetPrice(priceType);
|
||||
|
||||
//
|
||||
result = mArrow.Create(
|
||||
chart_id,
|
||||
name,
|
||||
window,
|
||||
time,
|
||||
price,
|
||||
(char)arrow //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Set Object Name ...
|
||||
ObjName(name);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Object Type ...
|
||||
*
|
||||
* @return ( ENUM_XCHARTOBJECTS )
|
||||
*/
|
||||
virtual ENUM_XCHARTOBJECTS Type()
|
||||
{
|
||||
return X_BAR_ARROW;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Arrow Anchor ...
|
||||
*
|
||||
* @param value: ENUM_ARROW_ANCHOR member ...
|
||||
*/
|
||||
void ArrowAnchor(ENUM_ARROW_ANCHOR value)
|
||||
{
|
||||
mArrow.Anchor(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Arrow Color ...
|
||||
*
|
||||
* @param value: Color ...
|
||||
*/
|
||||
void ArrowColor(color value)
|
||||
{
|
||||
mArrow.Color(value);
|
||||
}
|
||||
|
||||
//
|
||||
protected:
|
||||
//
|
||||
|
||||
//
|
||||
private:
|
||||
//
|
||||
CChartObjectArrow mArrow;
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
// From To Chart Object ...
|
||||
class XCFromToObject : public XCBaseObject
|
||||
@@ -666,7 +786,7 @@ class XCSignalObject : public XCBaseObject
|
||||
|
||||
//
|
||||
// SL ...
|
||||
string slName = ToString(X_TP) + "_" + name;
|
||||
string slName = ToString(X_SL) + "_" + name;
|
||||
result = mSLTrend.Create(
|
||||
chart_id,
|
||||
slName,
|
||||
@@ -830,6 +950,16 @@ class XCSignalObject : public XCBaseObject
|
||||
mEntryTrend.Style(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Object Type ...
|
||||
*
|
||||
* @return ( ENUM_XCHARTOBJECTS )
|
||||
*/
|
||||
virtual ENUM_XCHARTOBJECTS Type()
|
||||
{
|
||||
return X_SIGNAL;
|
||||
}
|
||||
|
||||
//
|
||||
private:
|
||||
//
|
||||
@@ -986,6 +1116,9 @@ class XCMarketSessionObject : public XCFromToObject
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
class XCSwingHighObject : public
|
||||
|
||||
//
|
||||
// Support Zone ...
|
||||
class XCSupportZoneObject : public XCZoneObject
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -56,6 +56,7 @@ struct X121SMCStrategyConditions
|
||||
|
||||
//
|
||||
XOHCL swingHighs[];
|
||||
XOHCL resistances[];
|
||||
XOHCL bearishMomentumBars[];
|
||||
XOHCL bearishRejectionBars[];
|
||||
|
||||
@@ -65,6 +66,7 @@ struct X121SMCStrategyConditions
|
||||
XZone bullishFVG;
|
||||
|
||||
//
|
||||
XOHCL supports[];
|
||||
XOHCL swingLows[];
|
||||
XOHCL bullishMomentumBars[];
|
||||
XOHCL bullishRejectionBars[];
|
||||
@@ -100,11 +102,13 @@ struct X121SMCStrategyConditions
|
||||
|
||||
//
|
||||
Clean(swingHighs);
|
||||
Clean(resistances);
|
||||
Clean(bearishMomentumBars);
|
||||
Clean(bearishRejectionBars);
|
||||
|
||||
//
|
||||
Clean(swingLows);
|
||||
Clean(supports);
|
||||
Clean(bullishMomentumBars);
|
||||
Clean(bullishRejectionBars);
|
||||
}
|
||||
@@ -216,9 +220,36 @@ struct X121SMCStrategyConditions
|
||||
}
|
||||
|
||||
//
|
||||
string GetTag()
|
||||
string GetTag(
|
||||
bool fullTag = false //
|
||||
)
|
||||
{
|
||||
return X121SMCStrategyToken;
|
||||
//
|
||||
string result = NULL;
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (fullTag)
|
||||
{
|
||||
//
|
||||
result = X121SMCStrategyToken + "_" +
|
||||
"Conditions_" +
|
||||
symbol + "_" +
|
||||
ToString(period) + "_" +
|
||||
ToFormatString(time);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = X121SMCStrategyToken;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -151,6 +151,26 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
||||
mR2R = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Max Allowed Spread ...
|
||||
*
|
||||
* @return ( double )
|
||||
*/
|
||||
double MaxAllowedSpread()
|
||||
{
|
||||
return mMaxAllowedSpread;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Max Allowed Spread ...
|
||||
*
|
||||
* @param value: Double ...
|
||||
*/
|
||||
void MaxAllowedSpread(double value)
|
||||
{
|
||||
mMaxAllowedSpread = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Long Signalling State ...
|
||||
*
|
||||
@@ -318,7 +338,8 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
||||
//
|
||||
DrawSignal(
|
||||
signal,
|
||||
conditions);
|
||||
conditions //
|
||||
);
|
||||
|
||||
//
|
||||
// ClearDraws();
|
||||
@@ -479,19 +500,45 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
||||
|
||||
//
|
||||
// Loop through Conditions for Filter Based on POIs ...
|
||||
int removeIDX = -1;
|
||||
int conditionsIDX = -1;
|
||||
for (int i = 0; i < conditionsCount; i++)
|
||||
{
|
||||
//
|
||||
result = false;
|
||||
X121SMCStrategyConditions iConditions = mConditions[i];
|
||||
|
||||
//
|
||||
bool isSpreadPassed = IsSpreadPass();
|
||||
if (!isSpreadPassed)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Longs ...
|
||||
bool isAllowLong = AllowLong();
|
||||
if (isAllowLong)
|
||||
{
|
||||
//
|
||||
hasLong = false;
|
||||
|
||||
//
|
||||
if (hasLong)
|
||||
{
|
||||
//
|
||||
conditionsIDX = i;
|
||||
|
||||
//
|
||||
type = POSITION_TYPE_BUY;
|
||||
entry = GetEntry(mSymbol, type);
|
||||
sl = iConditions.demandZone.lower - (10 * points);
|
||||
risk = entry - sl;
|
||||
reward = risk * r2r;
|
||||
tp = entry + reward;
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -500,18 +547,41 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
||||
if (isAllowShort)
|
||||
{
|
||||
//
|
||||
hasShort = false;
|
||||
|
||||
//
|
||||
if (hasShort)
|
||||
{
|
||||
//
|
||||
conditionsIDX = i;
|
||||
|
||||
//
|
||||
type = POSITION_TYPE_SELL;
|
||||
entry = GetEntry(mSymbol, type);
|
||||
sl = iConditions.supplyZone.upper + (10 * points);
|
||||
risk = sl - entry;
|
||||
reward = risk * r2r;
|
||||
tp = entry - reward;
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = hasLong ||
|
||||
hasShort;
|
||||
|
||||
//
|
||||
// Rmove Signal Condition ...
|
||||
if (result &&
|
||||
IsValidIndex(removeIDX))
|
||||
IsValidIndex(conditionsIDX))
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
mConditions,
|
||||
removeIDX,
|
||||
conditionsIDX,
|
||||
1 //
|
||||
);
|
||||
|
||||
@@ -530,6 +600,10 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
||||
|
||||
//
|
||||
result = PrepareSignal(signal);
|
||||
|
||||
//
|
||||
hasLong = false;
|
||||
hasShort = false;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -568,6 +642,7 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
||||
bool mAllowShort; // Allow Short Signals
|
||||
double mR2R; // Risk/Rewar Ratio ...
|
||||
double mVolume; // Static Volume Per Trades ...
|
||||
double mMaxAllowedSpread; // Max Allowed Spread ...
|
||||
|
||||
//
|
||||
XTick mTicks[]; // Hold Ticks Data ...
|
||||
@@ -634,6 +709,12 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
||||
|
||||
//
|
||||
int length = 5;
|
||||
double pointValue = GetPoints(mSymbol);
|
||||
double maxAllowedSpread = MaxAllowedSpread();
|
||||
if (maxAllowedSpread > 0)
|
||||
{
|
||||
maxAllowedSpread *= pointValue;
|
||||
}
|
||||
|
||||
//
|
||||
int ticksCount = ArraySize(mTicks);
|
||||
@@ -659,15 +740,21 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
||||
|
||||
//
|
||||
end -= 1;
|
||||
double spread = 0;
|
||||
double spreadAVG = 0;
|
||||
for (int i = start; i < end; i++)
|
||||
{
|
||||
spread += mTicks[i].spread;
|
||||
spreadAVG += mTicks[i].spread;
|
||||
}
|
||||
spread /= length;
|
||||
spreadAVG /= length;
|
||||
|
||||
//
|
||||
result = mTicks[ticksCount - 1].spread <= spread;
|
||||
double lastSpread = mTicks[ticksCount - 1].spread;
|
||||
|
||||
//
|
||||
result = lastSpread <= spreadAVG &&
|
||||
(maxAllowedSpread <= 0
|
||||
? true
|
||||
: lastSpread <= maxAllowedSpread);
|
||||
|
||||
//
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user