`mql5 //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ input int EMAFastPeriod = 9; input int EMASlowPeriod = 15; double EMAFastCurrent, EMAFastPrevious; double EMASlowCurrent, EMASlowPrevious; double VWAP_Value; //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { int handleEMAFast = iMA(NULL, 0, EMAFastPeriod, 0, MODEEMA, PRICECLOSE); int handleEMASlow = iMA(NULL, 0, EMASlowPeriod, 0, MODEEMA, PRICECLOSE); EMAFastCurrent = iMAOnArray(handleEMAFast, 0, 0); EMASlowCurrent = iMAOnArray(handleEMASlow, 0, 0); EMAFastPrevious = iMAOnArray(handleEMAFast, 0, 1); EMASlowPrevious = iMAOnArray(handleEMASlow, 0, 1); // Calculate VWAP double cumulativePriceVolume = 0; double cumulativeVolume = 0; for (int i = 0; i < 14; i++) // Assuming 14 bars for VWAP period { double typicalPrice = (High[i] + Low[i] + Close[i]) / 3.0; cumulativePriceVolume += typicalPrice * Volume[i]; cumulativeVolume += Volume[i]; } VWAP_Value = cumulativePriceVolume / cumulativeVolume; // Check crossover conditions if (EMAFastPrevious < EMASlowPrevious && EMAFastCurrent > EMASlowCurrent && VWAP_Value > Close[1]) { // Place Buy order } if (EMAFastPrevious > EMASlowPrevious && EMAFastCurrent < EMASlowCurrent && VWAP_Value < Close[1]) { // Place Sell order } } //+------------------------------------------------------------------+