last ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -89,14 +89,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
return mPeriod;
|
return mPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve POI Drawer Instance Pointer ...
|
|
||||||
**/
|
|
||||||
XCPOIDrawer *GetDrawer()
|
|
||||||
{
|
|
||||||
return mPOIDrawer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Strategy is Disabled or not ...
|
* Check Strategy is Disabled or not ...
|
||||||
*
|
*
|
||||||
@@ -107,68 +99,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
return mForceDisabled;
|
return mForceDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Chart Id ...
|
|
||||||
*
|
|
||||||
* @return ( long )
|
|
||||||
*/
|
|
||||||
long ChartIdentification()
|
|
||||||
{
|
|
||||||
return mChartID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Chart Id ...
|
|
||||||
*
|
|
||||||
* @param value: Long ...
|
|
||||||
*/
|
|
||||||
void ChartIdentification(long value)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (value < 0)
|
|
||||||
{
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
mChartID = value;
|
|
||||||
if (mPOIDrawer != NULL)
|
|
||||||
{
|
|
||||||
mPOIDrawer.ChartIdentification(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Sub Window Id ...
|
|
||||||
*
|
|
||||||
* @return ( int )
|
|
||||||
*/
|
|
||||||
int SubWindowIdentification()
|
|
||||||
{
|
|
||||||
return mSubWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Sub Window Id ...
|
|
||||||
*
|
|
||||||
* @param value: Integer ...
|
|
||||||
*/
|
|
||||||
void SubWindowIdentification(int value)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (value < 0)
|
|
||||||
{
|
|
||||||
value = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
mSubWindow = value;
|
|
||||||
if (mPOIDrawer != NULL)
|
|
||||||
{
|
|
||||||
mPOIDrawer.SubWindowIdentification(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Signal Volume ...
|
* Get Signal Volume ...
|
||||||
*
|
*
|
||||||
@@ -243,60 +173,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
mMaxAllowedSpread = value;
|
mMaxAllowedSpread = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Min Required Ticks Verification for Spread Pass ...
|
|
||||||
*
|
|
||||||
* @return ( int )
|
|
||||||
*/
|
|
||||||
int MinRequiredTicksForSpreadPass()
|
|
||||||
{
|
|
||||||
return mMinRequiredTicksForSpreadPass;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Min Required Ticks Verification for Spread Pass ...
|
|
||||||
*
|
|
||||||
* @param value: Integer ...
|
|
||||||
*/
|
|
||||||
void MinRequiredTicksForSpreadPass(int value)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (value < 100)
|
|
||||||
{
|
|
||||||
value = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
mMinRequiredTicksForSpreadPass = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Max Allowed Save Ticks ...
|
|
||||||
*
|
|
||||||
* @return ( int )
|
|
||||||
*/
|
|
||||||
int MaxAllowedSaveTicks()
|
|
||||||
{
|
|
||||||
return mMaxAllowedSaveTicks;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Max Allowed Save Ticks ...
|
|
||||||
*
|
|
||||||
* @param value: Integer ...
|
|
||||||
*/
|
|
||||||
void MaxAllowedSaveTicks(int value)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (value < 150)
|
|
||||||
{
|
|
||||||
value = 150;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
mMaxAllowedSaveTicks = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Long Signalling State ...
|
* Get Long Signalling State ...
|
||||||
*
|
*
|
||||||
@@ -425,7 +301,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
// Update Last Issued Tick ...
|
// Update Last Issued Tick ...
|
||||||
mLastTick = cTick;
|
mLastTick = cTick;
|
||||||
SaveTickData();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Current Processing Tick has Signal or not ...
|
// Check Current Processing Tick has Signal or not ...
|
||||||
@@ -586,11 +461,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
// Props ...
|
// Props ...
|
||||||
|
|
||||||
//
|
//
|
||||||
XCPOIDrawer *mPOIDrawer; // POI Drawer Class ...
|
|
||||||
CArrayObj mDrawnObjects;
|
|
||||||
|
|
||||||
//
|
|
||||||
XTick mTicks[]; // Hold Ticks Data ...
|
|
||||||
MqlTick mLastTick; // Last Issued Tick ...
|
MqlTick mLastTick; // Last Issued Tick ...
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -601,81 +471,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
// Actions ...
|
// Actions ...
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Spread Passed for Positions...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsSpreadPass()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
double pointValue = GetPoints(mSymbol);
|
|
||||||
double maxAllowedSpread = MaxAllowedSpread();
|
|
||||||
int minRequiredTicksVerification = MinRequiredTicksForSpreadPass();
|
|
||||||
if (maxAllowedSpread > 0)
|
|
||||||
{
|
|
||||||
maxAllowedSpread *= pointValue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxAllowedSpread = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = maxAllowedSpread <= 0
|
|
||||||
? true
|
|
||||||
: minRequiredTicksVerification > 0;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int ticksCount = ArraySize(mTicks);
|
|
||||||
result = ticksCount >= minRequiredTicksVerification;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (maxAllowedSpread > 0)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int end = -1;
|
|
||||||
int start = -1;
|
|
||||||
result = CalculateTicksParams(
|
|
||||||
start,
|
|
||||||
end,
|
|
||||||
minRequiredTicksVerification //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
for (int i = start; i < end; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XTick iTick = mTicks[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
result = iTick.spread <= maxAllowedSpread;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare and Normalize Signal for Execution in Strategy ...
|
* Prepare and Normalize Signal for Execution in Strategy ...
|
||||||
*
|
*
|
||||||
@@ -751,126 +546,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Draw Functions ...
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear all Drawn Objects ...
|
|
||||||
*/
|
|
||||||
void ClearDraws()
|
|
||||||
{
|
|
||||||
mDrawnObjects.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove Specified Drawn Object ...
|
|
||||||
*
|
|
||||||
* @param name: Object name ...
|
|
||||||
*/
|
|
||||||
void RemoveObject(string name)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (!IsValid(name))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int count = mDrawnObjects.Total();
|
|
||||||
if (!IsValidSize(count))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int idx = -1;
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
string iName = ((CChartObject *)mDrawnObjects.At(i)).Name();
|
|
||||||
string iObjName = NULL;
|
|
||||||
if (!IsValid(iName))
|
|
||||||
{
|
|
||||||
iObjName = ((XCBaseObject *)mDrawnObjects.At(i)).ObjName();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if ((IsValid(iName) &&
|
|
||||||
iName == name) ||
|
|
||||||
(IsValid(iObjName) &&
|
|
||||||
iObjName == name))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
idx = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (IsValidIndex(idx))
|
|
||||||
{
|
|
||||||
mDrawnObjects.Delete(idx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add Specified Object to Drawn Objects if not Exists ...
|
|
||||||
*/
|
|
||||||
void AddObjectIfNotExists(XCBaseObject *object)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
string name = object.ObjName();
|
|
||||||
|
|
||||||
//
|
|
||||||
bool canAdd = true;
|
|
||||||
int count = mDrawnObjects.Total();
|
|
||||||
if (IsValidSize(count))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
string iName = ((XCBaseObject *)mDrawnObjects.At(i)).ObjName();
|
|
||||||
|
|
||||||
//
|
|
||||||
if (name == iName)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
canAdd = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (canAdd)
|
|
||||||
{
|
|
||||||
mDrawnObjects.Add(object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add Specified Objects to Drawn Objects if not Exists ...
|
|
||||||
*/
|
|
||||||
void AddObjectsIfNotExists(XCBaseObject *&objects[])
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int count = ArraySize(objects);
|
|
||||||
if (!IsValidSize(count))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
AddObjectIfNotExists(objects[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Private ...
|
// Private ...
|
||||||
private:
|
private:
|
||||||
@@ -887,13 +562,7 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
double mVolume; // Static Volume Per Trades ...
|
double mVolume; // Static Volume Per Trades ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double mMaxAllowedSpread; // Max Allowed Spread ...
|
double mMaxAllowedSpread; // Max Allowed Spread ...
|
||||||
int mMinRequiredTicksForSpreadPass; // Min Required Ticks Verification for Spread Pass ...
|
|
||||||
int mMaxAllowedSaveTicks; // Max Allowed Save Ticks ...
|
|
||||||
|
|
||||||
//
|
|
||||||
long mChartID; // Chart ID ...
|
|
||||||
int mSubWindow; // Sub Window ID ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// On X121 Signal Recieved Event Handler(s) ...
|
// On X121 Signal Recieved Event Handler(s) ...
|
||||||
@@ -913,28 +582,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
R2R(1);
|
R2R(1);
|
||||||
Volume(0.01);
|
Volume(0.01);
|
||||||
MaxAllowedSaveTicks(150);
|
|
||||||
MinRequiredTicksForSpreadPass(100);
|
|
||||||
|
|
||||||
//
|
|
||||||
ChartIdentification(0);
|
|
||||||
SubWindowIdentification(0);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Configure POI Drawer if Required ...
|
|
||||||
mPOIDrawer = new XCPOIDrawer();
|
|
||||||
mPOIDrawer.ChartIdentification(0);
|
|
||||||
mPOIDrawer.SubWindowIdentification(0);
|
|
||||||
|
|
||||||
//
|
|
||||||
mPOIDrawer.DemandZoneFill(false);
|
|
||||||
mPOIDrawer.SupplyZoneFill(false);
|
|
||||||
mPOIDrawer.BullishFVGFill(false);
|
|
||||||
mPOIDrawer.BearishFVGFill(false);
|
|
||||||
mPOIDrawer.SupportZoneFill(false);
|
|
||||||
mPOIDrawer.ResistanceZoneFill(false);
|
|
||||||
mPOIDrawer.BullishOrderBlockFill(false);
|
|
||||||
mPOIDrawer.BearishOrderBlockFill(false);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
string symbol = Symbol();
|
string symbol = Symbol();
|
||||||
@@ -966,15 +613,12 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
void DeInit()
|
void DeInit()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ZeroMemory(mPOIDrawer);
|
|
||||||
ZeroMemory(mBarAnalyser);
|
ZeroMemory(mBarAnalyser);
|
||||||
|
|
||||||
//
|
//
|
||||||
delete mPOIDrawer;
|
|
||||||
delete mBarAnalyser;
|
delete mBarAnalyser;
|
||||||
|
|
||||||
//
|
//
|
||||||
Clean(mTicks);
|
|
||||||
Clean(mSignalEventHandlers);
|
Clean(mSignalEventHandlers);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -989,90 +633,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
|
|||||||
mBarTracker.Clean();
|
mBarTracker.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add new Tick Data to Collection ...
|
|
||||||
*/
|
|
||||||
void SaveTickData()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XTick tick;
|
|
||||||
bool isInited = tick.Init(mSymbol);
|
|
||||||
if (!isInited)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int beforeCount = ArraySize(mTicks);
|
|
||||||
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
tick,
|
|
||||||
mTicks //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
int afterCount = ArraySize(mTicks);
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isAdded = afterCount == beforeCount + 1;
|
|
||||||
if (isAdded)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Cleaning Up Unused Items ...
|
|
||||||
int maxAllowed = MaxAllowedSaveTicks();
|
|
||||||
CleanupArray(
|
|
||||||
mTicks,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculate Ticks Param for Looping through Last n items ...
|
|
||||||
*
|
|
||||||
* @param start: Integer Reference to Start ...
|
|
||||||
* @param end: Integer Reference to End ...
|
|
||||||
* @param numOfLastTicks: Integer Max Number of Required N Last Ticks ...
|
|
||||||
*/
|
|
||||||
bool CalculateTicksParams(
|
|
||||||
int &start,
|
|
||||||
int &end,
|
|
||||||
int numOfLastTicks = 5 //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
start = -1;
|
|
||||||
end = -1;
|
|
||||||
|
|
||||||
//
|
|
||||||
int count = ArraySize(mTicks);
|
|
||||||
|
|
||||||
//
|
|
||||||
start = count - numOfLastTicks;
|
|
||||||
if (start < 0)
|
|
||||||
{
|
|
||||||
start = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
end = start + numOfLastTicks;
|
|
||||||
if (end > count)
|
|
||||||
{
|
|
||||||
end = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = IsValidIndex(start) &&
|
|
||||||
IsValidIndex(end);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
//
|
//
|
||||||
#include "../../Classes/x-saherelm.x-alert.class.mq5"
|
#include "../../Classes/x-saherelm.x-alert.class.mq5"
|
||||||
#include "../../Classes/x-saherelm.x-bar.analyser.class.mq5"
|
#include "../../Classes/x-saherelm.x-bar.analyser.class.mq5"
|
||||||
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
|
||||||
#include "../../Classes/x-saherelm.x-trade.class.mq5"
|
#include "../../Classes/x-saherelm.x-trade.class.mq5"
|
||||||
#include "../Libraries/x-121.smc.lib.mq5"
|
#include "../Libraries/x-121.smc.lib.mq5"
|
||||||
|
|
||||||
@@ -1639,9 +1638,6 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
Clean(mSymbolInfos);
|
Clean(mSymbolInfos);
|
||||||
Clean(mLastExecutedSignals);
|
Clean(mLastExecutedSignals);
|
||||||
|
|
||||||
//
|
|
||||||
delete mDrawer;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
delete mTrader;
|
delete mTrader;
|
||||||
delete mCollector;
|
delete mCollector;
|
||||||
@@ -2220,32 +2216,6 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
mHedgeingMinRequiredProfitPerVolumeStep = value;
|
mHedgeingMinRequiredProfitPerVolumeStep = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get POI Drawer instance Pointer ...
|
|
||||||
*/
|
|
||||||
XCPOIDrawer *GetDrawer()
|
|
||||||
{
|
|
||||||
return mDrawer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get POI Drawer instance Pointer ...
|
|
||||||
*/
|
|
||||||
void SetDrawer(XCPOIDrawer *drawer)
|
|
||||||
{
|
|
||||||
mDrawer = drawer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Darwer Exists Before Draw anything ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool CanDraw()
|
|
||||||
{
|
|
||||||
return mDrawer != NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Actions ...
|
// Actions ...
|
||||||
|
|
||||||
@@ -3175,12 +3145,6 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
// Add XTradeHandler Data ...
|
// Add XTradeHandler Data ...
|
||||||
Add(signal);
|
Add(signal);
|
||||||
if (CanDraw())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCSignalObject *iObj;
|
|
||||||
mDrawer.DrawSignal(signal, iObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Handle Last Executed Signal ...
|
// Handle Last Executed Signal ...
|
||||||
@@ -3281,12 +3245,6 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
// Add XTradeHandler Data ...
|
// Add XTradeHandler Data ...
|
||||||
Add(signal);
|
Add(signal);
|
||||||
if (CanDraw())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCSignalObject *iObj;
|
|
||||||
mDrawer.DrawSignal(signal, iObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Handle Last Executed Signal ...
|
// Handle Last Executed Signal ...
|
||||||
@@ -3895,9 +3853,6 @@ class XC121SMCTradeHandler : public XCBaseAlert
|
|||||||
double mHedgingMinVolumeStep; // Minimum Volume Step for Hedging ...
|
double mHedgingMinVolumeStep; // Minimum Volume Step for Hedging ...
|
||||||
double mHedgeingMinRequiredProfitPerVolumeStep; // Minimum Required Profit Per Volume Step for Hedging ...
|
double mHedgeingMinRequiredProfitPerVolumeStep; // Minimum Required Profit Per Volume Step for Hedging ...
|
||||||
|
|
||||||
//
|
|
||||||
XCPOIDrawer *mDrawer;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Common Functions ...
|
// Common Functions ...
|
||||||
|
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
/**
|
/**
|
||||||
* Set Static Balance for Calculate Trade Volume ...
|
* Set Static Balance for Calculate Trade Volume ...
|
||||||
*
|
*
|
||||||
* @param value: Argument 1
|
* @param value: Argument 1
|
||||||
*/
|
*/
|
||||||
void StaticBalance(double value)
|
void StaticBalance(double value)
|
||||||
{
|
{
|
||||||
@@ -502,7 +502,7 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
/**
|
/**
|
||||||
* Set Balance Used In Each Trade ...
|
* Set Balance Used In Each Trade ...
|
||||||
*
|
*
|
||||||
* @param value: Argument 1
|
* @param value: Argument 1
|
||||||
*/
|
*/
|
||||||
void BalancePerTrade(double value)
|
void BalancePerTrade(double value)
|
||||||
{
|
{
|
||||||
@@ -1004,36 +1004,6 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
|
|
||||||
//
|
//
|
||||||
Alert(msg);
|
Alert(msg);
|
||||||
|
|
||||||
//
|
|
||||||
// Draw Signals and Conditions ...
|
|
||||||
if (eaDrawer != NULL)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCBaseObject *objects[];
|
|
||||||
XCSignalObject *signalObject;
|
|
||||||
bool isCreated = eaDrawer.DrawSignal(
|
|
||||||
signal,
|
|
||||||
signalObject //
|
|
||||||
);
|
|
||||||
// DrawX121SMCStrategyConditions(
|
|
||||||
// conditions,
|
|
||||||
// objects,
|
|
||||||
// eaDrawer,
|
|
||||||
// true, // draw Market Structure ...
|
|
||||||
// true, // Draw Price Zones ...
|
|
||||||
// true // Draw Decision Zones ...
|
|
||||||
// );
|
|
||||||
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
(XCBaseObject *)signalObject,
|
|
||||||
objects //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(objects);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1259,7 +1229,6 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
//
|
//
|
||||||
// Parsers ...
|
// Parsers ...
|
||||||
XSymbolParser _symbolParser;
|
XSymbolParser _symbolParser;
|
||||||
eaDrawer = NULL;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Single Symbol ...
|
// Single Symbol ...
|
||||||
@@ -1276,14 +1245,6 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
_Period //
|
_Period //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
if (eaDrawer == NULL)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
eaDrawer = iX121SMCStrategy
|
|
||||||
.GetDrawer();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
iX121SMCStrategy.AddXSignalEventHandler(OnSignalEventListener);
|
iX121SMCStrategy.AddXSignalEventHandler(OnSignalEventListener);
|
||||||
|
|
||||||
@@ -1349,14 +1310,6 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
_Period //
|
_Period //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
if (eaDrawer == NULL)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
eaDrawer = iX121SMCStrategy
|
|
||||||
.GetDrawer();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
iX121SMCStrategy.AddXSignalEventHandler(OnSignalEventListener);
|
iX121SMCStrategy.AddXSignalEventHandler(OnSignalEventListener);
|
||||||
|
|
||||||
@@ -1371,12 +1324,6 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
Clean(symbols);
|
Clean(symbols);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
if (eaDrawer != NULL)
|
|
||||||
{
|
|
||||||
mTradeHandler.SetDrawer(eaDrawer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1830,8 +1777,8 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
strategy.AllowLong(AllowLong());
|
strategy.AllowLong(AllowLong());
|
||||||
strategy.AllowShort(AllowShort());
|
strategy.AllowShort(AllowShort());
|
||||||
strategy.MaxAllowedSpread(20);
|
strategy.MaxAllowedSpread(20);
|
||||||
strategy.MaxAllowedSaveTicks(150);
|
// strategy.MaxAllowedSaveTicks(150);
|
||||||
strategy.MinRequiredTicksForSpreadPass(100);
|
// strategy.MinRequiredTicksForSpreadPass(100);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (Disabled())
|
if (Disabled())
|
||||||
@@ -1978,9 +1925,6 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
double mHedgingMinVolumeStep; // Minimum Volume Step for Hedging ...
|
double mHedgingMinVolumeStep; // Minimum Volume Step for Hedging ...
|
||||||
double mHedgeingMinRequiredProfitPerVolumeStep; // Minimum Required Profit Per Volume Step for Hedging ...
|
double mHedgeingMinRequiredProfitPerVolumeStep; // Minimum Required Profit Per Volume Step for Hedging ...
|
||||||
|
|
||||||
//
|
|
||||||
XCPOIDrawer *eaDrawer; // EA Drawer ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
double CalculateAdditionalVolumeMultiplier(XSignal &signal)
|
double CalculateAdditionalVolumeMultiplier(XSignal &signal)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ bool DetectX121SMCGuards(
|
|||||||
string provider, // Provider ...
|
string provider, // Provider ...
|
||||||
X121SMCGuard &guards[],
|
X121SMCGuard &guards[],
|
||||||
const XPosition &positions[],
|
const XPosition &positions[],
|
||||||
XC121SMCCycleHelper *triggerCycleHelper,
|
// XC121SMCCycleHelper *triggerCycleHelper,
|
||||||
XC121SMCCycleHelper *decisionCycleHelper,
|
XC121SMCCycleHelper *decisionCycleHelper,
|
||||||
XC121SMCCycleHelper *analyseCycleHelper,
|
XC121SMCCycleHelper *analyseCycleHelper,
|
||||||
XC121SMCCycleHelper *verificationCycleHelper,
|
XC121SMCCycleHelper *verificationCycleHelper,
|
||||||
@@ -80,8 +80,8 @@ bool DetectX121SMCGuards(
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
string symbol = triggerCycleHelper.GetSymbol();
|
string symbol = decisionCycleHelper.GetSymbol();
|
||||||
ENUM_TIMEFRAMES period = triggerCycleHelper.GetPeriod();
|
ENUM_TIMEFRAMES period = decisionCycleHelper.GetPeriod();
|
||||||
|
|
||||||
//
|
//
|
||||||
XPosition ownPositions[];
|
XPosition ownPositions[];
|
||||||
@@ -222,20 +222,20 @@ bool DetectX121SMCGuards(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Trigger ...
|
// Trigger ...
|
||||||
ENUM_XPOI_EVENTS triggerPoiEvents[];
|
// ENUM_XPOI_EVENTS triggerPoiEvents[];
|
||||||
ENUM_X_CYCLE_EVENTS triggerCycleEvents[];
|
// ENUM_X_CYCLE_EVENTS triggerCycleEvents[];
|
||||||
X121SMCCycleConditions triggerConditions;
|
// X121SMCCycleConditions triggerConditions;
|
||||||
result = triggerCycleHelper.GetConditions(
|
// result = triggerCycleHelper.GetConditions(
|
||||||
triggerCycleEvents,
|
// triggerCycleEvents,
|
||||||
triggerPoiEvents,
|
// triggerPoiEvents,
|
||||||
triggerConditions,
|
// triggerConditions,
|
||||||
zIndex,
|
// zIndex,
|
||||||
loopback //
|
// loopback //
|
||||||
);
|
// );
|
||||||
if (!result)
|
// if (!result)
|
||||||
{
|
// {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
// Decision ...
|
// Decision ...
|
||||||
@@ -324,7 +324,7 @@ bool DetectX121SMCGuards(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Cycles POI States ...
|
// Cycles POI States ...
|
||||||
XPOIState triggerState = triggerConditions.state;
|
// XPOIState triggerState = triggerConditions.state;
|
||||||
XPOIState decisionState = decisionConditions.state;
|
XPOIState decisionState = decisionConditions.state;
|
||||||
XPOIState analyseState = analyseConditions.state;
|
XPOIState analyseState = analyseConditions.state;
|
||||||
XPOIState verificationState = verificationConditions.state;
|
XPOIState verificationState = verificationConditions.state;
|
||||||
@@ -333,7 +333,7 @@ bool DetectX121SMCGuards(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Cycle X121Conditions ...
|
// Cycle X121Conditions ...
|
||||||
X121Conditions triggerXConditions = triggerConditions.x121Conditions;
|
// X121Conditions triggerXConditions = triggerConditions.x121Conditions;
|
||||||
X121Conditions decisionXConditions = decisionConditions.x121Conditions;
|
X121Conditions decisionXConditions = decisionConditions.x121Conditions;
|
||||||
X121Conditions analyseXConditions = analyseConditions.x121Conditions;
|
X121Conditions analyseXConditions = analyseConditions.x121Conditions;
|
||||||
X121Conditions verificationXConditions = verificationConditions.x121Conditions;
|
X121Conditions verificationXConditions = verificationConditions.x121Conditions;
|
||||||
@@ -362,15 +362,15 @@ bool DetectX121SMCGuards(
|
|||||||
//
|
//
|
||||||
double upper = 0;
|
double upper = 0;
|
||||||
double lower = 0;
|
double lower = 0;
|
||||||
hasConsolidationZone =
|
// hasConsolidationZone =
|
||||||
triggerCycleHelper
|
// triggerCycleHelper
|
||||||
.mBarAnalyser
|
// .mBarAnalyser
|
||||||
.IsConsolidate(
|
// .IsConsolidate(
|
||||||
cBar,
|
// cBar,
|
||||||
upper,
|
// upper,
|
||||||
lower,
|
// lower,
|
||||||
consolidationLoopback //
|
// consolidationLoopback //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
//
|
||||||
if (hasConsolidationZone)
|
if (hasConsolidationZone)
|
||||||
@@ -406,8 +406,8 @@ bool DetectX121SMCGuards(
|
|||||||
IsBearish(x121SMCConsolidationZone.breakDirection);
|
IsBearish(x121SMCConsolidationZone.breakDirection);
|
||||||
|
|
||||||
//
|
//
|
||||||
consolidationZoneUpper = triggerXConditions.peaksBuffer[1];
|
// consolidationZoneUpper = triggerXConditions.peaksBuffer[1];
|
||||||
consolidationZoneLower = triggerXConditions.valesBuffer[1];
|
// consolidationZoneLower = triggerXConditions.valesBuffer[1];
|
||||||
|
|
||||||
//
|
//
|
||||||
if (isConsolidationZoneBreaked)
|
if (isConsolidationZoneBreaked)
|
||||||
@@ -1222,8 +1222,8 @@ bool DetectX121SMCGuards(
|
|||||||
Clean(ownPositions);
|
Clean(ownPositions);
|
||||||
Clean(ownLongPositions);
|
Clean(ownLongPositions);
|
||||||
Clean(ownShortPositions);
|
Clean(ownShortPositions);
|
||||||
Clean(triggerPoiEvents);
|
// Clean(triggerPoiEvents);
|
||||||
Clean(triggerCycleEvents);
|
// Clean(triggerCycleEvents);
|
||||||
Clean(decisionPoiEvents);
|
Clean(decisionPoiEvents);
|
||||||
Clean(decisionCycleEvents);
|
Clean(decisionCycleEvents);
|
||||||
Clean(analysePoiEvents);
|
Clean(analysePoiEvents);
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
const string X121SMCStrategyToken = "X121SMC";
|
const string X121SMCStrategyToken = "X121SMC";
|
||||||
|
|
||||||
//
|
//
|
||||||
const string X121SMCXOBSToken = "X121XOBS";
|
|
||||||
const string X121SMCXSupDemOBSToken = "X121XSupDemOBS";
|
const string X121SMCXSupDemOBSToken = "X121XSupDemOBS";
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -3289,7 +3289,7 @@ bool DetectX121SMCXSupDemOBSSignalTrigger(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Cycle X121Conditions ...
|
// Cycle X121Conditions ...
|
||||||
X121Conditions decisionXConditions = decisionConditions.x121Conditions;
|
// X121Conditions decisionXConditions = decisionConditions.x121Conditions;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Trigger Conditions ...
|
// Trigger Conditions ...
|
||||||
@@ -3297,43 +3297,43 @@ bool DetectX121SMCXSupDemOBSSignalTrigger(
|
|||||||
//
|
//
|
||||||
// Slopes ...
|
// Slopes ...
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool isRsiSlopeBullish = decisionXConditions.isRsiSlopeBullish;
|
// bool isRsiSlopeBullish = decisionXConditions.isRsiSlopeBullish;
|
||||||
bool isStrSlopeBullish = decisionXConditions.isStrSlopeBullish;
|
// bool isStrSlopeBullish = decisionXConditions.isStrSlopeBullish;
|
||||||
bool isAtrUpperSlopeBullish = decisionXConditions.isAtrUpperSlopeBullish;
|
// bool isAtrUpperSlopeBullish = decisionXConditions.isAtrUpperSlopeBullish;
|
||||||
bool isAtrLowerSlopeBullish = decisionXConditions.isAtrLowerSlopeBullish;
|
// bool isAtrLowerSlopeBullish = decisionXConditions.isAtrLowerSlopeBullish;
|
||||||
bool isVwapFastSlopeBullish = decisionXConditions.isVwapFastSlopeBullish;
|
// bool isVwapFastSlopeBullish = decisionXConditions.isVwapFastSlopeBullish;
|
||||||
bool isVwapMidSlopeBullish = decisionXConditions.isVwapMidSlopeBullish;
|
// bool isVwapMidSlopeBullish = decisionXConditions.isVwapMidSlopeBullish;
|
||||||
bool isVwapSlowSlopeBullish = decisionXConditions.isVwapSlowSlopeBullish;
|
// bool isVwapSlowSlopeBullish = decisionXConditions.isVwapSlowSlopeBullish;
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool isRsiSlopeBearish = decisionXConditions.isRsiSlopeBearish;
|
// bool isRsiSlopeBearish = decisionXConditions.isRsiSlopeBearish;
|
||||||
bool isStrSlopeBearish = decisionXConditions.isStrSlopeBearish;
|
// bool isStrSlopeBearish = decisionXConditions.isStrSlopeBearish;
|
||||||
bool isAtrUpperSlopeBearish = decisionXConditions.isAtrUpperSlopeBearish;
|
// bool isAtrUpperSlopeBearish = decisionXConditions.isAtrUpperSlopeBearish;
|
||||||
bool isAtrLowerSlopeBearish = decisionXConditions.isAtrLowerSlopeBearish;
|
// bool isAtrLowerSlopeBearish = decisionXConditions.isAtrLowerSlopeBearish;
|
||||||
bool isVwapFastSlopeBearish = decisionXConditions.isVwapFastSlopeBearish;
|
// bool isVwapFastSlopeBearish = decisionXConditions.isVwapFastSlopeBearish;
|
||||||
bool isVwapMidSlopeBearish = decisionXConditions.isVwapMidSlopeBearish;
|
// bool isVwapMidSlopeBearish = decisionXConditions.isVwapMidSlopeBearish;
|
||||||
bool isVwapSlowSlopeBearish = decisionXConditions.isVwapSlowSlopeBearish;
|
// bool isVwapSlowSlopeBearish = decisionXConditions.isVwapSlowSlopeBearish;
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool isSlopesBullish =
|
// bool isSlopesBullish =
|
||||||
isRsiSlopeBullish &&
|
// isRsiSlopeBullish &&
|
||||||
isStrSlopeBullish &&
|
// isStrSlopeBullish &&
|
||||||
isAtrUpperSlopeBullish &&
|
// isAtrUpperSlopeBullish &&
|
||||||
isAtrLowerSlopeBullish &&
|
// isAtrLowerSlopeBullish &&
|
||||||
isVwapFastSlopeBullish &&
|
// isVwapFastSlopeBullish &&
|
||||||
isVwapMidSlopeBullish &&
|
// isVwapMidSlopeBullish &&
|
||||||
isVwapSlowSlopeBullish;
|
// isVwapSlowSlopeBullish;
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool isSlopesBearish =
|
// bool isSlopesBearish =
|
||||||
isRsiSlopeBearish &&
|
// isRsiSlopeBearish &&
|
||||||
isStrSlopeBearish &&
|
// isStrSlopeBearish &&
|
||||||
isAtrUpperSlopeBearish &&
|
// isAtrUpperSlopeBearish &&
|
||||||
isAtrLowerSlopeBearish &&
|
// isAtrLowerSlopeBearish &&
|
||||||
isVwapFastSlopeBearish &&
|
// isVwapFastSlopeBearish &&
|
||||||
isVwapMidSlopeBearish &&
|
// isVwapMidSlopeBearish &&
|
||||||
isVwapSlowSlopeBearish;
|
// isVwapSlowSlopeBearish;
|
||||||
|
|
||||||
//
|
//
|
||||||
double point = conditions.point;
|
double point = conditions.point;
|
||||||
@@ -3390,7 +3390,7 @@ bool DetectX121SMCXSupDemOBSSignalTrigger(
|
|||||||
//
|
//
|
||||||
decisionState.Clean();
|
decisionState.Clean();
|
||||||
decisionConditions.Clean();
|
decisionConditions.Clean();
|
||||||
decisionXConditions.Clean();
|
// decisionXConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -3413,8 +3413,8 @@ bool DetectX121SMCXSupDemOBSSignalTrigger(
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
double iAtr = decisionConditions.x121Conditions.atrBuffer[1];
|
double iAtr = 0; // decisionConditions.x121Conditions.atrBuffer[1];
|
||||||
iAtr *= 1.5;
|
// iAtr *= 1.5;
|
||||||
|
|
||||||
//
|
//
|
||||||
double slsMin = GetMin(sls);
|
double slsMin = GetMin(sls);
|
||||||
@@ -3448,7 +3448,7 @@ bool DetectX121SMCXSupDemOBSSignalTrigger(
|
|||||||
//
|
//
|
||||||
decisionState.Clean();
|
decisionState.Clean();
|
||||||
decisionConditions.Clean();
|
decisionConditions.Clean();
|
||||||
decisionXConditions.Clean();
|
// decisionXConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user