/////////////////////////////////////////////////////// // // 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 slIndicatorName = "x-saherelm.sl"; const string tpIndicatorName = "x-saherelm.tp"; const string maIndicatorName = "x-saherelm.ma"; const string xmaIndicatorName = "x-saherelm.xma"; const string oscIndicatorName = "x-saherelm.osc"; const string sslIndicatorName = "x-saherelm.ssl"; const string pcrtIndicatorName = "x-saherelm.pcrt"; const string volumeIndicatorName = "x-saherelm.volume"; 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, }; // // Define an Specific Arrow Code enum ... enum X_ARROW_CODE { // X_ARROW_UP = OBJ_ARROW_UP, X_ARROW_DOWN = OBJ_ARROW_DOWN, // X_ARROW_THUMB_UP = OBJ_ARROW_THUMB_UP, X_ARROW_THUMB_DOWN = OBJ_ARROW_THUMB_DOWN, // X_ARROW_BUY = OBJ_ARROW_BUY, X_ARROW_SELL = OBJ_ARROW_SELL, // X_ARROW_STOP = OBJ_ARROW_STOP, X_ARROW_CHECK = OBJ_ARROW_CHECK, // X_ARROW_LEFT_PRICE = OBJ_ARROW_LEFT_PRICE, X_ARROW_RIGHT_PRICE = OBJ_ARROW_RIGHT_PRICE, }; // // Pricae Action Theory Candle Types ... enum X_P_CANDLE_TYPE { X_P_CT_BULLISH = 1, X_P_CT_NEUTRAL = 2, X_P_CT_BEARISH = 3, }; // // Candlestick Theory Candle Types ... enum X_CANDLE_TYPE { X_CT_DOJI = 1, X_CT_EVENING_STAR = 2, X_CT_MORNING_STAR = 3, X_CT_SHOOTING_STAR = 4, X_CT_HAMMER = 5, X_CT_INVERTED_HAMMER = 6, X_CT_BEARISH_HARAMI = 7, X_CT_BULLISH_HARAMI = 8, X_CT_BEARISH_ENGULFING = 9, X_CT_BULLISH_ENGULFING = 10, X_CT_PRICE_LINE = 11, X_CT_BULLISH_BELT = 12, X_CT_BULLISH_KICKER = 13, X_CT_BEARISH_KICKER = 14, X_CT_HANGING_MAN = 15, X_CT_DARK_CLOUD_COVER = 16 }; // // 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; }; // // we Model MACD State ... struct XMACDState { double MACD; double signal; }; // // model ssl State ... struct XSSLState { // double sslUp; double sslUpPrev; // double sslDown; double sslDownPrev; }; // // Model Volume Indicator Result ... struct XVolumeState { double buyVolume; double sellVolume; }; // // Signal Info Model ... struct XSignalInfo { // bool hasSignal; // bool hasLongSignal; bool hasShortSignal; }; // // Model SLs as this ... struct XSLInfo { double longSL; double shortSL; }; // // Model TPs as this ... struct XTPInfo { double longTP; double shortTP; }; // // ZigZag State ... struct XZigZagState { // double zigZag; datetime zigZagTime; // double zigZagPrev; datetime zigZagPrevTime; // double low; int lowBarIndex; datetime lowTime; // double high; int highBarIndex; datetime highTime; // double delta; // bool isWaitForTrendUp; bool isWaitForTrendDown; // bool isLowIsLastLow; bool isHighIsLastHigh; }; // // 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; }; // // State of Market based on XMA ... struct XMAState { // double xmaFast; double xmaFastPrev; // double xmaSlow; double xmaSlowPrev; // bool isBullishTrend; bool isBearishTrend; // double trendPower; // double xmaHigh; double xmaHighPrev; // double xmaLow; double xmaLowPrev; // bool isFlowUp; bool isFlowDown; // double xmaMark; // double xmaMid; double xmaMidPrev; }; // // Define an enum for Detection Rules on Candlestick Indicator ... enum X_CD_DETECTION_RULES { X_PRICE_50_SMA, X_PRICE_50_200_SMA }; // // End Models ... //