last ...
This commit is contained in:
@@ -0,0 +1,479 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SaherElm IT Center MQL5 Class
|
||||||
|
// -------------------------------------------------
|
||||||
|
// Name: XCXBaseSignaller ...
|
||||||
|
// Description: Base Signaller Class ...
|
||||||
|
//
|
||||||
|
// - Create an Instance based on this ...
|
||||||
|
// - Attach Required Helpers for Indicator Usages ...
|
||||||
|
// - Override Virtual Methdos:
|
||||||
|
// - [] ProcessTick: Processing All Ticks
|
||||||
|
// - [] ProcessNewBar: Processing All New Bars
|
||||||
|
// - [] CheckForGuard: Check For Guards
|
||||||
|
// - [] CheckAdditionslSignallerValidations: Additional Class Validations
|
||||||
|
//
|
||||||
|
// - Dont Forget to Call OnSignal Event in Process Methods when
|
||||||
|
// a signal Appears ...
|
||||||
|
//
|
||||||
|
// - also Whenever you want you can call PrepareSignal Action to
|
||||||
|
// provide a Signal based on Current Market State ...
|
||||||
|
//
|
||||||
|
// Maintainer:
|
||||||
|
// ------------
|
||||||
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Global Properties ...
|
||||||
|
#property library
|
||||||
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||||
|
#property link "https://saherelm.ir"
|
||||||
|
#property version "1.00"
|
||||||
|
#property description "SaherElm Base Signaller Class"
|
||||||
|
#property strict
|
||||||
|
|
||||||
|
//
|
||||||
|
// Imports ...
|
||||||
|
#include "../Classes/x-saherelm.base.class.mq5"
|
||||||
|
#include "../Libraries/x-saherelm.x-trade.lib.mq5"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Definitions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// a Event Listener for Checking Can Analyse Market or not ...
|
||||||
|
// Usually for Time Based Session Handling ...
|
||||||
|
typedef bool (*TXCSignallerCanAnalyse)(
|
||||||
|
string _symbol,
|
||||||
|
ENUM_TIMEFRAMES _period,
|
||||||
|
datetime _time //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// a Event Listener for Notifying a Signal ...
|
||||||
|
// Usually for Time Based Session Handling ...
|
||||||
|
typedef bool (*TXCSignallerOnSignalEvent)(XSignal &signal);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Implementations ...
|
||||||
|
class XCXBaseSignaller : public XCBase
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Public ...
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
string name; // Name ...
|
||||||
|
string symbol; // Symbol ...
|
||||||
|
ENUM_TIMEFRAMES period; // Period ...
|
||||||
|
|
||||||
|
//
|
||||||
|
TXCSignallerCanAnalyse canAnalyseEventListener;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor ...
|
||||||
|
XCXBaseSignaller(
|
||||||
|
string _name, // Name ...
|
||||||
|
string _symbol, // Symbol ...
|
||||||
|
ENUM_TIMEFRAMES _period, // Period ...
|
||||||
|
bool _processAllTicks = false, // Process All Ticks ...
|
||||||
|
double _defaultSignalR2R = 1.5, // Default Signal Risk To Reward Ratio ...
|
||||||
|
double _defaultSignalRiskInPoint = 50, // Default Signal Risk In Point ...
|
||||||
|
double _defaultSignalVolume = 0.01 // Default Signal Volume ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Assign Properties ...
|
||||||
|
name = _name;
|
||||||
|
symbol = _symbol;
|
||||||
|
period = _period;
|
||||||
|
|
||||||
|
//
|
||||||
|
processAllTicks = _processAllTicks;
|
||||||
|
defaultSignalR2R = _defaultSignalR2R;
|
||||||
|
defaultSignalVolume = _defaultSignalVolume;
|
||||||
|
defaultSignalRiskInPoint = _defaultSignalRiskInPoint;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalize ...
|
||||||
|
defaultSignalR2R = NormalizeDouble(defaultSignalR2R, 1, 10);
|
||||||
|
defaultSignalVolume = NormalizeDouble(defaultSignalVolume, 0.01);
|
||||||
|
defaultSignalVolume = NormalizeVolume(defaultSignalVolume, symbol, 2);
|
||||||
|
defaultSignalRiskInPoint = NormalizeDouble(defaultSignalRiskInPoint, 10);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set Dfault Values ...
|
||||||
|
mProcessedTicksCount = 0;
|
||||||
|
mLastCheckedBarTime = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Deconstructor ...
|
||||||
|
~XCXBaseSignaller()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Cleanup Event Listeners ...
|
||||||
|
SpecifiedClean(onSignalEventListeners);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Event Listeners ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add On Signal Event Listener ...
|
||||||
|
*
|
||||||
|
* @param listener: TXCSignallerOnSignalEvent instance ...
|
||||||
|
*/
|
||||||
|
void AddOnSignalEventListener(TXCSignallerOnSignalEvent listener)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
if (listener == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
listener,
|
||||||
|
onSignalEventListeners //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Actions ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Signaller Validation ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool IsValid()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
IsSpecifiedValid(name) &&
|
||||||
|
IsSpecifiedValid(symbol) &&
|
||||||
|
IsSpecifiedValid(period) &&
|
||||||
|
//
|
||||||
|
CheckAdditionslSignallerValidations()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handling On Tick Event ...
|
||||||
|
*
|
||||||
|
* @param barIndex: int, Specified Bar Index ...
|
||||||
|
*/
|
||||||
|
void OnTick(int barIndex = 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Normalize Bar Index ...
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Define Requirements ...
|
||||||
|
XOHCL iBar;
|
||||||
|
bool has = false;
|
||||||
|
bool isNewBar = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get Current Bar Time ...
|
||||||
|
datetime cBarTime = GetBarTime(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Bar Time ...
|
||||||
|
has = IsSpecifiedValid(cBarTime);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Process Permissions ...
|
||||||
|
has = CanAnalyseMarket(cBarTime);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check if new Bar, Reset Processed Ticks Count ...
|
||||||
|
isNewBar = cBarTime > mLastCheckedBarTime;
|
||||||
|
if (isNewBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mProcessedTicksCount = 0;
|
||||||
|
ProcessNewBar(barIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Allow Process ...
|
||||||
|
// Process All Ticks ...
|
||||||
|
// Process New Bars ...
|
||||||
|
has = processAllTicks ||
|
||||||
|
(!processAllTicks && isNewBar);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set Last Works ...
|
||||||
|
mProcessedTicksCount++;
|
||||||
|
mLastCheckedBarTime = cBarTime;
|
||||||
|
|
||||||
|
//
|
||||||
|
ProcessTick(barIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Virtuals ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processing Tick ...
|
||||||
|
*
|
||||||
|
* @param barIndex: int, Specified Bar Index ...
|
||||||
|
*/
|
||||||
|
virtual void ProcessTick(int barIndex = 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processing New Bar ...
|
||||||
|
*
|
||||||
|
* @param barIndex: int, Specified Bar Index ...
|
||||||
|
*/
|
||||||
|
virtual void ProcessNewBar(int barIndex = 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Guards Based on MarketConditions ...
|
||||||
|
*
|
||||||
|
* @param guards: XGuard[]
|
||||||
|
* @param barIndex: int
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
int virtual CheckForGuard(
|
||||||
|
XGuard &guards[],
|
||||||
|
int barIndex = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
SpecifiedClean(guards);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(guards);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Additional Validations on Childs Instances ...
|
||||||
|
*
|
||||||
|
* @return ( bool virtual )
|
||||||
|
*/
|
||||||
|
bool virtual CheckAdditionslSignallerValidations()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protected ...
|
||||||
|
protected:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool processAllTicks; // Specified Processing All Ticks or not ...
|
||||||
|
|
||||||
|
//
|
||||||
|
int mProcessedTicksCount; // Prcoessed Ticks Count ...
|
||||||
|
datetime mLastCheckedBarTime; // Last Checked Bar Time ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double defaultSignalR2R; // Default Signal Risk To Reward Ratio ...
|
||||||
|
double defaultSignalVolume; // Default Signal Volume ...
|
||||||
|
double defaultSignalRiskInPoint; // Default Signal Risk In Point ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Event Notifiers ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify OnSignal Event Listeners ...
|
||||||
|
*
|
||||||
|
* @param signal: XSignal, Specified Signal to Notify ...
|
||||||
|
*/
|
||||||
|
void NotifySignalEventListeners(XSignal &signal)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = ArraySize(onSignalEventListeners);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
if (!IsValidSize(count) || !signal.IsValid())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Notify ...
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
onSignalEventListeners[i](signal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calling Can Analyse Event Listeners ...
|
||||||
|
* Check Can Analayse Market or not ...
|
||||||
|
*
|
||||||
|
* @param time: datetime, Specified Time for Checking ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool CanAnalyseMarket(datetime time = NULL)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalize ...
|
||||||
|
time = NormalizeTime(time);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validation ...
|
||||||
|
result = IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = canAnalyseEventListener == NULL;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calling Can Analyse Event Listener ...
|
||||||
|
result = canAnalyseEventListener(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
time //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preparing Default Signal ...
|
||||||
|
*
|
||||||
|
* @param signal: XSignal, holding result Signal ...
|
||||||
|
* @param forDir: ENUM_X_DIRECTION
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool PrepareSignal(
|
||||||
|
XSignal &signal,
|
||||||
|
ENUM_X_DIRECTION forDir //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare ...
|
||||||
|
signal.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalize ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result = IsValid() &&
|
||||||
|
HasDirection(forDir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = IsSpecifiedBullish(forDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
double point = GetPoints(symbol);
|
||||||
|
double spread = GetSpread(symbol);
|
||||||
|
double volume = defaultSignalVolume;
|
||||||
|
double entry = GetEntry(symbol, forDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
double risk = (defaultSignalRiskInPoint * point);
|
||||||
|
double reward = (risk * defaultSignalR2R) + spread;
|
||||||
|
|
||||||
|
//
|
||||||
|
double tp =
|
||||||
|
isBullish
|
||||||
|
? entry + reward
|
||||||
|
: entry - reward;
|
||||||
|
|
||||||
|
//
|
||||||
|
double sl =
|
||||||
|
isBullish
|
||||||
|
? entry - risk
|
||||||
|
: entry + risk;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Filling Values ...
|
||||||
|
signal.tp = tp;
|
||||||
|
signal.sl = sl;
|
||||||
|
signal.entry = entry;
|
||||||
|
signal.provider = name;
|
||||||
|
signal.symbol = symbol;
|
||||||
|
signal.period = period;
|
||||||
|
signal.volume = volume;
|
||||||
|
signal.time = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Signal ...
|
||||||
|
result = signal.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Private ...
|
||||||
|
private:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Event Listeners ...
|
||||||
|
TXCSignallerOnSignalEvent onSignalEventListeners[];
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#property link "https://saherelm.ir"
|
#property link "https://saherelm.ir"
|
||||||
#property version "1.00"
|
#property version "1.00"
|
||||||
#property description "SaherElm XBackTester"
|
#property description "SaherElm XBackTester"
|
||||||
|
#property icon "../Images/SaherElm_Logo_Color.ico"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -84,19 +85,20 @@ input ENUM_SERIESMODE lowerMode = MODE_LOW; // Vale Method
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Others ...
|
// Others ...
|
||||||
input ENUM_X_FIBO_LEVELS upperZoneLevel = X_FIBO_LEVEL_618; // Upper Zone Level
|
input ENUM_X_FIBO_LEVELS fiboUpperZoneLevel = X_FIBO_LEVEL_382; // Upper Zone Level
|
||||||
input ENUM_X_FIBO_LEVELS lowerZoneLevel = X_FIBO_LEVEL_382; // Lower Zone Level
|
input ENUM_X_FIBO_LEVELS fiboMiddleZoneLevel = X_FIBO_LEVEL_500; // Middle Zone Level
|
||||||
input double sarStep = 0.02; // SAR Step
|
input ENUM_X_FIBO_LEVELS fiboLowerZoneLevel = X_FIBO_LEVEL_618; // Lower Zone Level
|
||||||
input double sarMax = 0.2; // SAR Maximum
|
input double sarStep = 0.02; // SAR Step
|
||||||
input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Method
|
input double sarMax = 0.2; // SAR Maximum
|
||||||
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
|
input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Method
|
||||||
input int maFastLength = 7; // Fast MA Length
|
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
|
||||||
input int maSlowLength = 20; // Slow MA Length
|
input int maFastLength = 7; // Fast MA Length
|
||||||
input int zigzagDepth = 12; // ZigZag Depth
|
input int maSlowLength = 20; // Slow MA Length
|
||||||
input int zigzagDeviation = 5; // ZigZag Deviation
|
input int zigzagDepth = 12; // ZigZag Depth
|
||||||
input int zigzagBackStep = 3; // ZigZag Back Step
|
input int zigzagDeviation = 5; // ZigZag Deviation
|
||||||
input ENUM_X_PRICE zigzagUppersMode = X_PRICE_HIGH; // ZigZag High Detect Mode
|
input int zigzagBackStep = 3; // ZigZag Back Step
|
||||||
input ENUM_X_PRICE zigzagLowersMode = X_PRICE_LOW; // ZigZag Low Detect Mode
|
input ENUM_X_PRICE zigzagUppersMode = X_PRICE_HIGH; // ZigZag High Detect Mode
|
||||||
|
input ENUM_X_PRICE zigzagLowersMode = X_PRICE_LOW; // ZigZag Low Detect Mode
|
||||||
|
|
||||||
//
|
//
|
||||||
input group "Bar Timer";
|
input group "Bar Timer";
|
||||||
@@ -108,13 +110,13 @@ input ENUM_BASE_CORNER barTimeCorner = CORNER_RIGHT_LOWER; // Text Position
|
|||||||
//
|
//
|
||||||
// Presentation ...
|
// Presentation ...
|
||||||
input group "Presentation";
|
input group "Presentation";
|
||||||
input bool showPV = true; // Show PV
|
input bool showPV = true; // Show PV
|
||||||
input bool showSAR = true; // Show Sar
|
input bool showSAR = true; // Show Sar
|
||||||
input bool showMAFast = true; // Show MA Fast
|
input bool showMAFast = true; // Show MA Fast
|
||||||
input bool showMASlow = true; // Show MA Slow
|
input bool showMASlow = true; // Show MA Slow
|
||||||
input bool showBarTime = true; // Show Bar Time
|
input bool showBarTime = true; // Show Bar Time
|
||||||
input bool showZigZag = true; // Show ZigZag
|
input bool showZigZag = true; // Show ZigZag
|
||||||
input bool showFiboZone = false; // Show Fibo Zone
|
input bool showFiboZone = true; // Show Fibo Zone
|
||||||
|
|
||||||
//
|
//
|
||||||
input int startCalculationForLastBars = 1500; // Calculate Last n Bars
|
input int startCalculationForLastBars = 1500; // Calculate Last n Bars
|
||||||
@@ -249,8 +251,9 @@ int OnInit()
|
|||||||
hcPeriod,
|
hcPeriod,
|
||||||
upperMode,
|
upperMode,
|
||||||
lowerMode,
|
lowerMode,
|
||||||
upperZoneLevel,
|
fiboUpperZoneLevel,
|
||||||
lowerZoneLevel,
|
fiboMiddleZoneLevel,
|
||||||
|
fiboLowerZoneLevel,
|
||||||
sarStep,
|
sarStep,
|
||||||
sarMax,
|
sarMax,
|
||||||
maMethod,
|
maMethod,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -33,6 +33,7 @@
|
|||||||
#property link "https://saherelm.ir"
|
#property link "https://saherelm.ir"
|
||||||
#property version "1.00"
|
#property version "1.00"
|
||||||
#property description "SaherElm X121 XCATB Indicator"
|
#property description "SaherElm X121 XCATB Indicator"
|
||||||
|
#property icon "../Images/SaherElm_Logo_Color.ico"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#property link "https://saherelm.ir"
|
#property link "https://saherelm.ir"
|
||||||
#property version "1.00"
|
#property version "1.00"
|
||||||
#property description "SaherElm X121 XCATB Indicator"
|
#property description "SaherElm X121 XCATB Indicator"
|
||||||
|
#property icon "../Images/SaherElm_Logo_Color.ico"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#property link "https://saherelm.ir"
|
#property link "https://saherelm.ir"
|
||||||
#property version "1.00"
|
#property version "1.00"
|
||||||
#property description "SaherElm X121 XCC Indicator"
|
#property description "SaherElm X121 XCC Indicator"
|
||||||
|
#property icon "../Images/SaherElm_Logo_Color.ico"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#property link "https://saherelm.ir"
|
#property link "https://saherelm.ir"
|
||||||
#property version "1.00"
|
#property version "1.00"
|
||||||
#property description "SaherElm X121 XCT Indicator"
|
#property description "SaherElm X121 XCT Indicator"
|
||||||
|
#property icon "../Images/SaherElm_Logo_Color.ico"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#property link "https://saherelm.ir"
|
#property link "https://saherelm.ir"
|
||||||
#property version "1.00"
|
#property version "1.00"
|
||||||
#property description "SaherElm X121 XMA Indicator"
|
#property description "SaherElm X121 XMA Indicator"
|
||||||
|
#property icon "../Images/SaherElm_Logo_Color.ico"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#property link "https://saherelm.ir"
|
#property link "https://saherelm.ir"
|
||||||
#property version "1.00"
|
#property version "1.00"
|
||||||
#property description "SaherElm XFIMA Indicator"
|
#property description "SaherElm XFIMA Indicator"
|
||||||
|
#property icon "../Images/SaherElm_Logo_Color.ico"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -73,19 +74,20 @@ input ENUM_SERIESMODE lowerMode = MODE_LOW; // Vale Method
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Others ...
|
// Others ...
|
||||||
input ENUM_X_FIBO_LEVELS upperZoneLevel = X_FIBO_LEVEL_618; // Upper Zone Level
|
input ENUM_X_FIBO_LEVELS fiboUpperZoneLevel = X_FIBO_LEVEL_382; // Upper Zone Level
|
||||||
input ENUM_X_FIBO_LEVELS lowerZoneLevel = X_FIBO_LEVEL_382; // Lower Zone Level
|
input ENUM_X_FIBO_LEVELS fiboMiddleZoneLevel = X_FIBO_LEVEL_500; // Upper Zone Level
|
||||||
input double sarStep = 0.02; // SAR Step
|
input ENUM_X_FIBO_LEVELS fiboLowerZoneLevel = X_FIBO_LEVEL_618; // Lower Zone Level
|
||||||
input double sarMax = 0.2; // SAR Maximum
|
input double sarStep = 0.02; // SAR Step
|
||||||
input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Method
|
input double sarMax = 0.2; // SAR Maximum
|
||||||
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
|
input ENUM_MA_METHOD maMethod = MODE_EMA; // MA Method
|
||||||
input int maFastLength = 7; // Fast MA Length
|
input ENUM_APPLIED_PRICE maAppliedTo = PRICE_CLOSE; // MA Applied To
|
||||||
input int maSlowLength = 20; // Slow MA Length
|
input int maFastLength = 7; // Fast MA Length
|
||||||
input int zigzagDepth = 12; // ZigZag Depth
|
input int maSlowLength = 20; // Slow MA Length
|
||||||
input int zigzagDeviation = 5; // ZigZag Deviation
|
input int zigzagDepth = 12; // ZigZag Depth
|
||||||
input int zigzagBackStep = 3; // ZigZag Back Step
|
input int zigzagDeviation = 5; // ZigZag Deviation
|
||||||
input ENUM_X_PRICE zigzagUppersMode = X_PRICE_HIGH; // ZigZag High Detect Mode
|
input int zigzagBackStep = 3; // ZigZag Back Step
|
||||||
input ENUM_X_PRICE zigzagLowersMode = X_PRICE_LOW; // ZigZag Low Detect Mode
|
input ENUM_X_PRICE zigzagUppersMode = X_PRICE_HIGH; // ZigZag High Detect Mode
|
||||||
|
input ENUM_X_PRICE zigzagLowersMode = X_PRICE_LOW; // ZigZag Low Detect Mode
|
||||||
|
|
||||||
//
|
//
|
||||||
// Presentation ...
|
// Presentation ...
|
||||||
@@ -129,8 +131,8 @@ input int valeArrowCode = 159; // Vales Arrow Code
|
|||||||
#property indicator_chart_window
|
#property indicator_chart_window
|
||||||
|
|
||||||
//
|
//
|
||||||
#property indicator_buffers 26
|
#property indicator_buffers 27
|
||||||
#property indicator_plots 8
|
#property indicator_plots 9
|
||||||
|
|
||||||
//
|
//
|
||||||
// Plot Buffers ...
|
// Plot Buffers ...
|
||||||
@@ -150,8 +152,8 @@ double maFastColorBuffer[];
|
|||||||
//
|
//
|
||||||
#property indicator_label1 "FastMA"
|
#property indicator_label1 "FastMA"
|
||||||
#property indicator_type1 DRAW_COLOR_LINE
|
#property indicator_type1 DRAW_COLOR_LINE
|
||||||
#property indicator_color1 CLR_NONE, clrYellow, clrOrangeRed, clrGray
|
#property indicator_color1 CLR_NONE, clrAquamarine, clrAquamarine, clrAquamarine // clrYellow, clrOrangeRed, clrGray
|
||||||
#property indicator_width1 2
|
#property indicator_width1 3
|
||||||
|
|
||||||
//
|
//
|
||||||
// Slow MA ...
|
// Slow MA ...
|
||||||
@@ -168,8 +170,8 @@ double maSlowColorBuffer[];
|
|||||||
//
|
//
|
||||||
#property indicator_label2 "SlowMA"
|
#property indicator_label2 "SlowMA"
|
||||||
#property indicator_type2 DRAW_COLOR_LINE
|
#property indicator_type2 DRAW_COLOR_LINE
|
||||||
#property indicator_color2 CLR_NONE, clrLime, clrRed, clrGray
|
#property indicator_color2 CLR_NONE, clrLightCoral, clrLightCoral, clrLightCoral // clrLime, clrRed, clrGray
|
||||||
#property indicator_width2 2
|
#property indicator_width2 3
|
||||||
|
|
||||||
//
|
//
|
||||||
// SAR ...
|
// SAR ...
|
||||||
@@ -231,39 +233,53 @@ double fiboUpperBuffer[];
|
|||||||
#property indicator_color6 clrAqua
|
#property indicator_color6 clrAqua
|
||||||
#property indicator_width6 2
|
#property indicator_width6 2
|
||||||
|
|
||||||
|
//
|
||||||
|
// FIBO Middle ...
|
||||||
|
|
||||||
|
//
|
||||||
|
#define fiboMiddleBufferIndex 9
|
||||||
|
#define fiboMiddleBufferPlotIndex 6
|
||||||
|
double fiboMiddleBuffer[];
|
||||||
|
|
||||||
|
//
|
||||||
|
#property indicator_label7 "FIBMID"
|
||||||
|
#property indicator_type7 DRAW_LINE
|
||||||
|
#property indicator_color7 clrBrown
|
||||||
|
#property indicator_width7 2
|
||||||
|
|
||||||
//
|
//
|
||||||
// FIBO Lower ...
|
// FIBO Lower ...
|
||||||
|
|
||||||
//
|
//
|
||||||
#define fiboLowerBufferIndex 9
|
#define fiboLowerBufferIndex 10
|
||||||
#define fiboLowerBufferPlotIndex 6
|
#define fiboLowerBufferPlotIndex 7
|
||||||
double fiboLowerBuffer[];
|
double fiboLowerBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#property indicator_label7 "FIBLO"
|
#property indicator_label8 "FIBLO"
|
||||||
#property indicator_type7 DRAW_LINE
|
#property indicator_type8 DRAW_LINE
|
||||||
#property indicator_color7 clrMagenta
|
#property indicator_color8 clrMagenta
|
||||||
#property indicator_width7 2
|
#property indicator_width8 2
|
||||||
|
|
||||||
//
|
//
|
||||||
// ZigZag ...
|
// ZigZag ...
|
||||||
|
|
||||||
//
|
//
|
||||||
#define zigzagBufferIndex 10
|
#define zigzagBufferIndex 11
|
||||||
#define zigzagBufferPlotIndex 7
|
#define zigzagBufferPlotIndex 8
|
||||||
double zigzagBuffer[];
|
double zigzagBuffer[];
|
||||||
|
|
||||||
//
|
//
|
||||||
#property indicator_label8 "XZG"
|
#property indicator_label9 "XZG"
|
||||||
#property indicator_type8 DRAW_SECTION
|
#property indicator_type9 DRAW_SECTION
|
||||||
#property indicator_color8 clrYellow
|
#property indicator_color9 clrYellow
|
||||||
#property indicator_width8 2
|
#property indicator_width9 2
|
||||||
|
|
||||||
//
|
//
|
||||||
// Data Buffers ...
|
// Data Buffers ...
|
||||||
|
|
||||||
//
|
//
|
||||||
#define mLastBufferIndex 10
|
#define mLastBufferIndex 11
|
||||||
|
|
||||||
//
|
//
|
||||||
// MA ...
|
// MA ...
|
||||||
@@ -825,6 +841,16 @@ void DefineBuffers()
|
|||||||
PlotIndexSetInteger(fiboUpperBufferPlotIndex, PLOT_DRAW_TYPE, fiboZoneDrawType);
|
PlotIndexSetInteger(fiboUpperBufferPlotIndex, PLOT_DRAW_TYPE, fiboZoneDrawType);
|
||||||
PlotIndexSetDouble(fiboUpperBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
PlotIndexSetDouble(fiboUpperBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Middle ...
|
||||||
|
ArraySetAsSeries(fiboMiddleBuffer, true);
|
||||||
|
SetIndexBuffer(fiboMiddleBufferIndex, fiboMiddleBuffer, INDICATOR_DATA);
|
||||||
|
|
||||||
|
//
|
||||||
|
PlotIndexSetInteger(fiboMiddleBufferPlotIndex, PLOT_SHOW_DATA, showFiboZone);
|
||||||
|
PlotIndexSetInteger(fiboMiddleBufferPlotIndex, PLOT_DRAW_TYPE, fiboZoneDrawType);
|
||||||
|
PlotIndexSetDouble(fiboMiddleBufferPlotIndex, PLOT_EMPTY_VALUE, emptyValue);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Lower ...
|
// Lower ...
|
||||||
ArraySetAsSeries(fiboLowerBuffer, true);
|
ArraySetAsSeries(fiboLowerBuffer, true);
|
||||||
@@ -1294,18 +1320,29 @@ void CalculateValues(
|
|||||||
double iFiboUp = GetFibonacciLevel(
|
double iFiboUp = GetFibonacciLevel(
|
||||||
iPeak,
|
iPeak,
|
||||||
iVale,
|
iVale,
|
||||||
upperZoneLevel,
|
fiboUpperZoneLevel,
|
||||||
X_DIRECTION_BULLISH);
|
X_DIRECTION_BULLISH //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double iFiboMid = GetFibonacciLevel(
|
||||||
|
iPeak,
|
||||||
|
iVale,
|
||||||
|
fiboMiddleZoneLevel,
|
||||||
|
X_DIRECTION_BULLISH //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
double iFiboLo = GetFibonacciLevel(
|
double iFiboLo = GetFibonacciLevel(
|
||||||
iPeak,
|
iPeak,
|
||||||
iVale,
|
iVale,
|
||||||
lowerZoneLevel,
|
fiboLowerZoneLevel,
|
||||||
X_DIRECTION_BULLISH);
|
X_DIRECTION_BULLISH //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
fiboUpperBuffer[barIndex] = iFiboUp;
|
fiboUpperBuffer[barIndex] = iFiboUp;
|
||||||
|
fiboMiddleBuffer[barIndex] = iFiboMid;
|
||||||
fiboLowerBuffer[barIndex] = iFiboLo;
|
fiboLowerBuffer[barIndex] = iFiboLo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#property link "https://saherelm.ir"
|
#property link "https://saherelm.ir"
|
||||||
#property version "1.00"
|
#property version "1.00"
|
||||||
#property description "SaherElm XOM1 Indicator"
|
#property description "SaherElm XOM1 Indicator"
|
||||||
|
#property icon "../Images/SaherElm_Logo_Color.ico"
|
||||||
#property strict
|
#property strict
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SaherElm IT Center MQL5 Class
|
||||||
|
// -------------------------------------------------
|
||||||
|
// Name: XCXFIMASignaller ...
|
||||||
|
// Description: XFIMA Signaller Class ...
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Maintainer:
|
||||||
|
// ------------
|
||||||
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||||
|
//
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Global Properties ...
|
||||||
|
#property library
|
||||||
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||||
|
#property link "https://saherelm.ir"
|
||||||
|
#property version "1.00"
|
||||||
|
#property description "SaherElm Base Signaller Class"
|
||||||
|
#property strict
|
||||||
|
|
||||||
|
//
|
||||||
|
// Imports ...
|
||||||
Reference in New Issue
Block a user