139 lines
2.3 KiB
Plaintext
139 lines
2.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";
|
|
|
|
//
|
|
// 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;
|
|
};
|
|
|
|
//
|
|
// 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;
|
|
bool isSCTrendDown;
|
|
bool isSCFastCrossOverSlow;
|
|
bool isSCFastCrossUnderSlow;
|
|
|
|
//
|
|
// Medium Cycle ...
|
|
//
|
|
// FAST ...
|
|
double mcFast;
|
|
double mcFastPrev;
|
|
|
|
//
|
|
// SLOW ...
|
|
double mcSlow;
|
|
double mcSlowPrev;
|
|
|
|
//
|
|
bool isMCTrendUp;
|
|
bool isMCTrendDown;
|
|
bool isMCFastCrossOverSlow;
|
|
bool isMCFastCrossUnderSlow;
|
|
|
|
//
|
|
// Long Cycle ...
|
|
//
|
|
// FAST ...
|
|
double lcFast;
|
|
double lcFastPrev;
|
|
|
|
//
|
|
// SLOW ...
|
|
double lcSlow;
|
|
double lcSlowPrev;
|
|
|
|
//
|
|
bool isLCTrendUp;
|
|
bool isLCTrendDown;
|
|
bool isLCFastCrossOverSlow;
|
|
bool isLCFastCrossUnderSlow;
|
|
|
|
//
|
|
// MIDDLEAGE ...
|
|
double marketMiddleage;
|
|
double marketMiddleagePrev;
|
|
|
|
//
|
|
// Hot Cross Points ...
|
|
//
|
|
bool isHotCrossOver;
|
|
bool isHottestCrossOver;
|
|
|
|
//
|
|
bool isHotCrossUnder;
|
|
bool isHottestCrossUnder;
|
|
|
|
//
|
|
// Signal ...
|
|
bool hasSignal;
|
|
bool hasLongSignal;
|
|
bool hasShortSignal;
|
|
|
|
//
|
|
XSignal signal;
|
|
};
|
|
//
|
|
// End Models ...
|
|
//
|