last ...
This commit is contained in:
@@ -43,8 +43,8 @@ double eaAllowLong = true; // Allow Long Positions
|
|||||||
double eaAllowShort = true; // Allow Short Positions
|
double eaAllowShort = true; // Allow Short Positions
|
||||||
|
|
||||||
//
|
//
|
||||||
int eaMaxAllowedLongs = 0; // Max Allowed Long Positions
|
int eaMaxAllowedLongs = 1; // Max Allowed Long Positions
|
||||||
int eaMaxAllowedShorts = 0; // Max Allowed Short Positions
|
int eaMaxAllowedShorts = 1; // Max Allowed Short Positions
|
||||||
|
|
||||||
//
|
//
|
||||||
input double eaTPPoint = 200; // Static TP Point
|
input double eaTPPoint = 200; // Static TP Point
|
||||||
@@ -55,7 +55,7 @@ bool eaIgnoreTP = false; // Ignore TP
|
|||||||
bool eaIgnoreSL = false; // Ignore SL
|
bool eaIgnoreSL = false; // Ignore SL
|
||||||
|
|
||||||
//
|
//
|
||||||
double eaR2R = 2; // Risk to Reward Ratio
|
double eaR2R = 1.5; // Risk to Reward Ratio
|
||||||
|
|
||||||
//
|
//
|
||||||
// Variables ...
|
// Variables ...
|
||||||
@@ -243,8 +243,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(true);
|
eaTradeHandler.SaveTrades(false);
|
||||||
eaTradeHandler.SaveSignals(true);
|
eaTradeHandler.SaveSignals(false);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Configure Hedging ...
|
// Configure Hedging ...
|
||||||
@@ -359,7 +359,7 @@ bool InitialEA()
|
|||||||
eurusdSymbol,
|
eurusdSymbol,
|
||||||
PERIOD_M5,
|
PERIOD_M5,
|
||||||
eaVolume,
|
eaVolume,
|
||||||
1, // eaR2R, // R2R ...
|
eaR2R, // R2R ...
|
||||||
eaSlippage,
|
eaSlippage,
|
||||||
magicNumber,
|
magicNumber,
|
||||||
true, // Ignore Signal Execution
|
true, // Ignore Signal Execution
|
||||||
@@ -368,7 +368,7 @@ bool InitialEA()
|
|||||||
eaTPPoint, // TP
|
eaTPPoint, // TP
|
||||||
eaSLPoint, // SL
|
eaSLPoint, // SL
|
||||||
eaIgnoreTP,
|
eaIgnoreTP,
|
||||||
eaIgnoreSL,
|
false, // eaIgnoreSL,
|
||||||
eaAllowLong,
|
eaAllowLong,
|
||||||
eaAllowShort,
|
eaAllowShort,
|
||||||
eaMaxAllowedLongs, // Max Longs
|
eaMaxAllowedLongs, // Max Longs
|
||||||
@@ -469,6 +469,30 @@ void HandleTradeState()
|
|||||||
// Analyzing ...
|
// Analyzing ...
|
||||||
void OnSignalRecieved(XSignal &signal)
|
void OnSignalRecieved(XSignal &signal)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
if (eaMaxAllowedLongs > 0 || eaMaxAllowedShorts > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPosition longs[];
|
||||||
|
XPosition shorts[];
|
||||||
|
eaTrader.GetPositions(
|
||||||
|
longs,
|
||||||
|
shorts,
|
||||||
|
signal.symbol //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
int longsCount = ArraySize(longs);
|
||||||
|
int shortsCount = ArraySize(shorts);
|
||||||
|
|
||||||
|
//
|
||||||
|
if ((eaMaxAllowedLongs > 0 && longsCount >= eaMaxAllowedLongs) ||
|
||||||
|
(eaMaxAllowedShorts > 0 && shortsCount >= eaMaxAllowedShorts))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
ENUM_X_SIGNAL_EXECUTION_RESULT state;
|
ENUM_X_SIGNAL_EXECUTION_RESULT state;
|
||||||
bool isExecuted = eaTrader.ExecuteSignal(
|
bool isExecuted = eaTrader.ExecuteSignal(
|
||||||
|
|||||||
@@ -495,6 +495,35 @@ public:
|
|||||||
false //
|
false //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// XCHE ...
|
||||||
|
|
||||||
|
//
|
||||||
|
if (cheConditions.long1[pIndex] > 0 &&
|
||||||
|
cheConditions.long2[pIndex] > 0 &&
|
||||||
|
cheConditions.long1[pIndex] != EMPTY_VALUE &&
|
||||||
|
cheConditions.long2[pIndex] != EMPTY_VALUE &&
|
||||||
|
!cheConditions.isStrongBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cheLastLongExitTime = pBar.time;
|
||||||
|
cheLastLongExit1 = cheConditions.long1[pIndex];
|
||||||
|
cheLastLongExit2 = cheConditions.long2[pIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (cheConditions.short1[pIndex] > 0 &&
|
||||||
|
cheConditions.short2[pIndex] > 0 &&
|
||||||
|
cheConditions.short1[pIndex] != EMPTY_VALUE &&
|
||||||
|
cheConditions.short2[pIndex] != EMPTY_VALUE &&
|
||||||
|
!cheConditions.isStrongBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cheLastShortExitTime = pBar.time;
|
||||||
|
cheLastShortExit1 = cheConditions.short1[pIndex];
|
||||||
|
cheLastShortExit2 = cheConditions.short2[pIndex];
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// XCHM ...
|
// XCHM ...
|
||||||
// Detect XCHMbased Conditions ...
|
// Detect XCHMbased Conditions ...
|
||||||
@@ -1807,8 +1836,8 @@ private:
|
|||||||
chmInputs.hcPeriod = hcPeriod;
|
chmInputs.hcPeriod = hcPeriod;
|
||||||
|
|
||||||
//
|
//
|
||||||
chmInputs.showFast = true;
|
chmInputs.showFast = false;
|
||||||
chmInputs.showSlow = true;
|
chmInputs.showSlow = false;
|
||||||
chmInputs.showCCFast = false;
|
chmInputs.showCCFast = false;
|
||||||
chmInputs.showCCSlow = false;
|
chmInputs.showCCSlow = false;
|
||||||
chmInputs.showSCFast = false;
|
chmInputs.showSCFast = false;
|
||||||
@@ -1817,8 +1846,8 @@ private:
|
|||||||
chmInputs.showMCSlow = false;
|
chmInputs.showMCSlow = false;
|
||||||
chmInputs.showLCFast = false;
|
chmInputs.showLCFast = false;
|
||||||
chmInputs.showLCSlow = false;
|
chmInputs.showLCSlow = false;
|
||||||
chmInputs.showHCFast = false;
|
chmInputs.showHCFast = true;
|
||||||
chmInputs.showHCSlow = false;
|
chmInputs.showHCSlow = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
chmHelper = new XSCXCHMHelper();
|
chmHelper = new XSCXCHMHelper();
|
||||||
@@ -2092,6 +2121,71 @@ private:
|
|||||||
bearishFVG.Clean();
|
bearishFVG.Clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XCHE Custom Data ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double cheLastLongExit1;
|
||||||
|
double cheLastLongExit2;
|
||||||
|
datetime cheLastLongExitTime;
|
||||||
|
double GetMaxCHELastLong()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return MathMax(
|
||||||
|
cheLastLongExit1,
|
||||||
|
cheLastLongExit2 //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
double GetMinCHELastLong()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return MathMin(
|
||||||
|
cheLastLongExit1,
|
||||||
|
cheLastLongExit2 //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double cheLastShortExit1;
|
||||||
|
double cheLastShortExit2;
|
||||||
|
datetime cheLastShortExitTime;
|
||||||
|
double GetMaxCHELastShort()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return MathMax(
|
||||||
|
cheLastShortExit1,
|
||||||
|
cheLastShortExit2 //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
double GetMinCHELastShort()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return MathMin(
|
||||||
|
cheLastShortExit1,
|
||||||
|
cheLastShortExit2 //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double GetMaxCHELast()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return MathMax(
|
||||||
|
GetMaxCHELastLong(),
|
||||||
|
GetMaxCHELastShort() //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
double GetMinCHELast()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return MathMin(
|
||||||
|
GetMinCHELastLong(),
|
||||||
|
GetMinCHELastShort() //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
Reference in New Issue
Block a user