This commit is contained in:
2024-07-27 17:38:32 +03:30
parent 37b9578ba1
commit 2a85f97ad3
3 changed files with 377 additions and 92 deletions
+21 -21
View File
@@ -47,15 +47,15 @@ int eaMaxAllowedLongs = 1; // Max Allowed Long Positions
int eaMaxAllowedShorts = 1; // Max Allowed Short Positions int eaMaxAllowedShorts = 1; // Max Allowed Short Positions
// //
input double eaTPPoint = 100; // Static TP Point double eaTPPoint = 100; // Static TP Point
input double eaSLPoint = 100; // Static SL Point double eaSLPoint = 100; // Static SL Point
// //
bool eaIgnoreTP = false; // Ignore TP bool eaIgnoreTP = false; // Ignore TP
bool eaIgnoreSL = false; // Ignore SL bool eaIgnoreSL = false; // Ignore SL
// //
int eaMaxAllowedSLsInDay = 2; // int eaMaxAllowedSLsInDay = 0;
// //
double eaR2R = 1.5; // Risk to Reward Ratio double eaR2R = 1.5; // Risk to Reward Ratio
@@ -64,7 +64,7 @@ double eaR2R = 1.5; // Risk to Reward Ratio
// Variables ... // Variables ...
// //
int mNumberOfSLs = 0; // int mNumberOfSLs = 0;
// //
// Bar Style nad Time Instances ... // Bar Style nad Time Instances ...
@@ -80,7 +80,7 @@ XSCBaseStrategy *strategies[];
XSCTrade *eaTrader; XSCTrade *eaTrader;
// //
XTimeTracker eaTimeTracker; // XTimeTracker eaTimeTracker;
// //
// Alert Class ... // Alert Class ...
@@ -179,11 +179,11 @@ void OnTimer()
// //
HandleTradeState(); HandleTradeState();
// // //
if (eaTimeTracker.IsNewDay()) // if (eaTimeTracker.IsNewDay())
{ // {
mNumberOfSLs = 0; // mNumberOfSLs = 0;
} // }
} }
// //
@@ -521,12 +521,12 @@ void OnSignalRecieved(XSignal &signal)
return; return;
} }
// // //
if (eaMaxAllowedSLsInDay > 0 && // if (eaMaxAllowedSLsInDay > 0 &&
mNumberOfSLs >= eaMaxAllowedSLsInDay) // mNumberOfSLs >= eaMaxAllowedSLsInDay)
{ // {
return; // return;
} // }
// //
ENUM_X_SIGNAL_EXECUTION_RESULT state; ENUM_X_SIGNAL_EXECUTION_RESULT state;
@@ -593,11 +593,11 @@ void OnStopLossTriggered(const XDeal &deal)
// Finish ... // Finish ...
eaTradeHandler.Finish(deal); eaTradeHandler.Finish(deal);
// // //
if (deal.profit < 0) // if (deal.profit < 0)
{ // {
mNumberOfSLs++; // mNumberOfSLs++;
} // }
} }
// //
+198 -6
View File
@@ -1582,6 +1582,198 @@ public:
return result; return result;
} }
//
double GetMax(
int barIndex // Bar Index
)
{
//
double result = 0;
//
ENUM_X_MARKET_CYCLES cycles[];
int cyclesCount = GetAllMarketCycles(cycles);
if (!IsValidSize(cyclesCount))
{
return result;
}
//
result = GetCyclesMax(
barIndex,
cycles //
);
//
return result;
}
//
double GetMin(
int barIndex // Bar Index
)
{
//
double result = 0;
//
ENUM_X_MARKET_CYCLES cycles[];
int cyclesCount = GetAllMarketCycles(cycles);
if (!IsValidSize(cyclesCount))
{
return result;
}
//
result = GetCyclesMin(
barIndex,
cycles //
);
//
return result;
}
//
double GetMaxBullish(
int barIndex // Bar Index
)
{
//
double result = 0;
//
ENUM_X_MARKET_CYCLES cycles[];
int cyclesCount = GetAllMarketCycles(cycles);
if (!IsValidSize(cyclesCount))
{
return result;
}
//
double values[];
int valuesCount = GetBullishTrends(
values,
barIndex,
cycles //
);
if (!IsValidSize(valuesCount))
{
return result;
}
//
result = GetSpecifiedMax(values);
//
return result;
}
//
double GetMinBullish(
int barIndex // Bar Index
)
{
//
double result = 0;
//
ENUM_X_MARKET_CYCLES cycles[];
int cyclesCount = GetAllMarketCycles(cycles);
if (!IsValidSize(cyclesCount))
{
return result;
}
//
double values[];
int valuesCount = GetBullishTrends(
values,
barIndex,
cycles //
);
if (!IsValidSize(valuesCount))
{
return result;
}
//
result = GetSpecifiedMin(values);
//
return result;
}
//
double GetMaxBearish(
int barIndex // Bar Index
)
{
//
double result = 0;
//
ENUM_X_MARKET_CYCLES cycles[];
int cyclesCount = GetAllMarketCycles(cycles);
if (!IsValidSize(cyclesCount))
{
return result;
}
//
double values[];
int valuesCount = GetBearishTrends(
values,
barIndex,
cycles //
);
if (!IsValidSize(valuesCount))
{
return result;
}
//
result = GetSpecifiedMax(values);
//
return result;
}
//
double GetMinBearish(
int barIndex // Bar Index
)
{
//
double result = 0;
//
ENUM_X_MARKET_CYCLES cycles[];
int cyclesCount = GetAllMarketCycles(cycles);
if (!IsValidSize(cyclesCount))
{
return result;
}
//
double values[];
int valuesCount = GetBearishTrends(
values,
barIndex,
cycles //
);
if (!IsValidSize(valuesCount))
{
return result;
}
//
result = GetSpecifiedMin(values);
//
return result;
}
// //
double GetCyclesMax( double GetCyclesMax(
int barIndex, // Bar Index int barIndex, // Bar Index
@@ -1604,7 +1796,7 @@ public:
} }
// //
result = GetMax(trends); result = GetSpecifiedMax(trends);
// //
return result; return result;
@@ -1632,7 +1824,7 @@ public:
} }
// //
result = GetMin(trends); result = GetSpecifiedMin(trends);
// //
return result; return result;
@@ -1660,7 +1852,7 @@ public:
} }
// //
result = GetMax(trends); result = GetSpecifiedMax(trends);
// //
return result; return result;
@@ -1688,7 +1880,7 @@ public:
} }
// //
result = GetMin(trends); result = GetSpecifiedMin(trends);
// //
return result; return result;
@@ -1716,7 +1908,7 @@ public:
} }
// //
result = GetMax(trends); result = GetSpecifiedMax(trends);
// //
return result; return result;
@@ -1744,7 +1936,7 @@ public:
} }
// //
result = GetMin(trends); result = GetSpecifiedMin(trends);
// //
return result; return result;
+158 -65
View File
@@ -571,31 +571,56 @@ public:
double chhkMaxBullishLow = chhkHelper.GetMaxBullishLow(cIndex); double chhkMaxBullishLow = chhkHelper.GetMaxBullishLow(cIndex);
double chhkMinBullishLow = chhkHelper.GetMinBullishLow(cIndex); double chhkMinBullishLow = chhkHelper.GetMinBullishLow(cIndex);
//
double chmBullishPower = chmHelper.GetBullishPower(cIndex);
double chmBearishPower = chmHelper.GetBearishPower(cIndex);
//
double chmMaxBullishFast = chmHelper.GetMaxBullishFast(cIndex);
double chmMinBullishFast = chmHelper.GetMinBullishFast(cIndex);
double chmMaxBullishSlow = chmHelper.GetMaxBullishSlow(cIndex);
double chmMinBullishSlow = chmHelper.GetMinBullishSlow(cIndex);
double chmMaxBearishFast = chmHelper.GetMaxBearishFast(cIndex);
double chmMinBearishFast = chmHelper.GetMinBearishFast(cIndex);
double chmMaxBearishSlow = chmHelper.GetMaxBearishSlow(cIndex);
double chmMinBearishSlow = chmHelper.GetMinBearishSlow(cIndex);
//
double chstrBullishPower = chstrHelper.GetBullishPower(cIndex);
double chstrBearishPower = chstrHelper.GetBearishPower(cIndex);
//
double chstrMinBullish = chstrHelper.GetMinBullish(cIndex);
double chstrMaxBullish = chstrHelper.GetMaxBullish(cIndex);
double chstrMinBearish = chstrHelper.GetMinBearish(cIndex);
double chstrMaxBearish = chstrHelper.GetMaxBearish(cIndex);
// //
// XCHHK ... // XCHHK ...
int pushers = 0;
// //
if (chhkConditions.isBullishPowerUp) if (chhkConditions.isBullishPowerUp)
{ {
// //
hasLong = bool chhkHasLong =
// //
hasBullishPower && hasBullishPower &&
cBar.IsBullish() && cBar.IsBullish() &&
// hasBullishPattern && hasBullishPattern &&
hasBullishPressure && hasBullishPressure &&
cheConditions.isStrongBullish && cheConditions.isStrongBullish &&
cBar.low > chhkMinBullishHigh && cBar.low > chhkMinBullishHigh &&
chhkConditions.isBullishPowerUp // && chhkConditions.isBullishPowerUp
// chhkConditions.isBullishPowerIncreasing &&
// chhkConditions.isBearishPowerDecreasing
// //
; ;
// //
hasLong = chhkHasLong;
if (hasLong) if (hasLong)
{ {
// //
pushers++;
sl = chhkMaxBullishLow; sl = chhkMaxBullishLow;
type = POSITION_TYPE_BUY; type = POSITION_TYPE_BUY;
} }
@@ -605,24 +630,24 @@ public:
if (chhkConditions.isBearishPowerUp) if (chhkConditions.isBearishPowerUp)
{ {
// //
hasShort = bool chhkHasShort =
// //
hasBearishPower && hasBearishPower &&
cBar.IsBearish() && cBar.IsBearish() &&
// hasBearishPattern && hasBearishPattern &&
hasBearishPressure && hasBearishPressure &&
cheConditions.isStrongBearish && cheConditions.isStrongBearish &&
cBar.high < chhkMaxBearishLow && cBar.high < chhkMaxBearishLow &&
chhkConditions.isBearishPowerUp // && chhkConditions.isBearishPowerUp
// chhkConditions.isBearishPowerIncreasing &&
// chhkConditions.isBullishPowerDecreasing
// //
; ;
// //
hasShort = chhkHasShort;
if (hasShort) if (hasShort)
{ {
// //
pushers++;
sl = chhkMinBearishHigh; sl = chhkMinBearishHigh;
type = POSITION_TYPE_SELL; type = POSITION_TYPE_SELL;
} }
@@ -632,56 +657,116 @@ public:
// XCHM ... // XCHM ...
// //
// if (chmConditions.isBullishPowerUp) if (chmConditions.isBullishPowerUp)
// { {
// // //
// hasLong = bool chmHasLong =
// // //
// false && hasBullishPower &&
// hasBullishPower && cBar.IsBullish() &&
// cBar.IsBullish() && hasBullishPattern &&
// hasBullishPattern && hasBullishPressure &&
// cheConditions.isStrongBullish && cBar.low > chmMinBullishFast &&
// chmConditions.isBullishPowerUp cheConditions.isStrongBullish &&
// // chmConditions.isBullishPowerUp
// ; //
;
// // //
// if (hasLong) hasLong = chmHasLong;
// { if (hasLong)
// // {
// sl = 0; //
// type = POSITION_TYPE_BUY; pushers++;
// } sl = chmMaxBullishFast;
// } type = POSITION_TYPE_BUY;
}
}
// // //
// if (chmConditions.isBearishPowerUp) if (chmConditions.isBearishPowerUp)
// { {
// // //
// hasShort = bool chmHasShort =
// // //
// false && hasBearishPower &&
// hasBearishPower && cBar.IsBearish() &&
// cBar.IsBearish() && hasBearishPattern &&
// hasBearishPattern && hasBearishPressure &&
// cheConditions.isStrongBearish && cBar.high < chmMaxBearishFast &&
// chmConditions.isBearishPowerUp cheConditions.isStrongBearish &&
// // chmConditions.isBearishPowerUp
// ; //
;
// // //
// if (hasShort) hasShort = chmHasShort;
// { if (hasShort)
// // {
// sl = 0; //
// type = POSITION_TYPE_SELL; pushers++;
// } sl = chmMinBearishFast;
// } type = POSITION_TYPE_SELL;
}
}
// //
// XCHSTR ... // XCHSTR ...
//
if (chstrConditions.isBullishPowerUp)
{
//
bool chstrHasLong =
//
hasBullishPower &&
cBar.IsBullish() &&
hasBullishPattern &&
hasBullishPressure &&
cBar.low > chstrMinBullish &&
cheConditions.isStrongBullish &&
chstrConditions.isBullishPowerUp
//
;
//
hasLong = chstrHasLong;
if (hasLong)
{
//
pushers++;
sl = chstrMinBullish;
type = POSITION_TYPE_BUY;
}
}
//
if (chstrConditions.isBearishPowerUp)
{
//
bool chstrHasShort =
//
hasBearishPower &&
cBar.IsBearish() &&
hasBearishPattern &&
hasBearishPressure &&
cBar.high < chstrMaxBearish &&
cheConditions.isStrongBearish &&
chstrConditions.isBearishPowerUp
//
;
//
hasShort = chstrHasShort;
if (hasShort)
{
//
pushers++;
sl = chstrMaxBearish;
type = POSITION_TYPE_SELL;
}
}
// //
result = hasLong || hasShort; result = hasLong || hasShort;
if (!result) if (!result)
@@ -795,6 +880,12 @@ public:
tp // tp //
); );
//
if (pushers > 1)
{
Print("Pusher: ", pushers);
}
// //
return result; return result;
} }
@@ -911,9 +1002,9 @@ private:
pvInputs.showLevels = false; pvInputs.showLevels = false;
pvInputs.showConsolidations = false; pvInputs.showConsolidations = false;
pvInputs.showFibo1Levels = false; pvInputs.showFibo1Levels = false;
pvInputs.showFibo2Levels = true; pvInputs.showFibo2Levels = false;
pvInputs.showFibo3Levels = true; pvInputs.showFibo3Levels = false;
pvInputs.showFibo4Levels = true; pvInputs.showFibo4Levels = false;
pvInputs.showFibo5Levels = false; pvInputs.showFibo5Levels = false;
// //
@@ -931,10 +1022,10 @@ private:
cheInputs.Default(); cheInputs.Default();
// //
cheInputs.showLongExit1Line = true; cheInputs.showLongExit1Line = false;
cheInputs.showShortExit1Line = true; cheInputs.showShortExit1Line = false;
cheInputs.showLongExit2Line = true; cheInputs.showLongExit2Line = false;
cheInputs.showShortExit2Line = true; cheInputs.showShortExit2Line = false;
// //
cheHelper = new XSCXCHEHelper(); cheHelper = new XSCXCHEHelper();
@@ -1000,11 +1091,13 @@ private:
// //
chhkInputs.ignoreShadows = true; chhkInputs.ignoreShadows = true;
chhkInputs.showCurrent = true;
chhkInputs.showShort = true; //
chhkInputs.showMedium = true; chhkInputs.showCurrent = false;
chhkInputs.showLong = true; chhkInputs.showShort = false;
chhkInputs.showHind = true; chhkInputs.showMedium = false;
chhkInputs.showLong = false;
chhkInputs.showHind = false;
// //
chhkHelper = new XSCXCHHKHelper(); chhkHelper = new XSCXCHHKHelper();