event handling function not found CheckEntryBollingerBands.mq5 New comment Sphelele Sphesihle Lubanyana 2021.08.31 23:25 string CheckEntry() { // create an array for prices MqlRates PriceInfo[]; // sort the price Array from the current candle downwards ArraySetAsSeries(PriceInfo, true); // we fill the array with the pricedata //int Data = CopyRates(Symbol(), Period(), 0, Bars (Symbol(), Period()), PriceInfo); int Data = CopyRates(Symbol(), Period(), 0, 3, PriceInfo); // create a string variable for signal string Signal = ""; // create an Array for several prices double middleBandArray[]; double upperBandArray[]; double lowerBandArray[]; //Sort the price array from the current candle downwards; ArraySetAsSeries(middleBandArray, true); ArraySetAsSeries(upperBandArray, true); ArraySetAsSeries(lowerBandArray, true); //define Bollinger Bands double bollingerBandsDefination= iBands(_Symbol,_Period, 34, 0, 2.100, PRICE_CLOSE); //Price infor int the errays CopyBuffer(bollingerBandsDefination,0, 0, 3, middleBandArray); CopyBuffer(bollingerBandsDefination,1, 0, 3, upperBandArray); CopyBuffer(bollingerBandsDefination,2, 0, 3, lowerBandArray); //calc ea fore the last candle double myMiddleValue0 = middleBandArray[0]; double myUpperValue0 = upperBandArray[0]; double myLowerValue0 = lowerBandArray[0]; //calc ea fore the current candle double myMiddleValue1 = middleBandArray[1]; double myUpperValue1 = upperBandArray[1]; double myLowerValue1 = lowerBandArray[1]; // buy signal if ((PriceInfo[1].close < myLowerValue1) && (PriceInfo[0].close > myLowerValue0)) Signal = "Buy"; // Sell signal if ((PriceInfo[1].close > myUpperValue1) && (PriceInfo[0].close < myUpperValue0)) Signal = "Sell"; return Signal; } New comment