This commit is contained in:
2024-07-19 08:08:26 +03:30
parent 70f2435c44
commit b038cc0b7e
11 changed files with 3482 additions and 308 deletions
+437
View File
@@ -5409,3 +5409,440 @@ int pivotsCount = ArraySize(pivots);
// ;
/////////////////////////////////////////////////////////////////////
//
// Try to Detect and Order Block Inside this ...
// in Mediest ...
result = medBar.IsValid();
if (!result)
{
//
result = medBar.Init(
mSymbol,
mMediestPeriod,
1 //
);
if (!result)
{
//
medBar.Clean();
return result;
}
}
//
result = medBar.HasBullishOrderBlock(medBullishOrderBlock);
if (!result)
{
//
medBar.Clean();
return result;
}
//
DrawBullishOrderBlock(
medBullishOrderBlock,
ChartID() //
);
//
// Check Order Block Is Inside HINDOB ...
result =
//
(medBullishOrderBlock.low >= hindBullishOrderBlock.low &&
medBullishOrderBlock.low <= hindBullishOrderBlock.high)
//
||
//
(medBullishOrderBlock.high <= hindBullishOrderBlock.high &&
medBullishOrderBlock.high >= hindBullishOrderBlock.low)
//
;
//
if (result)
{
//
// Check Price ...
result =
//
ll3 < medBullishOrderBlock.high &&
ll3 > hindBullishOrderBlock.low
//
;
if (!result)
{
//
hindBar.Clean();
hindBullishOrderBlock.Clean();
hindBearishOrderBlock.Clean();
//
medBar.Clean();
medBullishOrderBlock.Clean();
medBearishOrderBlock.Clean();
//
fvgUpper = 0;
fvgLower = 0;
//
RemoveDraws();
//
return result;
}
//
hasLong = result;
}
else
{
//
// Detect and FVG Inside ...
result = medBar.HasBullishFVG(
fvgUpper,
fvgLower //
);
if (!result)
{
//
hindBar.Clean();
hindBullishOrderBlock.Clean();
hindBearishOrderBlock.Clean();
//
medBar.Clean();
medBullishOrderBlock.Clean();
medBearishOrderBlock.Clean();
//
fvgUpper = 0;
fvgLower = 0;
//
RemoveDraws();
//
return result;
}
//
DrawBullishFVG(
medBar,
fvgUpper,
fvgLower,
ChartID() //
);
//
result =
//
(fvgLower >= hindBullishOrderBlock.low &&
fvgLower <= hindBullishOrderBlock.high)
//
||
//
(fvgUpper <= hindBullishOrderBlock.high &&
fvgUpper >= hindBullishOrderBlock.low)
//
;
//
// Check Price ...
result =
//
ll3 < fvgUpper &&
ll3 > hindBullishOrderBlock.low
//
;
if (!result)
{
//
hindBar.Clean();
hindBullishOrderBlock.Clean();
hindBearishOrderBlock.Clean();
//
medBar.Clean();
medBullishOrderBlock.Clean();
medBearishOrderBlock.Clean();
//
fvgUpper = 0;
fvgLower = 0;
//
RemoveDraws();
//
return result;
}
//
hasLong = result;
}
////////////////////////////////////////////////////////////////////////////
//
// Try to Detect and Order Block Inside this ...
// in Mediest ...
result = medBar.IsValid();
if (!result)
{
//
result = medBar.Init(
mSymbol,
mMediestPeriod,
1 //
);
if (!result)
{
//
medBar.Clean();
return result;
}
}
//
result = medBar.HasBearishOrderBlock(medBearishOrderBlock);
if (!result)
{
//
medBar.Clean();
return result;
}
//
DrawBearishOrderBlock(
medBearishOrderBlock,
ChartID() //
);
//
// Check Order Block Is Inside HINDOB ...
result =
//
(medBullishOrderBlock.low >= hindBearishOrderBlock.low &&
medBearishOrderBlock.low <= hindBearishOrderBlock.high)
//
||
//
(medBearishOrderBlock.high <= hindBearishOrderBlock.high &&
medBearishOrderBlock.high >= hindBearishOrderBlock.low)
//
;
if (!result)
{
//
// Detect and FVG Inside ...
result = medBar.HasBearishFVG(
fvgUpper,
fvgLower //
);
if (!result)
{
//
hindBar.Clean();
hindBullishOrderBlock.Clean();
hindBearishOrderBlock.Clean();
//
medBar.Clean();
medBullishOrderBlock.Clean();
medBearishOrderBlock.Clean();
//
fvgUpper = 0;
fvgLower = 0;
//
RemoveDraws();
//
return result;
}
//
DrawBearishFVG(
medBar,
fvgUpper,
fvgLower,
ChartID() //
);
//
result =
//
(fvgLower >= hindBearishOrderBlock.low &&
fvgLower <= hindBearishOrderBlock.high)
//
||
//
(fvgUpper <= hindBearishOrderBlock.high &&
fvgUpper >= hindBearishOrderBlock.low)
//
;
if (!result)
{
//
hindBar.Clean();
hindBullishOrderBlock.Clean();
hindBearishOrderBlock.Clean();
//
medBar.Clean();
medBullishOrderBlock.Clean();
medBearishOrderBlock.Clean();
//
fvgUpper = 0;
fvgLower = 0;
//
RemoveDraws();
//
return result;
}
}
//////////////////////////////////////////////////////////////////////////////////
//
result = hasLong || hasShort;
if (!result)
{
return result;
}
//
if (hasLong)
{
//
// Long ...
//
bool isHammer = !useHammer
? false
: cBar.IsHammer();
bool isMorningStar = !useMorningStar
? false
: cBar.IsMorningStar();
bool isBullishMarubozu = !useBullishEngulfing
? false
: cBar.IsBullishMarubozu();
bool isBullishEngulfing = !useBullishMaurubozu
? false
: cBar.IsBullishEngulfing();
//
bool isBullishTrend = cBar.HasBullishTrend(
tmpHSW,
tmpLSW,
true //
);
//
// Find Swing Low Above of EMA ...
// Find Swing High Above of EMA ...
// Fins Swing Low Below of EMA ...
// Detect Bullish Pattern ...
hasLong =
//
true
//
&&
//
(
//
isHammer
//
||
//
isMorningStar
//
||
//
isBullishMarubozu
//
||
//
isBullishEngulfing
//
)
//
;
if (hasLong)
{
//
type = POSITION_TYPE_BUY;
//
// sl = tmpLSW[ArraySize(tmpLSW) - 1].low;
}
}
//
if (hasShort)
{
//
// Short ...
bool isShootingStar = !useShootingStar
? false
: cBar.IsShootingStar();
bool isEveningStar = !useEveningStar
? false
: cBar.IsEveningStar();
bool isBearishEngulfing = !useBearishEngulfing
? false
: cBar.IsBearishEngulfing();
bool isBearishMaurubozu = !useBearishMaurubozu
? false
: cBar.IsBearishMarubozu();
//
bool isBearishTrend = cBar.HasBearishTrend(
tmpHSW,
tmpLSW,
true //
);
//
hasShort =
//
false
//
&&
//
(
//
isShootingStar
//
||
//
isEveningStar
//
||
//
isBearishEngulfing
//
||
//
isBearishMaurubozu
//
)
//
;
if (hasShort)
{
//
type = POSITION_TYPE_SELL;
//
// sl = tmpHSW[ArraySize(tmpHSW) - 1].high;
}
}