last works ...
This commit is contained in:
@@ -1840,13 +1840,13 @@ struct XOrder
|
||||
//
|
||||
// Check Items Passed Specific Filters or not ...
|
||||
bool IsFiltersPassed(
|
||||
string mSymbol = NULL, // Trading Symbol
|
||||
string mProvider = NULL, // Signal Provider
|
||||
ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe
|
||||
ENUM_ORDER_TYPE mType = NULL, // Long (Buy), Short (Sell)
|
||||
ENUM_ORDER_STATE mState = NULL, // Order State
|
||||
ulong mMagic = NULL, // Magic Number
|
||||
bool mFilterByMagic = true // Get Only Self Open Positions
|
||||
string mSymbol = NULL, // Trading Symbol
|
||||
string mProvider = NULL, // Signal Provider
|
||||
ENUM_TIMEFRAMES mPeriod = NULL, // Trading Timeframe
|
||||
ENUM_X_POSITION_TYPE mType = NULL, // Long (Buy), Short (Sell)
|
||||
ENUM_ORDER_STATE mState = NULL, // Order State
|
||||
ulong mMagic = NULL, // Magic Number
|
||||
bool mFilterByMagic = true // Get Only Self Open Positions
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -3374,8 +3374,8 @@ bool IsTypeFilterPassed(
|
||||
//
|
||||
bool result = type == NULL || type == X_POSITION_TYPE_ALL
|
||||
? true
|
||||
: ((type == X_POSITION_TYPE_LONG && item.type == POSITION_TYPE_BUY) ||
|
||||
(type == X_POSITION_TYPE_SHORT && item.type == POSITION_TYPE_SELL));
|
||||
: ((type == X_POSITION_TYPE_LONG && ((int)item.type == (int)POSITION_TYPE_BUY || (int)item.type == (int)ORDER_TYPE_BUY)) ||
|
||||
(type == X_POSITION_TYPE_SHORT && ((int)item.type == (int)POSITION_TYPE_SELL || (int)item.type == (int)ORDER_TYPE_SELL)));
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -4319,4 +4319,225 @@ void CountPositions(
|
||||
shortVolumes = iPosition.volume;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Custom Drawings ...
|
||||
bool DrawTrendState(
|
||||
long chartId,
|
||||
string _prefix,
|
||||
XOHCL &_bar,
|
||||
double &support,
|
||||
double &resistance,
|
||||
int shoulders = 10,
|
||||
int subWindow = 0,
|
||||
color resistanceColor = clrRed,
|
||||
color supportColor = clrGreen,
|
||||
color swingHighColor = clrAqua,
|
||||
color swingLowColor = clrMagenta //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
IsValid(_prefix) &&
|
||||
_bar.IsValid()
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Low Swings ...
|
||||
|
||||
//
|
||||
int firstSwingLowIndex = FindSwing(
|
||||
_bar.symbol,
|
||||
_bar.period,
|
||||
X_SWING_LOW,
|
||||
shoulders,
|
||||
_bar.Index() + 1 //
|
||||
);
|
||||
XOHCL firstSwingLowBar;
|
||||
result = firstSwingLowBar.Init(
|
||||
_bar.symbol,
|
||||
_bar.period,
|
||||
firstSwingLowIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int secondSwingLowIndex = FindSwing(
|
||||
_bar.symbol,
|
||||
_bar.period,
|
||||
X_SWING_LOW,
|
||||
shoulders,
|
||||
firstSwingLowIndex + 1 //
|
||||
);
|
||||
XOHCL secondSwingLowBar;
|
||||
result = secondSwingLowBar.Init(
|
||||
_bar.symbol,
|
||||
_bar.period,
|
||||
secondSwingLowIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
support = secondSwingLowBar.low;
|
||||
|
||||
//
|
||||
string lowSwingTrendLineName = _prefix + "_Low_Swing_Trend";
|
||||
|
||||
//
|
||||
result = DrawTrendLine(
|
||||
chartId,
|
||||
lowSwingTrendLineName,
|
||||
subWindow,
|
||||
secondSwingLowBar.time,
|
||||
secondSwingLowBar.low,
|
||||
firstSwingLowBar.time,
|
||||
firstSwingLowBar.low,
|
||||
swingLowColor,
|
||||
STYLE_SOLID,
|
||||
2,
|
||||
false,
|
||||
false,
|
||||
true // Ray Right ...
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string lowSwingSupportLineName = _prefix + "_Low_Swing_Support";
|
||||
|
||||
//
|
||||
result = DrawTrendLine(
|
||||
chartId,
|
||||
lowSwingSupportLineName,
|
||||
subWindow,
|
||||
secondSwingLowBar.time,
|
||||
secondSwingLowBar.low,
|
||||
firstSwingLowBar.time,
|
||||
secondSwingLowBar.low,
|
||||
supportColor,
|
||||
STYLE_SOLID,
|
||||
2,
|
||||
false,
|
||||
false,
|
||||
true // Ray Right ...
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Find High Swings ...
|
||||
|
||||
//
|
||||
int firstSwingHighIndex = FindSwing(
|
||||
_bar.symbol,
|
||||
_bar.period,
|
||||
X_SWING_HIGH,
|
||||
shoulders,
|
||||
_bar.Index() + 1 //
|
||||
);
|
||||
XOHCL firstSwingHighBar;
|
||||
result = firstSwingHighBar.Init(
|
||||
_bar.symbol,
|
||||
_bar.period,
|
||||
firstSwingHighIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int secondSwingHighIndex = FindSwing(
|
||||
_bar.symbol,
|
||||
_bar.period,
|
||||
X_SWING_HIGH,
|
||||
shoulders,
|
||||
firstSwingHighIndex + 1 //
|
||||
);
|
||||
XOHCL secondSwingHighBar;
|
||||
result = secondSwingHighBar.Init(
|
||||
_bar.symbol,
|
||||
_bar.period,
|
||||
secondSwingHighIndex //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
resistance = secondSwingHighBar.high;
|
||||
|
||||
//
|
||||
string highSwingTrendLineName = _prefix + "_High_Swing_Trend";
|
||||
|
||||
//
|
||||
result = DrawTrendLine(
|
||||
chartId,
|
||||
highSwingTrendLineName,
|
||||
subWindow,
|
||||
secondSwingHighBar.time,
|
||||
secondSwingHighBar.high,
|
||||
firstSwingHighBar.time,
|
||||
firstSwingHighBar.high,
|
||||
swingHighColor,
|
||||
STYLE_SOLID,
|
||||
2,
|
||||
false,
|
||||
false,
|
||||
true // Ray Right ...
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string highSwingResistanceLineName = _prefix + "_High_Swing_Resistance";
|
||||
|
||||
//
|
||||
result = DrawTrendLine(
|
||||
chartId,
|
||||
highSwingResistanceLineName,
|
||||
subWindow,
|
||||
secondSwingHighBar.time,
|
||||
secondSwingHighBar.high,
|
||||
firstSwingHighBar.time,
|
||||
secondSwingHighBar.high,
|
||||
resistanceColor,
|
||||
STYLE_SOLID,
|
||||
2,
|
||||
false,
|
||||
false,
|
||||
true // Ray Right ...
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user