last ...
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
//
|
//
|
||||||
// Imports ...
|
// Imports ...
|
||||||
#include "../Classes/x-saherelm.base.class.mq5"
|
#include "../Classes/x-saherelm.base.class.mq5"
|
||||||
|
#include "../Libraries/x-saherelm.tools.lib.mq5"
|
||||||
#include "../Classes/x-saherelm.xalert.class.mq5"
|
#include "../Classes/x-saherelm.xalert.class.mq5"
|
||||||
#include "../Libraries/x-saherelm.xtrade.lib.mq5"
|
#include "../Libraries/x-saherelm.xtrade.lib.mq5"
|
||||||
#include "../Classes/x-saherelm.xaccount.class.mq5"
|
#include "../Classes/x-saherelm.xaccount.class.mq5"
|
||||||
@@ -4232,6 +4233,109 @@ public:
|
|||||||
mTrailBasedOnProfit = value;
|
mTrailBasedOnProfit = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Recovery ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool AllowRecover()
|
||||||
|
{
|
||||||
|
return mAllowRecover;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void AllowRecover(bool value)
|
||||||
|
{
|
||||||
|
mAllowRecover = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double RecoveryTPPoint()
|
||||||
|
{
|
||||||
|
return mRecoveryTPPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void RecoveryTPPoint(double value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mRecoveryTPPoint = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double RecoverySLPoint()
|
||||||
|
{
|
||||||
|
return mRecoverySLPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void RecoverySLPoint(double value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mRecoverySLPoint = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool RecoverBasedOnPressures()
|
||||||
|
{
|
||||||
|
return mRecoverBasedOnPressures;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void RecoverBasedOnPressures(bool value)
|
||||||
|
{
|
||||||
|
mRecoverBasedOnPressures = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int MaxAllowedRecover()
|
||||||
|
{
|
||||||
|
return mMaxAllowedRecover;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void MaxAllowedRecover(int value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mMaxAllowedRecover = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double RecoveryVolumeMultiplier()
|
||||||
|
{
|
||||||
|
return mRecoveryVolumeMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void RecoveryVolumeMultiplier(double value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mRecoveryVolumeMultiplier = value;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hedging ...
|
// Hedging ...
|
||||||
|
|
||||||
@@ -4304,9 +4408,10 @@ public:
|
|||||||
// First Step of Trade Handling ...
|
// First Step of Trade Handling ...
|
||||||
// Since Must Call when a Signal Executed ...
|
// Since Must Call when a Signal Executed ...
|
||||||
void AddData(
|
void AddData(
|
||||||
XSignal &signal, // Executed Signal
|
XSignal &signal, // Executed Signal
|
||||||
double commission = 0, // Commission
|
double commission = 0, // Commission
|
||||||
bool forceTrail = false //
|
bool forceTrail = false, // Force Signal Trailling Stop
|
||||||
|
bool forceRecover = false // Force Signal Recovery
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -4345,6 +4450,22 @@ public:
|
|||||||
item.trailBasedOnProfit = mTrailBasedOnProfit;
|
item.trailBasedOnProfit = mTrailBasedOnProfit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Recovery Configuration ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Force Recovery used to implement Recovery for
|
||||||
|
// Custom Positions ...
|
||||||
|
if (mAllowRecover || forceRecover)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
item.allowRecover = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
item.recoveryTPPoint = mRecoveryTPPoint;
|
||||||
|
item.recoverySLPoint = mRecoverySLPoint;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
Add(item);
|
Add(item);
|
||||||
|
|
||||||
@@ -4585,6 +4706,8 @@ public:
|
|||||||
double trailStepInPoints = mData[i].trailStepInPoint;
|
double trailStepInPoints = mData[i].trailStepInPoint;
|
||||||
double trailStartInPoint = mData[i].trailStartInPoint;
|
double trailStartInPoint = mData[i].trailStartInPoint;
|
||||||
bool trailBasedOnProfit = mData[i].trailBasedOnProfit;
|
bool trailBasedOnProfit = mData[i].trailBasedOnProfit;
|
||||||
|
double recoveryTPPoint = mData[i].recoveryTPPoint;
|
||||||
|
double recoverySLPoint = mData[i].recoverySLPoint;
|
||||||
|
|
||||||
//
|
//
|
||||||
XPosition iPosition;
|
XPosition iPosition;
|
||||||
@@ -4608,6 +4731,49 @@ public:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retriece CIndex Bar ...
|
||||||
|
XOHCL cBar;
|
||||||
|
bool isBarInited = cBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
if (!isBarInited)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// For Trend ...
|
||||||
|
XOHCL tmpHSW[];
|
||||||
|
XOHCL tmpLSW[];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Bullish/Bearish Patterns and Trends ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish ...
|
||||||
|
bool hasBullishPower = cBar.HasBullishPower();
|
||||||
|
bool hasBullishPattern = HasBullishPattern(cBar);
|
||||||
|
bool hasBullishPressure = cBar.HasBullishPressure();
|
||||||
|
bool isBullishTrend = cBar.HasBullishTrend(
|
||||||
|
tmpHSW,
|
||||||
|
tmpLSW,
|
||||||
|
true //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish ...
|
||||||
|
bool hasBearishPower = cBar.HasBearishPower();
|
||||||
|
bool hasBearishPattern = HasBearishPattern(cBar);
|
||||||
|
bool hasBearishPressure = cBar.HasBearishPressure();
|
||||||
|
bool isBearishTrend = cBar.HasBearishTrend(
|
||||||
|
tmpHSW,
|
||||||
|
tmpLSW,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Trail ...
|
// Trail ...
|
||||||
if (mData[i].allowTrailStop)
|
if (mData[i].allowTrailStop)
|
||||||
@@ -4779,7 +4945,79 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Grid ...
|
// Recovery ...
|
||||||
|
if (mData[i].allowRecover)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Do Recovery ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Profit Must be Negative ...
|
||||||
|
if (
|
||||||
|
profit < 0 &&
|
||||||
|
recoveryTPPoint > 0 &&
|
||||||
|
recoverySLPoint > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Current Profit ...
|
||||||
|
double drawdownInPoints = (MathAbs(profit) / volume);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Try to Remove SL of Recovery Signals ...
|
||||||
|
if (iPosition.sl > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string comment = "EQM Recover Remove SL";
|
||||||
|
bool isSLRemoved = mTrader.Modify(
|
||||||
|
ticket,
|
||||||
|
0,
|
||||||
|
iPosition.tp,
|
||||||
|
comment //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check Position TP ...
|
||||||
|
double rewardInPoints = iPosition.GetReward() / points;
|
||||||
|
if (rewardInPoints != recoveryTPPoint)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double reward = recoveryTPPoint * points;
|
||||||
|
double tp =
|
||||||
|
isLong
|
||||||
|
? iPosition.entry + reward
|
||||||
|
: iPosition.entry - reward;
|
||||||
|
string comment = "EQM Recover Fix TP";
|
||||||
|
bool isSLRemoved = mTrader.Modify(
|
||||||
|
ticket,
|
||||||
|
iPosition.sl,
|
||||||
|
tp,
|
||||||
|
comment //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check Price Distance For Recovery ...
|
||||||
|
bool canLookForPressure =
|
||||||
|
//
|
||||||
|
// in 75% ...
|
||||||
|
drawdownInPoints > ((recoverySLPoint / 3) * 2)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (canLookForPressure)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Looking for Signal Direction and
|
||||||
|
// Founding Pressure ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4802,6 +5040,7 @@ public:
|
|||||||
// TODO:
|
// TODO:
|
||||||
// Here we can apply Same type or Opposit Type
|
// Here we can apply Same type or Opposit Type
|
||||||
// Signals behaviour ...
|
// Signals behaviour ...
|
||||||
|
// also Implement Signal Filtering ...
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -4829,6 +5068,15 @@ protected:
|
|||||||
double mTrailStartInPoint; // Trail Starts in Points of Profit
|
double mTrailStartInPoint; // Trail Starts in Points of Profit
|
||||||
double mTrailStepInPoint; // Profit Must Grows Point to do Trailling
|
double mTrailStepInPoint; // Profit Must Grows Point to do Trailling
|
||||||
|
|
||||||
|
//
|
||||||
|
// Recovery ...
|
||||||
|
bool mAllowRecover; // Allow Signal Recovery
|
||||||
|
int mMaxAllowedRecover; // Max Allowed Recovery
|
||||||
|
double mRecoveryTPPoint; // Recovery TP in Points
|
||||||
|
double mRecoverySLPoint; // Recovery SL in Points
|
||||||
|
bool mRecoverBasedOnPressures; // Do Recovery based on Market Pressures
|
||||||
|
double mRecoveryVolumeMultiplier; // Recovery Volume Multiplier
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hedging ...
|
// Hedging ...
|
||||||
bool mAllowHedging; // Hedge Trades
|
bool mAllowHedging; // Hedge Trades
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ double eaAllowLong = true; // Allow Long Positions
|
|||||||
double eaAllowShort = true; // Allow Short Positions
|
double eaAllowShort = true; // Allow Short Positions
|
||||||
|
|
||||||
//
|
//
|
||||||
int eaMaxAllowedLongs = 1; // Max Allowed Long Positions
|
int eaMaxAllowedLongs = 0; // Max Allowed Long Positions
|
||||||
int eaMaxAllowedShorts = 1; // Max Allowed Short Positions
|
int eaMaxAllowedShorts = 0; // Max Allowed Short Positions
|
||||||
|
|
||||||
//
|
//
|
||||||
double eaTPPoint = 100; // Static TP Point
|
double eaTPPoint = 100; // Static TP Point
|
||||||
@@ -259,8 +259,8 @@ bool InitialEA()
|
|||||||
// Initialize Trade Handler ...
|
// Initialize Trade Handler ...
|
||||||
eaTradeHandler = new XSCXTradeHandler(eaTrader);
|
eaTradeHandler = new XSCXTradeHandler(eaTrader);
|
||||||
eaTradeHandler.SetAlertPrefix(ShortName + "> TradeHandler");
|
eaTradeHandler.SetAlertPrefix(ShortName + "> TradeHandler");
|
||||||
eaTradeHandler.SaveTrades(false);
|
eaTradeHandler.SaveTrades(true);
|
||||||
eaTradeHandler.SaveSignals(false);
|
eaTradeHandler.SaveSignals(true);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Configure Hedging ...
|
// Configure Hedging ...
|
||||||
@@ -277,6 +277,15 @@ bool InitialEA()
|
|||||||
eaTradeHandler.IgnoreTPOnTrail(true);
|
eaTradeHandler.IgnoreTPOnTrail(true);
|
||||||
eaTradeHandler.TrailBasedOnProfit(true);
|
eaTradeHandler.TrailBasedOnProfit(true);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Configure Recovery ...
|
||||||
|
eaTradeHandler.AllowRecover(true);
|
||||||
|
eaTradeHandler.MaxAllowedRecover(2);
|
||||||
|
eaTradeHandler.RecoveryTPPoint(eaTPPoint);
|
||||||
|
eaTradeHandler.RecoverySLPoint(eaSLPoint);
|
||||||
|
eaTradeHandler.RecoveryVolumeMultiplier(2);
|
||||||
|
eaTradeHandler.RecoverBasedOnPressures(false);
|
||||||
|
|
||||||
//
|
//
|
||||||
XSymbolParser symbolParser;
|
XSymbolParser symbolParser;
|
||||||
|
|
||||||
|
|||||||
@@ -627,6 +627,128 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetMaxLongExit(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
double le1 = GetLongExit1(barIndex);
|
||||||
|
double le2 = GetLongExit2(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (
|
||||||
|
le1 == 0 ||
|
||||||
|
le2 == 0 ||
|
||||||
|
le1 == EMPTY_VALUE ||
|
||||||
|
le2 == EMPTY_VALUE)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = MathMax(le1, le1);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetMinLongExit(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
double le1 = GetLongExit1(barIndex);
|
||||||
|
double le2 = GetLongExit2(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (
|
||||||
|
le1 == 0 ||
|
||||||
|
le2 == 0 ||
|
||||||
|
le1 == EMPTY_VALUE ||
|
||||||
|
le2 == EMPTY_VALUE)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = MathMin(le1, le1);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetMaxShortExit(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
double le1 = GetShortExit1(barIndex);
|
||||||
|
double le2 = GetShortExit2(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (
|
||||||
|
le1 == 0 ||
|
||||||
|
le2 == 0 ||
|
||||||
|
le1 == EMPTY_VALUE ||
|
||||||
|
le2 == EMPTY_VALUE)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = MathMax(le1, le1);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetMinShortExit(
|
||||||
|
int barIndex // Bar Index
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
double le1 = GetShortExit1(barIndex);
|
||||||
|
double le2 = GetShortExit2(barIndex);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (
|
||||||
|
le1 == 0 ||
|
||||||
|
le2 == 0 ||
|
||||||
|
le1 == EMPTY_VALUE ||
|
||||||
|
le2 == EMPTY_VALUE)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = MathMin(le1, le1);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Conditions ...
|
||||||
|
|
||||||
//
|
//
|
||||||
bool GetConditions(
|
bool GetConditions(
|
||||||
XCHEConditions &conditions, //
|
XCHEConditions &conditions, //
|
||||||
|
|||||||
@@ -67,6 +67,9 @@ string XActionToken = "A";
|
|||||||
string XDirectionalToken = "D";
|
string XDirectionalToken = "D";
|
||||||
string XINDirectionalToken = "IND";
|
string XINDirectionalToken = "IND";
|
||||||
|
|
||||||
|
//
|
||||||
|
string XRecoveryToken = "XRCV";
|
||||||
|
|
||||||
//
|
//
|
||||||
// Available Order Modes ...
|
// Available Order Modes ...
|
||||||
enum ENUM_X_ORDER_MODES
|
enum ENUM_X_ORDER_MODES
|
||||||
@@ -3393,12 +3396,15 @@ struct XTradeData
|
|||||||
ENUM_X_POSITION_TYPES type; // Position Type
|
ENUM_X_POSITION_TYPES type; // Position Type
|
||||||
|
|
||||||
//
|
//
|
||||||
ulong ticket; // Position Ticket
|
ulong ticket; // Position Ticket
|
||||||
double profit; // Profit on Close
|
double swap; // Swap
|
||||||
double commission; // Commission
|
double profit; // Profit on Close
|
||||||
double swap; // Swap
|
double commission; // Commission
|
||||||
string message; // Close Reason
|
double maxDrawdown; // Max Position Drawdown
|
||||||
datetime endTime; // End Time
|
string message; // Close Reason
|
||||||
|
datetime endTime; // End Time
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
@@ -3496,6 +3502,14 @@ struct XTradeData
|
|||||||
profit = _position.profit;
|
profit = _position.profit;
|
||||||
swap = _position.swap;
|
swap = _position.swap;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (profit < 0 &&
|
||||||
|
(maxDrawdown == 0 ||
|
||||||
|
MathAbs(profit) > MathAbs(maxDrawdown)))
|
||||||
|
{
|
||||||
|
profit = maxDrawdown;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -3523,9 +3537,11 @@ struct XTradeData
|
|||||||
profit = 0;
|
profit = 0;
|
||||||
volume = 0;
|
volume = 0;
|
||||||
commission = 0;
|
commission = 0;
|
||||||
|
maxDrawdown = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
ResetTrail();
|
ResetTrail();
|
||||||
|
ResetRecovery();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -3722,6 +3738,7 @@ struct XTradeData
|
|||||||
ToString("Profit", profit) +
|
ToString("Profit", profit) +
|
||||||
ToString("Commission", commission) +
|
ToString("Commission", commission) +
|
||||||
ToString("Swap", swap) +
|
ToString("Swap", swap) +
|
||||||
|
ToString("Max Drawdown", maxDrawdown) +
|
||||||
ToString("End Time", endTime) +
|
ToString("End Time", endTime) +
|
||||||
ToString("Age", age) +
|
ToString("Age", age) +
|
||||||
ToString("Message", message)
|
ToString("Message", message)
|
||||||
@@ -3744,7 +3761,7 @@ struct XTradeData
|
|||||||
// Trailing Stop ....
|
// Trailing Stop ....
|
||||||
|
|
||||||
//
|
//
|
||||||
bool allowTrailStop; // Specified Position Can Trail Stop or not
|
bool allowTrailStop; // Specified Position Can Trail Stop or not
|
||||||
bool ignoreTPOnTrail; // Ignore TP when SL Trailed
|
bool ignoreTPOnTrail; // Ignore TP when SL Trailed
|
||||||
bool trailBasedOnProfit; // Do Trail Based on Profit Points
|
bool trailBasedOnProfit; // Do Trail Based on Profit Points
|
||||||
int trailLevel; // Last Trail Level
|
int trailLevel; // Last Trail Level
|
||||||
@@ -3764,6 +3781,24 @@ struct XTradeData
|
|||||||
trailBasedOnProfit = false;
|
trailBasedOnProfit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Recovery ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool allowRecover; // Allow Recover Specified Position
|
||||||
|
double recoveryTPPoint; // Recovery TP Point
|
||||||
|
double recoverySLPoint; // Recovery SL Point
|
||||||
|
int maxAllowedRecover; // Max Allowed Recovery
|
||||||
|
|
||||||
|
//
|
||||||
|
void ResetRecovery()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
allowRecover = false;
|
||||||
|
recoveryTPPoint = 0;
|
||||||
|
recoverySLPoint = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5286,6 +5321,121 @@ ulong ExtractParentTicket(string value)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XRecovery ...
|
||||||
|
|
||||||
|
//
|
||||||
|
string GenerateRecoveryTag(ulong ticket)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return Surround(
|
||||||
|
XRecoveryToken,
|
||||||
|
ticket //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ulong ExtractRecoveredTicket(string value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return ParseLongSurrounded(
|
||||||
|
value,
|
||||||
|
XRecoveryToken //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract Recoveries ...
|
||||||
|
template <typename T>
|
||||||
|
int ExtractRecoveries(
|
||||||
|
T &source[],
|
||||||
|
T &dest[] // Result ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(dest);
|
||||||
|
|
||||||
|
//
|
||||||
|
int sourceCount = ArraySize(source);
|
||||||
|
if (!IsValidSize(sourceCount))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < sourceCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
T iSource = source[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
ulong isRecovery = ExtractRecoveredTicket(iSource.comment) > 0;
|
||||||
|
if (isRecovery)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iSource,
|
||||||
|
dest //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(dest);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract Specified Position's Recoveries ...
|
||||||
|
int ExtractRecoveries(
|
||||||
|
ulong ticket,
|
||||||
|
XPosition &source[],
|
||||||
|
XPosition &dest[] // Result ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(dest);
|
||||||
|
|
||||||
|
//
|
||||||
|
int sourceCount = ArraySize(source);
|
||||||
|
if (!IsValidSize(sourceCount))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < sourceCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPosition iSource = source[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
ulong isRecovery = ExtractRecoveredTicket(iSource.comment) > 0;
|
||||||
|
if (isRecovery && iSource.ticket == ticket)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iSource,
|
||||||
|
dest //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(dest);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// SL Trails ...
|
// SL Trails ...
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,78 @@ public:
|
|||||||
//
|
//
|
||||||
// Getter / Setter (s) ...
|
// Getter / Setter (s) ...
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_TIMEFRAMES AnalizePeriod()
|
||||||
|
{
|
||||||
|
return mAnalizePeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void AnalizePeriod(ENUM_TIMEFRAMES value)
|
||||||
|
{
|
||||||
|
mAnalizePeriod = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool DrawImportantAreas()
|
||||||
|
{
|
||||||
|
return mDrawImportantAreas;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void DrawImportantAreas(bool value)
|
||||||
|
{
|
||||||
|
mDrawImportantAreas = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool EnableXCHE()
|
||||||
|
{
|
||||||
|
return mEnableXCHE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void EnableXCHE(bool value)
|
||||||
|
{
|
||||||
|
mEnableXCHE = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool EnableXCHM()
|
||||||
|
{
|
||||||
|
return mEnableXCHM;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void EnableXCHM(bool value)
|
||||||
|
{
|
||||||
|
mEnableXCHM = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool EnableXCHHK()
|
||||||
|
{
|
||||||
|
return mEnableXCHHK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void EnableXCHHK(bool value)
|
||||||
|
{
|
||||||
|
mEnableXCHHK = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool EnableXCHSTR()
|
||||||
|
{
|
||||||
|
return mEnableXCHSTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void EnableXCHSTR(bool value)
|
||||||
|
{
|
||||||
|
mEnableXCHSTR = value;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides ...
|
// Overrides ...
|
||||||
|
|
||||||
@@ -150,10 +222,6 @@ public:
|
|||||||
bool hasLong = false;
|
bool hasLong = false;
|
||||||
bool hasShort = false;
|
bool hasShort = false;
|
||||||
|
|
||||||
//
|
|
||||||
// Draw Support/Resistance/OB(s)/FVG(s) ...
|
|
||||||
bool drawImportantAreas = true;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve Conditions ...
|
// Retrieve Conditions ...
|
||||||
|
|
||||||
@@ -316,7 +384,7 @@ public:
|
|||||||
if (hasSupport)
|
if (hasSupport)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (drawImportantAreas)
|
if (mDrawImportantAreas)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
DrawSupport(
|
DrawSupport(
|
||||||
@@ -346,7 +414,7 @@ public:
|
|||||||
if (hasResistance)
|
if (hasResistance)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (drawImportantAreas)
|
if (mDrawImportantAreas)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
DrawResistance(
|
DrawResistance(
|
||||||
@@ -378,7 +446,7 @@ public:
|
|||||||
if (hasBullishOB)
|
if (hasBullishOB)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (drawImportantAreas)
|
if (mDrawImportantAreas)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
DrawBullishOrderBlock(
|
DrawBullishOrderBlock(
|
||||||
@@ -407,7 +475,7 @@ public:
|
|||||||
if (hasBearishOB)
|
if (hasBearishOB)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (drawImportantAreas)
|
if (mDrawImportantAreas)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
DrawBearishOrderBlock(
|
DrawBearishOrderBlock(
|
||||||
@@ -445,7 +513,7 @@ public:
|
|||||||
bullishFVG = aBar;
|
bullishFVG = aBar;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (drawImportantAreas)
|
if (mDrawImportantAreas)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
DrawBullishFVG(
|
DrawBullishFVG(
|
||||||
@@ -482,7 +550,7 @@ public:
|
|||||||
bearishFVG = aBar;
|
bearishFVG = aBar;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (drawImportantAreas)
|
if (mDrawImportantAreas)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
DrawBearishFVG(
|
DrawBearishFVG(
|
||||||
@@ -596,174 +664,330 @@ public:
|
|||||||
double chstrMaxBearish = chstrHelper.GetMaxBearish(cIndex);
|
double chstrMaxBearish = chstrHelper.GetMaxBearish(cIndex);
|
||||||
|
|
||||||
//
|
//
|
||||||
// XCHHK ...
|
double cheMaxLE = cheHelper.GetMaxLongExit(cIndex);
|
||||||
|
double cheMinLE = cheHelper.GetMinLongExit(cIndex);
|
||||||
|
double cheMaxSE = cheHelper.GetMaxShortExit(cIndex);
|
||||||
|
double cheMinSE = cheHelper.GetMinShortExit(cIndex);
|
||||||
|
|
||||||
|
//
|
||||||
int pushers = 0;
|
int pushers = 0;
|
||||||
|
string signallers[];
|
||||||
|
|
||||||
//
|
//
|
||||||
if (chhkConditions.isBullishPowerUp)
|
// XCHHK ...
|
||||||
|
if (mEnableXCHHK)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool chhkHasLong =
|
if (chhkConditions.isBullishPowerUp)
|
||||||
//
|
|
||||||
hasBullishPower &&
|
|
||||||
cBar.IsBullish() &&
|
|
||||||
hasBullishPattern &&
|
|
||||||
hasBullishPressure &&
|
|
||||||
cheConditions.isStrongBullish &&
|
|
||||||
cBar.low > chhkMinBullishHigh &&
|
|
||||||
chhkConditions.isBullishPowerUp
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
hasLong = chhkHasLong;
|
|
||||||
if (hasLong)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
pushers++;
|
bool chhkHasLong =
|
||||||
sl = chhkMaxBullishLow;
|
//
|
||||||
type = POSITION_TYPE_BUY;
|
hasBullishPower &&
|
||||||
|
cBar.IsBullish() &&
|
||||||
|
hasBullishPattern &&
|
||||||
|
hasBullishPressure &&
|
||||||
|
cheConditions.isStrongBullish &&
|
||||||
|
cBar.low > chhkMinBullishHigh &&
|
||||||
|
chhkConditions.isBullishPowerUp
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (chhkHasLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasLong = chhkHasLong;
|
||||||
|
if (hasLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pushers++;
|
||||||
|
Add(
|
||||||
|
"XCHHK",
|
||||||
|
signallers //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = chhkMaxBullishLow;
|
||||||
|
type = POSITION_TYPE_BUY;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (chhkConditions.isBearishPowerUp)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool chhkHasShort =
|
|
||||||
//
|
|
||||||
hasBearishPower &&
|
|
||||||
cBar.IsBearish() &&
|
|
||||||
hasBearishPattern &&
|
|
||||||
hasBearishPressure &&
|
|
||||||
cheConditions.isStrongBearish &&
|
|
||||||
cBar.high < chhkMaxBearishLow &&
|
|
||||||
chhkConditions.isBearishPowerUp
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
hasShort = chhkHasShort;
|
if (chhkConditions.isBearishPowerUp)
|
||||||
if (hasShort)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
pushers++;
|
bool chhkHasShort =
|
||||||
sl = chhkMinBearishHigh;
|
//
|
||||||
type = POSITION_TYPE_SELL;
|
hasBearishPower &&
|
||||||
|
cBar.IsBearish() &&
|
||||||
|
hasBearishPattern &&
|
||||||
|
hasBearishPressure &&
|
||||||
|
cheConditions.isStrongBearish &&
|
||||||
|
cBar.high < chhkMaxBearishLow &&
|
||||||
|
chhkConditions.isBearishPowerUp
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (chhkHasShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasShort = chhkHasShort;
|
||||||
|
if (hasShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pushers++;
|
||||||
|
Add(
|
||||||
|
"XCHHK",
|
||||||
|
signallers //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = chhkMinBearishHigh;
|
||||||
|
type = POSITION_TYPE_SELL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// XCHM ...
|
// XCHM ...
|
||||||
|
if (mEnableXCHM)
|
||||||
//
|
|
||||||
if (chmConditions.isBullishPowerUp)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool chmHasLong =
|
if (chmConditions.isBullishPowerUp)
|
||||||
//
|
|
||||||
hasBullishPower &&
|
|
||||||
cBar.IsBullish() &&
|
|
||||||
hasBullishPattern &&
|
|
||||||
hasBullishPressure &&
|
|
||||||
cBar.low > chmMinBullishFast &&
|
|
||||||
cheConditions.isStrongBullish &&
|
|
||||||
chmConditions.isBullishPowerUp
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
hasLong = chmHasLong;
|
|
||||||
if (hasLong)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
pushers++;
|
bool chmHasLong =
|
||||||
sl = chmMaxBullishFast;
|
//
|
||||||
type = POSITION_TYPE_BUY;
|
hasBullishPower &&
|
||||||
|
cBar.IsBullish() &&
|
||||||
|
hasBullishPattern &&
|
||||||
|
hasBullishPressure &&
|
||||||
|
cBar.low > chmMinBullishFast &&
|
||||||
|
cheConditions.isStrongBullish &&
|
||||||
|
chmConditions.isBullishPowerUp
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (chmHasLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasLong = chmHasLong;
|
||||||
|
if (hasLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pushers++;
|
||||||
|
Add(
|
||||||
|
"XCHM",
|
||||||
|
signallers //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = chmMaxBullishFast;
|
||||||
|
type = POSITION_TYPE_BUY;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (chmConditions.isBearishPowerUp)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool chmHasShort =
|
|
||||||
//
|
|
||||||
hasBearishPower &&
|
|
||||||
cBar.IsBearish() &&
|
|
||||||
hasBearishPattern &&
|
|
||||||
hasBearishPressure &&
|
|
||||||
cBar.high < chmMaxBearishFast &&
|
|
||||||
cheConditions.isStrongBearish &&
|
|
||||||
chmConditions.isBearishPowerUp
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
hasShort = chmHasShort;
|
if (chmConditions.isBearishPowerUp)
|
||||||
if (hasShort)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
pushers++;
|
bool chmHasShort =
|
||||||
sl = chmMinBearishFast;
|
//
|
||||||
type = POSITION_TYPE_SELL;
|
hasBearishPower &&
|
||||||
|
cBar.IsBearish() &&
|
||||||
|
hasBearishPattern &&
|
||||||
|
hasBearishPressure &&
|
||||||
|
cBar.high < chmMaxBearishFast &&
|
||||||
|
cheConditions.isStrongBearish &&
|
||||||
|
chmConditions.isBearishPowerUp
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (chmHasShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasShort = chmHasShort;
|
||||||
|
if (hasShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pushers++;
|
||||||
|
Add(
|
||||||
|
"XCHM",
|
||||||
|
signallers //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = chmMinBearishFast;
|
||||||
|
type = POSITION_TYPE_SELL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// XCHSTR ...
|
// XCHSTR ...
|
||||||
|
if (mEnableXCHSTR)
|
||||||
//
|
|
||||||
if (chstrConditions.isBullishPowerUp)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool chstrHasLong =
|
if (chstrConditions.isBullishPowerUp)
|
||||||
//
|
|
||||||
hasBullishPower &&
|
|
||||||
cBar.IsBullish() &&
|
|
||||||
hasBullishPattern &&
|
|
||||||
hasBullishPressure &&
|
|
||||||
cBar.low > chstrMinBullish &&
|
|
||||||
cheConditions.isStrongBullish &&
|
|
||||||
chstrConditions.isBullishPowerUp
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
hasLong = chstrHasLong;
|
|
||||||
if (hasLong)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
pushers++;
|
bool chstrHasLong =
|
||||||
sl = chstrMinBullish;
|
//
|
||||||
type = POSITION_TYPE_BUY;
|
hasBullishPower &&
|
||||||
|
cBar.IsBullish() &&
|
||||||
|
hasBullishPattern &&
|
||||||
|
hasBullishPressure &&
|
||||||
|
cBar.low > chstrMinBullish &&
|
||||||
|
cheConditions.isStrongBullish &&
|
||||||
|
chstrConditions.isBullishPowerUp
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (chstrHasLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasLong = chstrHasLong;
|
||||||
|
if (hasLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pushers++;
|
||||||
|
Add(
|
||||||
|
"XCHSTR",
|
||||||
|
signallers //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = chstrMinBullish;
|
||||||
|
type = POSITION_TYPE_BUY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (chstrConditions.isBearishPowerUp)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool chstrHasShort =
|
||||||
|
//
|
||||||
|
hasBearishPower &&
|
||||||
|
cBar.IsBearish() &&
|
||||||
|
hasBearishPattern &&
|
||||||
|
hasBearishPressure &&
|
||||||
|
cBar.high < chstrMaxBearish &&
|
||||||
|
cheConditions.isStrongBearish &&
|
||||||
|
chstrConditions.isBearishPowerUp
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (chstrHasShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasShort = chstrHasShort;
|
||||||
|
if (hasShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pushers++;
|
||||||
|
Add(
|
||||||
|
"XCHSTR",
|
||||||
|
signallers //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = chstrMaxBearish;
|
||||||
|
type = POSITION_TYPE_SELL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (chstrConditions.isBearishPowerUp)
|
// XCHE ...
|
||||||
|
if (mEnableXCHE)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool chstrHasShort =
|
if (cheConditions.isStrongBullish)
|
||||||
//
|
|
||||||
hasBearishPower &&
|
|
||||||
cBar.IsBearish() &&
|
|
||||||
hasBearishPattern &&
|
|
||||||
hasBearishPressure &&
|
|
||||||
cBar.high < chstrMaxBearish &&
|
|
||||||
cheConditions.isStrongBearish &&
|
|
||||||
chstrConditions.isBearishPowerUp
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
hasShort = chstrHasShort;
|
|
||||||
if (hasShort)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
pushers++;
|
bool cheHasLong =
|
||||||
sl = chstrMaxBearish;
|
//
|
||||||
type = POSITION_TYPE_SELL;
|
HasCheLast() &&
|
||||||
|
cheMinLE > 0 &&
|
||||||
|
hasBullishPower &&
|
||||||
|
cBar.IsBullish() &&
|
||||||
|
hasBullishPattern &&
|
||||||
|
hasBullishPressure &&
|
||||||
|
cheMinLE > GetMaxCHELast() &&
|
||||||
|
cheConditions.isStrongBullish
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (cheHasLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasLong = cheHasLong;
|
||||||
|
if (hasLong)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pushers++;
|
||||||
|
Add(
|
||||||
|
"XCHE",
|
||||||
|
signallers //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = cheMinLE;
|
||||||
|
type = POSITION_TYPE_BUY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (cheConditions.isStrongBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool cheHasShort =
|
||||||
|
//
|
||||||
|
HasCheLast() &&
|
||||||
|
cheMaxSE > 0 &&
|
||||||
|
hasBearishPower &&
|
||||||
|
cBar.IsBearish() &&
|
||||||
|
hasBearishPattern &&
|
||||||
|
hasBearishPressure &&
|
||||||
|
cheMaxSE < GetMinCHELast() &&
|
||||||
|
cheConditions.isStrongBearish
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (cheHasShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasShort = cheHasShort;
|
||||||
|
if (hasShort)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pushers++;
|
||||||
|
Add(
|
||||||
|
"XCHE",
|
||||||
|
signallers //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = cheMaxSE;
|
||||||
|
type = POSITION_TYPE_SELL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -868,22 +1092,33 @@ public:
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Preparing Signal ...
|
// Preparing Signal ...
|
||||||
result = signal.Prepare(
|
if (pushers > 0)
|
||||||
mSymbol,
|
{
|
||||||
GetTag(),
|
//
|
||||||
mPeriod,
|
result = signal.Prepare(
|
||||||
type,
|
mSymbol,
|
||||||
mode,
|
signallers[0],
|
||||||
entry,
|
mPeriod,
|
||||||
mVolume,
|
type,
|
||||||
sl,
|
mode,
|
||||||
tp //
|
entry,
|
||||||
);
|
mVolume,
|
||||||
|
sl,
|
||||||
|
tp //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (pushers > 1)
|
if (pushers > 1)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
Print("======");
|
||||||
Print("Pusher: ", pushers);
|
Print("Pusher: ", pushers);
|
||||||
|
ArrayPrint(signallers);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -899,6 +1134,15 @@ protected:
|
|||||||
//
|
//
|
||||||
ENUM_TIMEFRAMES mAnalizePeriod; // Important Area Detect Time Frame
|
ENUM_TIMEFRAMES mAnalizePeriod; // Important Area Detect Time Frame
|
||||||
|
|
||||||
|
//
|
||||||
|
bool mDrawImportantAreas; // Draw Important Areas where Founded in Analyzing Time Frame
|
||||||
|
|
||||||
|
//
|
||||||
|
bool mEnableXCHE; // Enable XCHE Signaller
|
||||||
|
bool mEnableXCHM; // Enable XCHM Signaller
|
||||||
|
bool mEnableXCHHK; // Enable XCHHK Signaller
|
||||||
|
bool mEnableXCHSTR; // Enable XCHSTR Signaller
|
||||||
|
|
||||||
//
|
//
|
||||||
XOHCL support;
|
XOHCL support;
|
||||||
XOHCL resistance;
|
XOHCL resistance;
|
||||||
@@ -951,6 +1195,15 @@ private:
|
|||||||
// Configurations for required Indicators ...
|
// Configurations for required Indicators ...
|
||||||
void PrepareRequirements()
|
void PrepareRequirements()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
mDrawImportantAreas = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
mEnableXCHE = true;
|
||||||
|
mEnableXCHM = true;
|
||||||
|
mEnableXCHHK = true;
|
||||||
|
mEnableXCHSTR = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
support.Clean();
|
support.Clean();
|
||||||
supportTime = NULL;
|
supportTime = NULL;
|
||||||
@@ -1404,6 +1657,21 @@ private:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasCheLast()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
IsValid(cheLastLongExitTime) ||
|
||||||
|
IsValid(cheLastShortExitTime);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user