218 lines
3.3 KiB
Plaintext
218 lines
3.3 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center MQL4 Models Global Library
|
|
// ---------------------------------------------
|
|
// saherelm useful tools and definitions ...
|
|
//
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
//////////////////////////////////////////////////////
|
|
#property library
|
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
|
#property link "https://www.saherelm.ir"
|
|
#property version "1.00"
|
|
#property strict
|
|
|
|
//
|
|
// Start Models ...
|
|
//
|
|
|
|
//
|
|
// Used Indicators List ...
|
|
const string xmaIndicatorName = "x-saherelm.xma";
|
|
const string adxIndicatorName = "x-saherelm.adx";
|
|
const string oscIndicatorName = "x-saherelm.osc";
|
|
const string zigZagIndicatorName = "x-saherelm.zigzag";
|
|
|
|
//
|
|
// Direction ...
|
|
enum X_DIRECTION {
|
|
X_UP,
|
|
X_DOWN
|
|
};
|
|
|
|
//
|
|
// these are different signal types ...
|
|
enum X_SIGNAL_TYPE {
|
|
X_NONE,
|
|
X_LONG,
|
|
X_SHORT,
|
|
};
|
|
|
|
//
|
|
// we Model each signals as this type ...
|
|
struct XSignal {
|
|
int id;
|
|
X_SIGNAL_TYPE type;
|
|
double tp;
|
|
double sl;
|
|
string symbol;
|
|
datetime time;
|
|
double entryPrice;
|
|
};
|
|
|
|
//
|
|
// this is Signal Request Response model ...
|
|
struct XSignalRequest {
|
|
bool hasSignal;
|
|
X_SIGNAL_TYPE type;
|
|
XSignal signal;
|
|
};
|
|
|
|
//
|
|
// we model OSC Return Data ...
|
|
struct XOSCState {
|
|
//
|
|
double fastOSC;
|
|
double fastOSCPrev;
|
|
|
|
//
|
|
double slowOSC;
|
|
double slowOSCPrev;
|
|
|
|
//
|
|
double powerOSC;
|
|
double powerOSCPrev;
|
|
|
|
//
|
|
double varOSC;
|
|
double varOSCPrev;
|
|
|
|
//
|
|
double tanFSOSC;
|
|
|
|
//
|
|
bool isOSCCrossOver;
|
|
bool isOSCCrossUnder;
|
|
};
|
|
|
|
//
|
|
// Define a Model to Represent Snapshot of XMA Indicator ...
|
|
struct XMAState {
|
|
//
|
|
// Short Cycle ...
|
|
//
|
|
// FAST ...
|
|
double scFast;
|
|
double scFastPrev;
|
|
|
|
//
|
|
// SLOW ...
|
|
double scSlow;
|
|
double scSlowPrev;
|
|
|
|
//
|
|
bool isSCTrendUp;
|
|
|
|
//
|
|
// Medium Cycle ...
|
|
//
|
|
// FAST ...
|
|
double mcFast;
|
|
double mcFastPrev;
|
|
|
|
//
|
|
// SLOW ...
|
|
double mcSlow;
|
|
double mcSlowPrev;
|
|
|
|
//
|
|
// Long Cycle ...
|
|
//
|
|
// FAST ...
|
|
double lcFast;
|
|
double lcFastPrev;
|
|
|
|
//
|
|
// SLOW ...
|
|
double lcSlow;
|
|
double lcSlowPrev;
|
|
|
|
//
|
|
// MIDDLEAGE ...
|
|
double marketMiddleage;
|
|
double marketMiddleagePrev;
|
|
};
|
|
|
|
//
|
|
struct XMAOverView {
|
|
//
|
|
bool isSCTrendUp;
|
|
bool isSCTrendDown;
|
|
|
|
//
|
|
bool isMCTrendUp;
|
|
bool isMCTrendDown;
|
|
|
|
//
|
|
bool isLCTrendUp;
|
|
bool isLCTrendDown;
|
|
};
|
|
|
|
//
|
|
// Represent ADX State ...
|
|
struct XADXState {
|
|
//
|
|
double trendPower;
|
|
double trendPowerPrev;
|
|
|
|
//
|
|
double upDirection;
|
|
double upDirectionPrev;
|
|
|
|
//
|
|
double downDirection;
|
|
double downDirectionPrev;
|
|
|
|
//
|
|
bool isUpTrend;
|
|
bool isDownTrend;
|
|
};
|
|
|
|
//
|
|
// ZigZag State ...
|
|
struct XZigZagState {
|
|
//
|
|
double zigZag;
|
|
datetime zigZagTime;
|
|
|
|
//
|
|
double zigZagPrev;
|
|
datetime zigZagPrevTime;
|
|
|
|
//
|
|
double zigZagPrevPrev;
|
|
datetime zigZagPrevPrevTime;
|
|
|
|
//
|
|
double low;
|
|
int lowBarIndex;
|
|
datetime lowTime;
|
|
|
|
//
|
|
double high;
|
|
int highBarIndex;
|
|
datetime highTime;
|
|
|
|
//
|
|
double delta;
|
|
|
|
//
|
|
bool isWaitForTrendUp;
|
|
bool isWaitForTrendDown;
|
|
};
|
|
|
|
//
|
|
// Parse Use full Info about ZigZag State ...
|
|
struct XZigZagOverView {
|
|
//
|
|
bool isTrendUp;
|
|
bool isTrendDown;
|
|
};
|
|
//
|
|
// End Models ...
|
|
//
|