This commit is contained in:
2024-11-23 17:33:51 +03:30
parent b99cba1272
commit a5e1f601d3
2 changed files with 85 additions and 83 deletions
@@ -454,6 +454,15 @@ class XC121SMCExpert : public XCBaseExpert
return result; return result;
} }
//
// Configure Alerts ...
SetAlertPrefix(GetTag());
SetAlertEnableAlerts(GetAlertEnableAlerts());
SetAlertLogAlerts(GetAlertLogAlerts());
SetAlertMailAlerts(GetAlertMailAlerts());
SetAlertPushAlerts(GetAlertPushAlerts());
SetAlertTerminalAlerts(GetAlertTerminalAlerts());
// //
// Create Trader Instance and Configure it ... // Create Trader Instance and Configure it ...
mTrader = new XCTrade( mTrader = new XCTrade(
@@ -100,6 +100,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
double entry = 0; double entry = 0;
double reward = 0; double reward = 0;
double r2r = R2R(); double r2r = R2R();
string provider = "";
double volume = Volume(); double volume = Volume();
ENUM_POSITION_TYPE type = POSITION_TYPE_BUY; ENUM_POSITION_TYPE type = POSITION_TYPE_BUY;
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET; ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
@@ -245,6 +246,15 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
// //
bool isOrderFlowBullish = IsBullish(mOrderFlowDir); bool isOrderFlowBullish = IsBullish(mOrderFlowDir);
//
// Check Parabolic Sar is in Order of Order Flow ...
bool isPSarInDirectionOfOrderFlow =
isOrderFlowBullish
? conditions.xchsarConditions.cSars[0] < cBar.low &&
conditions.xchsarConditions.cSars[1] >= pBar.low
: conditions.xchsarConditions.cSars[0] > cBar.high &&
conditions.xchsarConditions.cSars[1] <= pBar.high;
// //
// Check BOS or CHOCH Happens ... // Check BOS or CHOCH Happens ...
bool hasBOS = bool hasBOS =
@@ -282,35 +292,23 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
if (hasBOS || hasCHOCH) if (hasBOS || hasCHOCH)
{ {
// //
RedrawOrderFlow(); // Do on CHOCH ...
//
string mTitle =
hasBOS ? "BOS"
: "CHOCH";
//
Print(mTitle);
//
// Here We Have to Decide How to Act Based On
// Conditions for Updating Order Flow ...
if (hasCHOCH) if (hasCHOCH)
{ {
//
hasLong = hasLong =
// //
!isOrderFlowBullish && !isOrderFlowBullish &&
cBar.IsBullish() && cBar.IsBullish() &&
(isCBullishMomentumBar || (isCBullishMomentumBar ||
isCBullishRejectionBar) && isCBullishRejectionBar) &&
conditions.xchsarConditions.cSars[0] < cBar.low conditions.xchsarConditions.cSars[0] < cBar.low
// //
; ;
if (hasLong) { if (hasLong)
{
// //
// selectedSL = conditions.xpvConditions.peaks[1]; provider = "CHOCH-Long";
// selectedSL = conditions.xchsarConditions.cSars[1];
selectedSL = cBar.low; selectedSL = cBar.low;
} }
@@ -320,80 +318,60 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
isOrderFlowBullish && isOrderFlowBullish &&
cBar.IsBearish() && cBar.IsBearish() &&
(isCBearishMomentumBar || (isCBearishMomentumBar ||
isCBearishRejectionBar) && isCBearishRejectionBar) &&
conditions.xchsarConditions.cSars[0] > cBar.high conditions.xchsarConditions.cSars[0] > cBar.high
// //
; ;
if (hasShort) { if (hasShort)
{
// //
// selectedSL = conditions.xpvConditions.vales[1]; provider = "CHOCH-Short";
// selectedSL = conditions.xchsarConditions.cSars[1]; selectedSL = cBar.high;
}
}
//
// Do on BOS ...
if (hasBOS)
{
//
hasLong =
//
isOrderFlowBullish &&
cBar.IsBullish() &&
(isCBullishMomentumBar ||
isCBullishRejectionBar) &&
conditions.xchsarConditions.cSars[0] < cBar.low
//
;
//
if (hasLong)
{
//
provider = "BOS-Long";
selectedSL = cBar.low;
}
//
hasShort =
//
!isOrderFlowBullish &&
cBar.IsBearish() &&
(isCBearishMomentumBar ||
isCBearishRejectionBar) &&
conditions.xchsarConditions.cSars[0] > cBar.high
//
;
if (hasShort)
{
//
provider = "BOS-Short";
selectedSL = cBar.high; selectedSL = cBar.high;
} }
} }
} }
//
// Check Parabolic Sar is in Order of Order Flow ...
bool isPSarInDirectionOfOrderFlow =
isOrderFlowBullish
? conditions.xchsarConditions.cSars[0] < cBar.low &&
conditions.xchsarConditions.cSars[1] >= pBar.low
: conditions.xchsarConditions.cSars[0] > cBar.high &&
conditions.xchsarConditions.cSars[1] <= pBar.high;
//
if (isPSarInDirectionOfOrderFlow)
{
RedrawOrderFlow();
Print("");
}
else
{
ClearDraws();
}
//
bool long1 =
//
false
//
;
if (long1)
{
//
CustomStateDrawing(mTriggerPOIState);
selectedSL = conditions.xpvConditions.vales[cIndex];
}
//
// Works by WVAP and PSar ...
bool short1 =
//
false
//
;
if (short1)
{
//
CustomStateDrawing(mTriggerPOIState);
selectedSL = conditions.xpvConditions.peaks[cIndex];
}
// //
// hasLong =
// //
// long1
// //
// ;
// //
// hasShort =
// //
// short1
// //
// ;
// //
result = hasLong || result = hasLong ||
hasShort; hasShort;
@@ -449,6 +427,7 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
: entry - reward; : entry - reward;
// //
Print("PRV: ", provider);
ClearDraws(); ClearDraws();
// //
@@ -466,6 +445,10 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
// //
result = PrepareSignal(signal); result = PrepareSignal(signal);
if (result)
{
ResetOrderFlow();
}
// //
hasLong = false; hasLong = false;
@@ -1156,6 +1139,16 @@ class XCX121SMCTestStrategy : public XCX121SMCBaseStrategy
} }
} }
/**
* When a BOS Happens ...
* we have to Update Order Flow ...
*/
void UpdateOrderFlowOnBOS()
{
//
Print("UpdateOrderFlowOnBOS");
}
/** /**
* Fill Pivot Tick Zone ... * Fill Pivot Tick Zone ...
* *