last works on clearify POI(s) ...
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+1462
-1567
File diff suppressed because it is too large
Load Diff
@@ -3348,22 +3348,29 @@ class XCPOIDrawer : public XCBase
|
||||
int DrawState(
|
||||
XPOIState &state,
|
||||
XCBaseObject *&drawnObjects[],
|
||||
bool drawTicksZone = false,
|
||||
bool ignoreSwingHighs = false,
|
||||
//
|
||||
// Bullish ...
|
||||
bool ignoreSwingLows = false,
|
||||
bool ignoreSupportZones = false,
|
||||
bool ignoreResistanceZones = false,
|
||||
bool ignoreSupplyZones = false,
|
||||
bool ignoreDemandZones = false,
|
||||
bool ignoreSupportZones = false,
|
||||
bool ignoreBullishSharps = false,
|
||||
bool ignoreBullishSpikes = false,
|
||||
bool ignoreBullishMomentums = false,
|
||||
bool ignoreBullishRejections = false,
|
||||
bool ignoreBullishOrderBlocks = false,
|
||||
bool ignoreBearishOrderBlocks = false,
|
||||
bool ignoreBullishFairValueGaps = false,
|
||||
bool ignoreBearishFairValueGaps = false,
|
||||
bool ignoreBullishRejectionBars = false,
|
||||
bool ignoreBearishRejectionBars = false,
|
||||
bool ignoreBullishMomentumBars = false,
|
||||
bool ignoreBearishMomentumBars = false,
|
||||
bool ignoreBullishConsolidationZones = false,
|
||||
//
|
||||
// Bearish ...
|
||||
bool ignoreSwingHighs = false,
|
||||
bool ignoreSupplyZones = false,
|
||||
bool ignoreBearishSharps = false,
|
||||
bool ignoreBearishSpikes = false,
|
||||
bool ignoreResistanceZones = false,
|
||||
bool ignoreBearishMomentums = false,
|
||||
bool ignoreBearishRejections = false,
|
||||
bool ignoreBearishOrderBlocks = false,
|
||||
bool ignoreBearishFairValueGaps = false,
|
||||
bool ignoreBearishConsolidationZones = false //
|
||||
)
|
||||
{
|
||||
@@ -3380,6 +3387,9 @@ class XCPOIDrawer : public XCBase
|
||||
//
|
||||
Clean(drawnObjects);
|
||||
|
||||
//
|
||||
// Swings ...
|
||||
|
||||
//
|
||||
// SwingHighs ...
|
||||
if (!ignoreSwingHighs)
|
||||
@@ -3444,6 +3454,9 @@ class XCPOIDrawer : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Support / Resistance ...
|
||||
|
||||
//
|
||||
// SupportZones ...
|
||||
if (!ignoreSupportZones)
|
||||
@@ -3508,6 +3521,9 @@ class XCPOIDrawer : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Supply / Demand ...
|
||||
|
||||
//
|
||||
// SupplyZones ...
|
||||
if (!ignoreSupplyZones)
|
||||
@@ -3572,6 +3588,9 @@ class XCPOIDrawer : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Order Blocks ...
|
||||
|
||||
//
|
||||
// BullishOrderBlocks ...
|
||||
if (!ignoreBullishOrderBlocks)
|
||||
@@ -3636,6 +3655,9 @@ class XCPOIDrawer : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Fair Value Gaps ...
|
||||
|
||||
//
|
||||
// BullishFairValueGaps ...
|
||||
if (!ignoreBullishFairValueGaps)
|
||||
@@ -3700,19 +3722,22 @@ class XCPOIDrawer : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Rejections ...
|
||||
|
||||
//
|
||||
// BullishRejectionBars ...
|
||||
if (!ignoreBullishRejectionBars)
|
||||
if (!ignoreBullishRejections)
|
||||
{
|
||||
//
|
||||
int count = state.CountBullishRejectionBars();
|
||||
int count = state.CountBullishRejections();
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCRejectionBar *iBar = state.bullishRejectionBars[i];
|
||||
XCRejectionBar *iBar = state.bullishRejections[i];
|
||||
XCBullishRejectionBarObject *iObj;
|
||||
|
||||
//
|
||||
@@ -3734,17 +3759,17 @@ class XCPOIDrawer : public XCBase
|
||||
|
||||
//
|
||||
// BearishRejectionBars ...
|
||||
if (!ignoreBearishRejectionBars)
|
||||
if (!ignoreBearishRejections)
|
||||
{
|
||||
//
|
||||
int count = state.CountBearishRejectionBars();
|
||||
int count = state.CountBearishRejections();
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCRejectionBar *iBar = state.bearishRejectionBars[i];
|
||||
XCRejectionBar *iBar = state.bearishRejections[i];
|
||||
XCBearishRejectionBarObject *iObj;
|
||||
|
||||
//
|
||||
@@ -3764,19 +3789,22 @@ class XCPOIDrawer : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Momentums ...
|
||||
|
||||
//
|
||||
// BullishMomentumBars ...
|
||||
if (!ignoreBullishMomentumBars)
|
||||
if (!ignoreBullishMomentums)
|
||||
{
|
||||
//
|
||||
int count = state.CountBullishMomentumBars();
|
||||
int count = state.CountBullishMomentums();
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCMomentumBar *iBar = state.bullishMomentumBars[i];
|
||||
XCMomentumBar *iBar = state.bullishMomentums[i];
|
||||
XCBullishMomentumBarObject *iObj;
|
||||
|
||||
//
|
||||
@@ -3798,17 +3826,17 @@ class XCPOIDrawer : public XCBase
|
||||
|
||||
//
|
||||
// BearishMomentumBars ...
|
||||
if (!ignoreBearishMomentumBars)
|
||||
if (!ignoreBearishMomentums)
|
||||
{
|
||||
//
|
||||
int count = state.CountBearishMomentumBars();
|
||||
int count = state.CountBearishMomentums();
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCMomentumBar *iBar = state.bearishMomentumBars[i];
|
||||
XCMomentumBar *iBar = state.bearishMomentums[i];
|
||||
XCBearishMomentumBarObject *iObj;
|
||||
|
||||
//
|
||||
@@ -3828,6 +3856,9 @@ class XCPOIDrawer : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Consolidation Zones ...
|
||||
|
||||
//
|
||||
// Bullish Consolidation Zones ...
|
||||
if (!ignoreBullishConsolidationZones)
|
||||
@@ -3886,6 +3917,128 @@ class XCPOIDrawer : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Spikes ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (!ignoreBullishSpikes)
|
||||
{
|
||||
//
|
||||
int count = state.CountBullishSpikes();
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
bool isCreated = DrawBox(
|
||||
state.bullishSpikes[i],
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (!ignoreBearishSpikes)
|
||||
{
|
||||
//
|
||||
int count = state.CountBearishSpikes();
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
bool isCreated = DrawBox(
|
||||
state.bearishSpikes[i],
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Sharps ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (!ignoreBullishSharps)
|
||||
{
|
||||
//
|
||||
int count = state.CountBullishSharps();
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
bool isCreated = DrawBox(
|
||||
state.bullishSharps[i],
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (!ignoreBearishSharps)
|
||||
{
|
||||
//
|
||||
int count = state.CountBearishSharps();
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
bool isCreated = DrawBox(
|
||||
state.bearishSharps[i],
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(drawnObjects);
|
||||
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| Valid_Break_Detector |
|
||||
//| Copyright 2023, MetaQuotes Software Corp. |
|
||||
//| https://www.mql5.com |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2023, MetaQuotes Software Corp."
|
||||
#property link "https://www.mql5.com"
|
||||
#property version "1.00"
|
||||
#property description "Detects Valid Breakouts of Zones with Rejection Confirmation"
|
||||
|
||||
// Input Parameters
|
||||
input double LotSize = 0.1; // Lot size for trades
|
||||
input int StopLoss = 50; // Stop Loss in points
|
||||
input int TakeProfit = 100; // Take Profit in points
|
||||
input bool RequireVolumeSpike = true; // Enable volume spike filter
|
||||
input double VolumeThreshold = 1.5; // Minimum volume increase factor
|
||||
input bool RequireCloseBeyond = true; // Require candle close beyond the zone
|
||||
input int RejectionConfirmationCandles = 2; // Number of candles to confirm rejection
|
||||
|
||||
// Global Variables
|
||||
int MagicNumber = 789101;
|
||||
|
||||
//
|
||||
double _Ask = 0;
|
||||
double _Bid = 0;
|
||||
|
||||
// Zone Boundaries
|
||||
double ZoneHigh = 0;
|
||||
double ZoneLow = 0;
|
||||
|
||||
//
|
||||
double maBuffer[];
|
||||
int maHandler = INVALID_HANDLE;
|
||||
|
||||
// Breakout Status
|
||||
bool BullishBreakoutDetected = false;
|
||||
bool BearishBreakoutDetected = false;
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert initialization function |
|
||||
//+------------------------------------------------------------------+
|
||||
int OnInit()
|
||||
{
|
||||
//
|
||||
ArraySetAsSeries(maBuffer, true);
|
||||
maHandler = iMA(
|
||||
_Symbol,
|
||||
_Period,
|
||||
14,
|
||||
0,
|
||||
MODE_SMA,
|
||||
VOLUME_TICK //
|
||||
);
|
||||
if (maHandler == INVALID_HANDLE)
|
||||
{
|
||||
return (INIT_FAILED);
|
||||
}
|
||||
|
||||
//
|
||||
Print("Valid Break Detector EA Initialized");
|
||||
return (INIT_SUCCEEDED);
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert deinitialization function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnDeinit(const int reason)
|
||||
{
|
||||
//
|
||||
IndicatorRelease(maHandler);
|
||||
Print("Valid Break Detector EA Deinitialized");
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert tick function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnTick()
|
||||
{
|
||||
//
|
||||
_Ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
|
||||
_Bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
|
||||
CopyBuffer(maHandler, MAIN_LINE, 0, 14, maBuffer);
|
||||
|
||||
// Define the zone dynamically (e.g., based on recent highs/lows)
|
||||
DefineZone();
|
||||
|
||||
// Check for valid break of the zone
|
||||
CheckValidBreak();
|
||||
|
||||
// Confirm rejection after breakout
|
||||
if (BullishBreakoutDetected || BearishBreakoutDetected)
|
||||
ConfirmRejection();
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Function to define the zone dynamically |
|
||||
//+------------------------------------------------------------------+
|
||||
void DefineZone()
|
||||
{
|
||||
// Example: Define zone based on recent highs and lows
|
||||
ZoneHigh = iHigh(_Symbol, _Period, 1); // Recent high
|
||||
ZoneLow = iLow(_Symbol, _Period, 2); // Recent low
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Function to check for a valid break of the zone |
|
||||
//+------------------------------------------------------------------+
|
||||
void CheckValidBreak()
|
||||
{
|
||||
double currentPrice = _Bid;
|
||||
|
||||
// Check if price breaks above the zone
|
||||
if (!BullishBreakoutDetected && currentPrice > ZoneHigh)
|
||||
{
|
||||
if (IsValidBreak(ZoneHigh, true))
|
||||
{
|
||||
Print("Potential Bullish Break Above Zone Detected at ", TimeToString(TimeCurrent(), TIME_DATE));
|
||||
BullishBreakoutDetected = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if price breaks below the zone
|
||||
if (!BearishBreakoutDetected && currentPrice < ZoneLow)
|
||||
{
|
||||
if (IsValidBreak(ZoneLow, false))
|
||||
{
|
||||
Print("Potential Bearish Break Below Zone Detected at ", TimeToString(TimeCurrent(), TIME_DATE));
|
||||
BearishBreakoutDetected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Function to validate the breakout |
|
||||
//+------------------------------------------------------------------+
|
||||
bool IsValidBreak(double zoneLevel, bool isAbove)
|
||||
{
|
||||
// Check if the candle closed beyond the zone
|
||||
if (RequireCloseBeyond)
|
||||
{
|
||||
double closePrice = iClose(_Symbol, _Period, 1);
|
||||
if ((isAbove && closePrice <= zoneLevel) || (!isAbove && closePrice >= zoneLevel))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for a volume spike
|
||||
if (RequireVolumeSpike)
|
||||
{
|
||||
double currentVolume = (double) iVolume(_Symbol, _Period, 1);
|
||||
double averageVolume = maBuffer[1];
|
||||
if (currentVolume < VolumeThreshold * averageVolume)
|
||||
return false;
|
||||
}
|
||||
|
||||
// All conditions met, valid breakout
|
||||
return true;
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Function to confirm rejection |
|
||||
//+------------------------------------------------------------------+
|
||||
void ConfirmRejection()
|
||||
{
|
||||
double currentPrice = _Bid;
|
||||
|
||||
if (BullishBreakoutDetected)
|
||||
{
|
||||
// Check if price rejects lower levels and confirms bullish breakout
|
||||
bool confirmed = true;
|
||||
for (int i = 1; i <= RejectionConfirmationCandles; i++)
|
||||
{
|
||||
double closePrice = iClose(_Symbol, _Period, i);
|
||||
if (closePrice < ZoneHigh)
|
||||
{
|
||||
confirmed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (confirmed)
|
||||
{
|
||||
Print("Bullish Breakout Confirmed at ", TimeToString(TimeCurrent(), TIME_DATE));
|
||||
PlaceTrade(ORDER_TYPE_BUY, "Confirmed Bullish Breakout Buy");
|
||||
BullishBreakoutDetected = false; // Reset breakout status
|
||||
}
|
||||
}
|
||||
|
||||
if (BearishBreakoutDetected)
|
||||
{
|
||||
// Check if price rejects higher levels and confirms bearish breakout
|
||||
bool confirmed = true;
|
||||
for (int i = 1; i <= RejectionConfirmationCandles; i++)
|
||||
{
|
||||
double closePrice = iClose(_Symbol, _Period, i);
|
||||
if (closePrice > ZoneLow)
|
||||
{
|
||||
confirmed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (confirmed)
|
||||
{
|
||||
Print("Bearish Breakout Confirmed at ", TimeToString(TimeCurrent(), TIME_DATE));
|
||||
PlaceTrade(ORDER_TYPE_SELL, "Confirmed Bearish Breakout Sell");
|
||||
BearishBreakoutDetected = false; // Reset breakout status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Function to place a trade |
|
||||
//+------------------------------------------------------------------+
|
||||
void PlaceTrade(int orderType, string comment)
|
||||
{
|
||||
double price = (orderType == ORDER_TYPE_BUY) ? _Ask : _Bid;
|
||||
double sl = (orderType == ORDER_TYPE_BUY) ? price - StopLoss * Point() : price + StopLoss * Point();
|
||||
double tp = (orderType == ORDER_TYPE_BUY) ? price + TakeProfit * Point() : price - TakeProfit * Point();
|
||||
|
||||
MqlTradeRequest request;
|
||||
MqlTradeResult result;
|
||||
|
||||
ZeroMemory(request);
|
||||
ZeroMemory(result);
|
||||
|
||||
request.action = TRADE_ACTION_DEAL;
|
||||
request.symbol = _Symbol;
|
||||
request.volume = LotSize;
|
||||
request.type = orderType;
|
||||
request.price = price;
|
||||
request.sl = sl;
|
||||
request.tp = tp;
|
||||
request.deviation = 10;
|
||||
request.magic = MagicNumber;
|
||||
request.comment = comment;
|
||||
|
||||
if (!OrderSend(request, result))
|
||||
{
|
||||
Print("Error placing order: ", result.retcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
Print(comment, " Order placed successfully.");
|
||||
}
|
||||
}
|
||||
@@ -1381,3 +1381,33 @@ void NormalizeBuffer(
|
||||
|
||||
//
|
||||
// Moving Average ...
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// //
|
||||
// double ranges[];
|
||||
// int rangesCount = GetPriceRange(
|
||||
// ranges,
|
||||
// bar,
|
||||
// forcBodyInRange,
|
||||
// loopback //
|
||||
// );
|
||||
// result = IsValidSize(rangesCount);
|
||||
// if (!result)
|
||||
// {
|
||||
// //
|
||||
// Clean(ranges);
|
||||
|
||||
// //
|
||||
// return result;
|
||||
// }
|
||||
|
||||
//
|
||||
// Calculate Ranges ...
|
||||
// double rangeMax = GetMax(ranges);
|
||||
// double rangeMin = GetMin(ranges);
|
||||
// double rangeAverage = GetAverage(ranges);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -8,10 +8,10 @@
|
||||
#property version "1.00"
|
||||
|
||||
//
|
||||
// #include "../Classes/x-saherelm.x-poi.class.mq5"
|
||||
// #include "../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
||||
// #include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5"
|
||||
// #include "../Libraries/x-saherelm.x-poi.state.lib.mq5"
|
||||
#include "../Classes/x-saherelm.x-poi.class.mq5"
|
||||
#include "../Classes/x-saherelm.x-poi.drawer.class.mq5"
|
||||
#include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5"
|
||||
#include "../Libraries/x-saherelm.x-poi.state.lib.mq5"
|
||||
|
||||
//
|
||||
#include "../Classes/x-saherelm.x-bar.analyser.class.mq5"
|
||||
@@ -20,16 +20,16 @@
|
||||
// Global Variables ...
|
||||
|
||||
//
|
||||
// XCPOIDrawer *mPOIDrawer;
|
||||
XCPOIDrawer *mPOIDrawer;
|
||||
|
||||
//
|
||||
// XCPOIDetector *mPOIDetector;
|
||||
XCPOIDetector *mPOIDetector;
|
||||
XBarTracker mBarTracker;
|
||||
XCBarAnalyser *mBarAnalyser;
|
||||
|
||||
//
|
||||
bool useDetector = false;
|
||||
bool useBarAnalyser = true;
|
||||
bool useDetector = true;
|
||||
bool useBarAnalyser = false;
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Expert initialization function |
|
||||
@@ -37,13 +37,13 @@ bool useBarAnalyser = true;
|
||||
int OnInit()
|
||||
{
|
||||
//
|
||||
// mPOIDetector = new XCPOIDetector(
|
||||
// _Symbol,
|
||||
// _Period //
|
||||
// );
|
||||
mPOIDetector = new XCPOIDetector(
|
||||
_Symbol,
|
||||
_Period //
|
||||
);
|
||||
|
||||
//
|
||||
// mPOIDrawer = new XCPOIDrawer();
|
||||
mPOIDrawer = new XCPOIDrawer();
|
||||
|
||||
//
|
||||
mBarAnalyser = new XCBarAnalyser();
|
||||
@@ -128,18 +128,23 @@ void DetectBarAnalyser()
|
||||
}
|
||||
|
||||
//
|
||||
// Check Big Change in Price ...
|
||||
int rootIDX = -1;
|
||||
XOHCL selectedBar;
|
||||
ENUM_X_DIRECTION dir;
|
||||
bool isBigChange = mBarAnalyser.IsBigChange(
|
||||
|
||||
//
|
||||
// Check Big Change in Price ...
|
||||
bool isBigChange = mBarAnalyser.IsSharp(
|
||||
zBar, // Bar ...
|
||||
dir, // Change Direction ...
|
||||
rootIDX, // Change Root IDX ...
|
||||
X_PRICE_CLOSE, // Price Change Type ...
|
||||
true, // Force Use Body for Range Calculation ...
|
||||
1.0 // Range Extend Multiplier ...
|
||||
);
|
||||
if (isBigChange)
|
||||
{
|
||||
// Print("Big Price Change Detected: ", ToString(dir));
|
||||
Print("Big Price Change Detected: ", ToString(dir));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -147,6 +152,7 @@ void DetectBarAnalyser()
|
||||
bool isSpike = mBarAnalyser.IsSpike(
|
||||
zBar, // Bar ...
|
||||
dir, // Change Direction ...
|
||||
rootIDX, // Root Index ...
|
||||
X_PRICE_CLOSE, // Price Change Type ...
|
||||
true, // Force Use Body for Range Calculation ...
|
||||
1.0, // Range Extend Multiplier ...
|
||||
@@ -154,7 +160,7 @@ void DetectBarAnalyser()
|
||||
);
|
||||
if (isSpike)
|
||||
{
|
||||
// Print("Spike Detected: ", ToString(dir));
|
||||
Print("Spike Detected: ", ToString(dir));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -212,6 +218,81 @@ void DetectBarAnalyser()
|
||||
Print(ToString(dir), " Pullback Detected ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Check Swing Pattern ...
|
||||
bool isSwing = mBarAnalyser.IsSwing(
|
||||
cBar,
|
||||
dir //
|
||||
);
|
||||
if (isSwing)
|
||||
{
|
||||
Print(ToString(dir), " Swing Detected ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Check Swing Pattern ...
|
||||
bool isRejected = mBarAnalyser.IsRejected(
|
||||
cBar,
|
||||
dir //
|
||||
);
|
||||
if (isRejected)
|
||||
{
|
||||
Print(ToString(dir), " Rejected Detected ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Check Support ...
|
||||
bool isSupport = mBarAnalyser.HasSupport(
|
||||
cBar,
|
||||
selectedBar //
|
||||
);
|
||||
if (isSupport)
|
||||
{
|
||||
Print(ToString(dir), " Support Detected ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Check Resistance ...
|
||||
bool isResistance = mBarAnalyser.HasResistance(
|
||||
cBar,
|
||||
selectedBar //
|
||||
);
|
||||
if (isResistance)
|
||||
{
|
||||
Print(ToString(dir), " Resistance Detected ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Check Fair Value Gap ...
|
||||
XOHCL toBar;
|
||||
XOHCL fromBar;
|
||||
bool hasFVG = mBarAnalyser.HasFairValueGap(
|
||||
zBar,
|
||||
fromBar,
|
||||
toBar,
|
||||
dir,
|
||||
3 //
|
||||
);
|
||||
if (hasFVG)
|
||||
{
|
||||
Print(ToString(dir), " FairValueGap Detected ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Check Order Block ...
|
||||
bool hasOB = mBarAnalyser.HasOrderBlock(
|
||||
zBar,
|
||||
selectedBar,
|
||||
dir,
|
||||
true,
|
||||
true,
|
||||
true //
|
||||
);
|
||||
if (hasOB)
|
||||
{
|
||||
Print(ToString(dir), " OrderBlock Detected ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
@@ -230,6 +311,70 @@ void DetectPOIState()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
if (!mBarTracker.IsNewBar())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
ENUM_XPOI_EVENTS poiEvents[];
|
||||
XPOIStateEvents poiEventNotifier;
|
||||
mPOIDetector.Update(
|
||||
poiEvents,
|
||||
0 //
|
||||
);
|
||||
poiEventNotifier.Init(poiEvents);
|
||||
|
||||
//
|
||||
XPOIState state;
|
||||
mPOIDetector.GetState(state);
|
||||
|
||||
//
|
||||
bool showBullishPOIs = true;
|
||||
bool showBearishPOIs = true;
|
||||
|
||||
//
|
||||
XCBaseObject *stateObjects[];
|
||||
mPOIDrawer.DrawState(
|
||||
state,
|
||||
stateObjects,
|
||||
//
|
||||
// Bullish ...
|
||||
showBullishPOIs && false, // SwingLows
|
||||
showBullishPOIs && true, // DemandZones
|
||||
showBullishPOIs && true, // SupportZones
|
||||
showBullishPOIs && true, // BullishSharps
|
||||
showBullishPOIs && false, // BullishSpikes
|
||||
showBullishPOIs && true, // BullishMomentums
|
||||
showBullishPOIs && true, // BullishRejections
|
||||
showBullishPOIs && true, // BullishOrderBlocks
|
||||
showBullishPOIs && true, // BullishFairValueGaps
|
||||
showBullishPOIs && true, // BullishConsolidationZones
|
||||
//
|
||||
// Bearish ...
|
||||
showBearishPOIs && false, // SwingHighs
|
||||
showBearishPOIs && true, // SupplyZones
|
||||
showBearishPOIs && true, // BearishSharps
|
||||
showBearishPOIs && false, // BearishSpikes
|
||||
showBearishPOIs && true, // ResistanceZones
|
||||
showBearishPOIs && true, // BearishMomentums
|
||||
showBearishPOIs && true, // BearishRejections
|
||||
showBearishPOIs && true, // BearishOrderBlocks
|
||||
showBearishPOIs && true, // BearishFairValueGaps
|
||||
showBearishPOIs && true // BearishConsolidationZones
|
||||
);
|
||||
|
||||
//
|
||||
if (poiEventNotifier.hasNewSwing)
|
||||
{
|
||||
Print("Swing ...");
|
||||
}
|
||||
|
||||
//
|
||||
Clean(poiEvents);
|
||||
poiEventNotifier.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -834,6 +834,34 @@ double GetPoints(
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts Price to Point ...
|
||||
*
|
||||
* @param price: double, price ...
|
||||
* @param mSymbol: string, Symbol ...
|
||||
*
|
||||
* @return ( double )
|
||||
*/
|
||||
double PriceToPoint(
|
||||
double mPrice, // the price amount which required to calculate
|
||||
string mSymbol = NULL // Trading Symbol
|
||||
)
|
||||
{
|
||||
//
|
||||
double result = 0;
|
||||
|
||||
//
|
||||
mSymbol = NormalizeSymbol(mSymbol);
|
||||
mPrice = NormalizePrice(mPrice, mSymbol);
|
||||
|
||||
//
|
||||
double point = GetPoints(mSymbol);
|
||||
result = mPrice / point;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Digits Length ...
|
||||
*
|
||||
@@ -3453,147 +3481,147 @@ int GetPeriodSharpData(
|
||||
//
|
||||
case PERIOD_M1:
|
||||
//
|
||||
priceChange = 0.000008;
|
||||
priceChange = 0.000006;
|
||||
result = 14;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_M2:
|
||||
//
|
||||
priceChange = 0.000008;
|
||||
priceChange = 0.000006;
|
||||
result = 14;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_M3:
|
||||
//
|
||||
priceChange = 0.00001;
|
||||
priceChange = 0.00007;
|
||||
result = 14;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_M4:
|
||||
//
|
||||
priceChange = 0.000011;
|
||||
priceChange = 0.000007;
|
||||
result = 14;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_M5:
|
||||
//
|
||||
priceChange = 0.000015;
|
||||
priceChange = 0.000009;
|
||||
result = 14;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_M6:
|
||||
//
|
||||
priceChange = 0.000015;
|
||||
priceChange = 0.000009;
|
||||
result = 14;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_M10:
|
||||
//
|
||||
priceChange = 0.000015;
|
||||
priceChange = 0.00001;
|
||||
result = 12;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_M12:
|
||||
//
|
||||
priceChange = 0.000015;
|
||||
priceChange = 0.000011;
|
||||
result = 11;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_M15:
|
||||
//
|
||||
priceChange = 0.000015;
|
||||
priceChange = 0.000011;
|
||||
result = 9;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_M20:
|
||||
//
|
||||
priceChange = 0.000015;
|
||||
priceChange = 0.000012;
|
||||
result = 9;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_M30:
|
||||
//
|
||||
priceChange = 0.000017;
|
||||
priceChange = 0.000012;
|
||||
result = 7;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_H1:
|
||||
//
|
||||
priceChange = 0.000019;
|
||||
priceChange = 0.000013;
|
||||
result = 5;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_H2:
|
||||
//
|
||||
priceChange = 0.000019;
|
||||
priceChange = 0.000013;
|
||||
result = 5;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_H3:
|
||||
//
|
||||
priceChange = 0.000019;
|
||||
priceChange = 0.000014;
|
||||
result = 5;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_H4:
|
||||
//
|
||||
priceChange = 0.000022;
|
||||
priceChange = 0.000014;
|
||||
result = 5;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_H6:
|
||||
//
|
||||
priceChange = 0.000022;
|
||||
priceChange = 0.000015;
|
||||
result = 5;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_H8:
|
||||
//
|
||||
priceChange = 0.000025;
|
||||
priceChange = 0.000017;
|
||||
result = 5;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_H12:
|
||||
//
|
||||
priceChange = 0.000027;
|
||||
priceChange = 0.000017;
|
||||
result = 5;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_D1:
|
||||
//
|
||||
priceChange = 0.000027;
|
||||
priceChange = 0.000019;
|
||||
result = 3;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_W1:
|
||||
//
|
||||
priceChange = 0.00003;
|
||||
priceChange = 0.00002;
|
||||
result = 3;
|
||||
break;
|
||||
|
||||
//
|
||||
case PERIOD_MN1:
|
||||
//
|
||||
priceChange = 0.00003;
|
||||
priceChange = 0.000021;
|
||||
result = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
//
|
||||
// Imports ...
|
||||
#include "../Libraries/x-saherelm.x-poi.lib.mq5"
|
||||
#include "../Libraries/x-saherelm.x-poi.state.lib.mq5"
|
||||
|
||||
//
|
||||
// Extensions ...
|
||||
|
||||
@@ -70,6 +70,12 @@ enum ENUM_XPOIS
|
||||
//
|
||||
X_BULLISH_CONSOLIDATION_ZONE,
|
||||
X_BEARISH_CONSOLIDATION_ZONE,
|
||||
//
|
||||
X_BULLISH_SHARP,
|
||||
X_BEARISH_SHARP,
|
||||
//
|
||||
X_BULLISH_SPIKE,
|
||||
X_BEARISH_SPIKE,
|
||||
};
|
||||
|
||||
//
|
||||
@@ -116,6 +122,10 @@ enum ENUM_XPOI_EVENTS
|
||||
X_BEARISH_FVG_DETECTED, // Bearish Fair Value Gapّ ...
|
||||
X_BULLISH_CONSOLIDATION_ZONE_DETECTED,
|
||||
X_BEARISH_CONSOLIDATION_ZONE_DETECTED,
|
||||
X_BULLISH_SHARP_DETECTED,
|
||||
X_BEARISH_SHARP_DETECTED,
|
||||
X_BULLISH_SPIKE_DETECTED,
|
||||
X_BEARISH_SPIKE_DETECTED,
|
||||
};
|
||||
|
||||
//
|
||||
@@ -237,6 +247,16 @@ string ToString(ENUM_XPOIS value)
|
||||
case X_BEARISH_CONSOLIDATION_ZONE:
|
||||
result = "XBEARCZ";
|
||||
break;
|
||||
|
||||
//
|
||||
case X_BULLISH_SPIKE:
|
||||
result = "XBULLSPK";
|
||||
break;
|
||||
|
||||
//
|
||||
case X_BEARISH_SPIKE:
|
||||
result = "XBEARSPK";
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user