last ...
This commit is contained in:
@@ -27,6 +27,14 @@
|
||||
#include "../Classes/x-saherelm.x-market.pattern.class.mq5"
|
||||
#include "../Helpers/x-saherelm.xom1.helper.mq5"
|
||||
|
||||
//
|
||||
#import "user32.dll"
|
||||
void keybd_event(int bVk, int bScan, int dwFlags, int dwExtraInfo);
|
||||
#import
|
||||
#define VK_SPACE 0x20 // Space
|
||||
#define VK_RETURN 0x0D // Return - Enter Key
|
||||
#define KEYEVENTF_KEYUP 0x0002 // Key up
|
||||
|
||||
//
|
||||
// Definitions ...
|
||||
|
||||
@@ -374,128 +382,218 @@ void OnTick()
|
||||
//
|
||||
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
// Define Detection Flags ...
|
||||
|
||||
//
|
||||
bool detectPinned = false;
|
||||
bool detectMomentum = false;
|
||||
bool detectEngulfed = false;
|
||||
bool detectTrueGaped = false;
|
||||
|
||||
//
|
||||
bool detectStarPattern = false;
|
||||
bool detectFlagPattern = false;
|
||||
bool detectRisingPattern = false;
|
||||
bool detectPiercingPattern = false;
|
||||
bool detectSignalKeyBarPattern = true;
|
||||
|
||||
//
|
||||
bool detectSwingTrend = false;
|
||||
|
||||
//
|
||||
// Checking Momentum Bar ...
|
||||
bool isMomentum = eaPatternDetector.IsMomentumBar(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishMomentum = isMomentum &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishMomentum = isMomentum &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isMomentum)
|
||||
if (detectMomentum)
|
||||
{
|
||||
Print(ToXString(iDir), " Momentum Bar: ", cBar.time);
|
||||
//
|
||||
bool isMomentum = eaPatternDetector.IsMomentumBar(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishMomentum = isMomentum &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishMomentum = isMomentum &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isMomentum)
|
||||
{
|
||||
Print(ToXString(iDir), " Momentum Bar: ", cBar.time);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Engulfed Bar ...
|
||||
bool isEngulfed = eaPatternDetector.IsEngulfedBar(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishEngulfed = isEngulfed &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishEngulfed = isEngulfed &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isEngulfed)
|
||||
if (detectEngulfed)
|
||||
{
|
||||
Print(ToXString(iDir), " Engulfed Bar: ", cBar.time);
|
||||
//
|
||||
bool isEngulfed = eaPatternDetector.IsEngulfedBar(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishEngulfed = isEngulfed &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishEngulfed = isEngulfed &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isEngulfed)
|
||||
{
|
||||
Print(ToXString(iDir), " Engulfed Bar: ", cBar.time);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Checking TruGaped Bar ...
|
||||
bool isTrueGaped = eaPatternDetector.IsTrueGapedBar(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishTrueGaped = isTrueGaped &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishTrueGaped = isTrueGaped &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isTrueGaped)
|
||||
if (detectTrueGaped)
|
||||
{
|
||||
Print(ToXString(iDir), " TrueGapped Bar: ", cBar.time);
|
||||
//
|
||||
bool isTrueGaped = eaPatternDetector.IsTrueGapedBar(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishTrueGaped = isTrueGaped &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishTrueGaped = isTrueGaped &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isTrueGaped)
|
||||
{
|
||||
Print(ToXString(iDir), " TrueGapped Bar: ", cBar.time);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Pinned Bar ...
|
||||
bool isPinned = eaPatternDetector.IsPinnedBar(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishPinned = isPinned &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishPinned = isPinned &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isPinned)
|
||||
if (detectPinned)
|
||||
{
|
||||
Print(ToXString(iDir), " Pinned Bar: ", cBar.time);
|
||||
bool isPinned = eaPatternDetector.IsPinnedBar(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishPinned = isPinned &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishPinned = isPinned &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isPinned)
|
||||
{
|
||||
Print(ToXString(iDir), " Pinned Bar: ", cBar.time);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Star Pattern ...
|
||||
bool isStarPattern = eaPatternDetector.IsStartPattern(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishStarPattern = isStarPattern &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishStarPattern = isStarPattern &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isStarPattern)
|
||||
if (detectStarPattern)
|
||||
{
|
||||
Print(ToXString(iDir), " Star Pattern: ", cBar.time);
|
||||
bool isStarPattern = eaPatternDetector.IsStartPattern(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishStarPattern = isStarPattern &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishStarPattern = isStarPattern &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isStarPattern)
|
||||
{
|
||||
Print(ToXString(iDir), " Star Pattern: ", cBar.time);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Piercing Pattern ...
|
||||
bool isPiercingPattern = eaPatternDetector.IsPiercingPattern(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishPiercingPattern = isPiercingPattern &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishPiercingPattern = isPiercingPattern &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isPiercingPattern)
|
||||
if (detectPiercingPattern)
|
||||
{
|
||||
Print(ToXString(iDir), " Piercing Pattern: ", cBar.time);
|
||||
//
|
||||
bool isPiercingPattern = eaPatternDetector.IsPiercingPattern(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishPiercingPattern = isPiercingPattern &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishPiercingPattern = isPiercingPattern &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isPiercingPattern)
|
||||
{
|
||||
Print(ToXString(iDir), " Piercing Pattern: ", cBar.time);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Rising Pattern ...
|
||||
bool isRisingPattern = eaPatternDetector.IsRisingPattern(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishRisingPattern = isRisingPattern &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishRisingPattern = isRisingPattern &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isRisingPattern)
|
||||
if (detectRisingPattern)
|
||||
{
|
||||
Print(ToXString(iDir), " Rising Pattern: ", cBar.time);
|
||||
//
|
||||
bool isRisingPattern = eaPatternDetector.IsRisingPattern(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishRisingPattern = isRisingPattern &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishRisingPattern = isRisingPattern &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isRisingPattern)
|
||||
{
|
||||
Print(ToXString(iDir), " Rising Pattern: ", cBar.time);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Flag Pattern ...
|
||||
XOHCL swingBar;
|
||||
bool isFlagPattern = eaPatternDetector.IsFlagPattern(
|
||||
cBar,
|
||||
iDir,
|
||||
swingBar //
|
||||
);
|
||||
bool isBullishFlagPattern = isFlagPattern &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishFlagPattern = isFlagPattern &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isFlagPattern)
|
||||
if (detectFlagPattern)
|
||||
{
|
||||
Print(ToXString(iDir), " Flag Pattern: ", cBar.time, ", Swing: ", swingBar.time);
|
||||
//
|
||||
XOHCL swingBar;
|
||||
bool isFlagPattern = eaPatternDetector.IsFlagPattern(
|
||||
cBar,
|
||||
iDir,
|
||||
swingBar //
|
||||
);
|
||||
bool isBullishFlagPattern = isFlagPattern &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishFlagPattern = isFlagPattern &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isFlagPattern)
|
||||
{
|
||||
Print(ToXString(iDir), " Flag Pattern: ", cBar.time, ", Swing: ", swingBar.time);
|
||||
}
|
||||
swingBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Swing Trend ...
|
||||
if (detectSwingTrend)
|
||||
{
|
||||
//
|
||||
XOHCL swings[];
|
||||
bool hasSwingTrend = eaPatternDetector.HasSwingTrend(
|
||||
cBar,
|
||||
iDir,
|
||||
swings //
|
||||
);
|
||||
bool hasBullishSwingTrend = hasSwingTrend &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool hasBearishSwingTrend = hasSwingTrend &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (hasSwingTrend)
|
||||
{
|
||||
Print(ToXString(iDir), " Swing Trend: ", cBar.time);
|
||||
}
|
||||
SpecifiedClean(swings);
|
||||
}
|
||||
|
||||
//
|
||||
// Detect SignalKey Bar Pattern ...
|
||||
if (detectSignalKeyBarPattern)
|
||||
{
|
||||
//
|
||||
bool isSignalKeyBar = eaPatternDetector.IsSignalKeyBarPattern(
|
||||
cBar,
|
||||
iDir //
|
||||
);
|
||||
bool isBullishSignalKeyBar = isSignalKeyBar &&
|
||||
IsSpecifiedBullish(iDir);
|
||||
bool isBearishSignalKeyBar = isSignalKeyBar &&
|
||||
IsSpecifiedBearish(iDir);
|
||||
if (isSignalKeyBar)
|
||||
{
|
||||
Print(ToXString(iDir), " SignalKey Bar Pattern: ", cBar.time);
|
||||
}
|
||||
}
|
||||
swingBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -754,5 +852,3 @@ void OnTradeStateChanged(const XOnTradeHandlerState &state)
|
||||
{
|
||||
eaExpert.HandleOnTradeStateChanged(state);
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user