last ...
This commit is contained in:
@@ -35,20 +35,23 @@ enum ENUM_XCHARTOBJECTS
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Global ...
|
// Global ...
|
||||||
X_ZONE = 7861,
|
X_ZONE = 7860,
|
||||||
X_FROM_TO = 7862,
|
X_FROM_TO = 7861,
|
||||||
|
X_BAR_ARROW = 7862,
|
||||||
//
|
//
|
||||||
// Structured ...
|
X_SIGNAL = 8860
|
||||||
X_TRADE_DAY = 7863,
|
//
|
||||||
X_MARKET_SESSION = 7864,
|
// Structured ...
|
||||||
X_SUPPORT_ZONE = 7865,
|
X_TRADE_DAY = 9860,
|
||||||
X_RESISTANCE_ZONE = 7866,
|
X_MARKET_SESSION = 9861,
|
||||||
X_SUPPLY_ZONE = 7867,
|
X_SUPPORT_ZONE = 9862,
|
||||||
X_DEMAND_ZONE = 7868,
|
X_RESISTANCE_ZONE = 9863,
|
||||||
X_BULLISH_ORDERBLOCK = 7869,
|
X_SUPPLY_ZONE = 9864,
|
||||||
X_BEARISH_ORDERBLOCK = 78610,
|
X_DEMAND_ZONE = 9865,
|
||||||
X_BULLISH_FVG = 78611,
|
X_BULLISH_ORDERBLOCK = 9866,
|
||||||
X_BEARISH_FVG = 78612,
|
X_BEARISH_ORDERBLOCK = 9867,
|
||||||
|
X_BULLISH_FVG = 9868,
|
||||||
|
X_BEARISH_FVG = 9869,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ENUM_X_CHART_IDS
|
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 ...
|
// From To Chart Object ...
|
||||||
class XCFromToObject : public XCBaseObject
|
class XCFromToObject : public XCBaseObject
|
||||||
@@ -666,7 +786,7 @@ class XCSignalObject : public XCBaseObject
|
|||||||
|
|
||||||
//
|
//
|
||||||
// SL ...
|
// SL ...
|
||||||
string slName = ToString(X_TP) + "_" + name;
|
string slName = ToString(X_SL) + "_" + name;
|
||||||
result = mSLTrend.Create(
|
result = mSLTrend.Create(
|
||||||
chart_id,
|
chart_id,
|
||||||
slName,
|
slName,
|
||||||
@@ -830,6 +950,16 @@ class XCSignalObject : public XCBaseObject
|
|||||||
mEntryTrend.Style(value);
|
mEntryTrend.Style(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Object Type ...
|
||||||
|
*
|
||||||
|
* @return ( ENUM_XCHARTOBJECTS )
|
||||||
|
*/
|
||||||
|
virtual ENUM_XCHARTOBJECTS Type()
|
||||||
|
{
|
||||||
|
return X_SIGNAL;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
@@ -987,8 +1117,11 @@ class XCMarketSessionObject : public XCFromToObject
|
|||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Support Zone ...
|
class XCSwingHighObject : public
|
||||||
class XCSupportZoneObject : public XCZoneObject
|
|
||||||
|
//
|
||||||
|
// Support Zone ...
|
||||||
|
class XCSupportZoneObject : public XCZoneObject
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -56,6 +56,7 @@ struct X121SMCStrategyConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
XOHCL swingHighs[];
|
XOHCL swingHighs[];
|
||||||
|
XOHCL resistances[];
|
||||||
XOHCL bearishMomentumBars[];
|
XOHCL bearishMomentumBars[];
|
||||||
XOHCL bearishRejectionBars[];
|
XOHCL bearishRejectionBars[];
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ struct X121SMCStrategyConditions
|
|||||||
XZone bullishFVG;
|
XZone bullishFVG;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
XOHCL supports[];
|
||||||
XOHCL swingLows[];
|
XOHCL swingLows[];
|
||||||
XOHCL bullishMomentumBars[];
|
XOHCL bullishMomentumBars[];
|
||||||
XOHCL bullishRejectionBars[];
|
XOHCL bullishRejectionBars[];
|
||||||
@@ -100,11 +102,13 @@ struct X121SMCStrategyConditions
|
|||||||
|
|
||||||
//
|
//
|
||||||
Clean(swingHighs);
|
Clean(swingHighs);
|
||||||
|
Clean(resistances);
|
||||||
Clean(bearishMomentumBars);
|
Clean(bearishMomentumBars);
|
||||||
Clean(bearishRejectionBars);
|
Clean(bearishRejectionBars);
|
||||||
|
|
||||||
//
|
//
|
||||||
Clean(swingLows);
|
Clean(swingLows);
|
||||||
|
Clean(supports);
|
||||||
Clean(bullishMomentumBars);
|
Clean(bullishMomentumBars);
|
||||||
Clean(bullishRejectionBars);
|
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;
|
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 ...
|
* Get Long Signalling State ...
|
||||||
*
|
*
|
||||||
@@ -318,7 +338,8 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
|||||||
//
|
//
|
||||||
DrawSignal(
|
DrawSignal(
|
||||||
signal,
|
signal,
|
||||||
conditions);
|
conditions //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// ClearDraws();
|
// ClearDraws();
|
||||||
@@ -479,19 +500,45 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Loop through Conditions for Filter Based on POIs ...
|
// Loop through Conditions for Filter Based on POIs ...
|
||||||
int removeIDX = -1;
|
int conditionsIDX = -1;
|
||||||
for (int i = 0; i < conditionsCount; i++)
|
for (int i = 0; i < conditionsCount; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
result = false;
|
result = false;
|
||||||
X121SMCStrategyConditions iConditions = mConditions[i];
|
X121SMCStrategyConditions iConditions = mConditions[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSpreadPassed = IsSpreadPass();
|
||||||
|
if (!isSpreadPassed)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Longs ...
|
// Longs ...
|
||||||
bool isAllowLong = AllowLong();
|
bool isAllowLong = AllowLong();
|
||||||
if (isAllowLong)
|
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)
|
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 ...
|
// Rmove Signal Condition ...
|
||||||
if (result &&
|
if (result &&
|
||||||
IsValidIndex(removeIDX))
|
IsValidIndex(conditionsIDX))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ArrayRemove(
|
ArrayRemove(
|
||||||
mConditions,
|
mConditions,
|
||||||
removeIDX,
|
conditionsIDX,
|
||||||
1 //
|
1 //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -530,6 +600,10 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
result = PrepareSignal(signal);
|
result = PrepareSignal(signal);
|
||||||
|
|
||||||
|
//
|
||||||
|
hasLong = false;
|
||||||
|
hasShort = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -561,13 +635,14 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
|||||||
// Props ...
|
// Props ...
|
||||||
|
|
||||||
//
|
//
|
||||||
string mSymbol; // Trading Symbol ...
|
string mSymbol; // Trading Symbol ...
|
||||||
ENUM_TIMEFRAMES mPeriod; // Trading TimeFrame ...
|
ENUM_TIMEFRAMES mPeriod; // Trading TimeFrame ...
|
||||||
bool mForceDisabled; // Force Disabled ...
|
bool mForceDisabled; // Force Disabled ...
|
||||||
bool mAllowLong; // Allow Long Signals
|
bool mAllowLong; // Allow Long Signals
|
||||||
bool mAllowShort; // Allow Short Signals
|
bool mAllowShort; // Allow Short Signals
|
||||||
double mR2R; // Risk/Rewar Ratio ...
|
double mR2R; // Risk/Rewar Ratio ...
|
||||||
double mVolume; // Static Volume Per Trades ...
|
double mVolume; // Static Volume Per Trades ...
|
||||||
|
double mMaxAllowedSpread; // Max Allowed Spread ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XTick mTicks[]; // Hold Ticks Data ...
|
XTick mTicks[]; // Hold Ticks Data ...
|
||||||
@@ -634,6 +709,12 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
int length = 5;
|
int length = 5;
|
||||||
|
double pointValue = GetPoints(mSymbol);
|
||||||
|
double maxAllowedSpread = MaxAllowedSpread();
|
||||||
|
if (maxAllowedSpread > 0)
|
||||||
|
{
|
||||||
|
maxAllowedSpread *= pointValue;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
int ticksCount = ArraySize(mTicks);
|
int ticksCount = ArraySize(mTicks);
|
||||||
@@ -659,15 +740,21 @@ class XCX121SMCStrategy : public XSCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
end -= 1;
|
end -= 1;
|
||||||
double spread = 0;
|
double spreadAVG = 0;
|
||||||
for (int i = start; i < end; i++)
|
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;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user