//+------------------------------------------------------------------+ //| Multi_Pair_Pivot_Point_Scanner_Alerts_v3.1.mq4 | //| Copyright 2019, NickBixy | //| https://www.forexfactory.com/showthread.php?t=904734 | //+------------------------------------------------------------------+ #property copyright "NickBixy" #property link "https://www.forexfactory.com/showthread.php?t=904734" //#property version "3.1" #property strict #property description "Indicator Scans Multiple Symbol Pairs Looking For When The Price Crosses A Pivot Point or xx points near or bounced off pivot Then It Alerts The Trader." #property indicator_chart_window #define HR2400 (PERIOD_D1 * 60) enum pivotTypes { Standard,//Standard(Floor) Pivot Formula Fibonacci,//Fibonacci Pivot Formula Camarilla,//Camarilla Pivot Formula Woodie//Woodie Pivot Formula }; enum pipPointChoice { Pips,//Pips Points,//Points }; enum yesnoChoiceToggle { No, Yes }; enum timeChoice { Server, Local }; enum symbolTypeChoice { MarketWatch,//Market Watch SymbolList//Symbols In List }; enum alertMode { Cross_Alerts,//Crossed Pivot Alerts Near_Alerts,//Near Pivot Alerts Cross_And_Bounce_Alerts,//Crossed And Bounced Alerts Near_And_Bounce_Alerts,//Near And Bounced Alerts Bounce_Only_Alerts//Bounced Only Alerts }; enum enabledisableChoiceToggle { Disable, Enable }; input int UniqueID=1;//Unique ID input string info="Put Scanner On A Separate Chart Tab From Trading Strategy";//Put Scanner On A Separate Chart Tab From Trading Stategy input string indiLink="https://www.forexfactory.com/showthread.php?t=904734";//Indicator's thread on Forex Factory input int refreshTime=5;//Refresh check every x Seconds input string pivotPointHeader="-----------------Pivot Point Settings------------------------------------------";//----- Pivot Point Settings input pivotTypes pivotSelection=Standard;//Pivot Point Formula input ENUM_TIMEFRAMES pivotTimeframe=PERIOD_D1;//Pivot Point Timeframe input alertMode alertModeSelection= Cross_Alerts;//Alert Mode to use input int xxPoints=50;//Points Near Pivot - For Alert Mode Near string pointsNearMessage="is Near";//PointsNear Alert Msg string crossedMessage="Crossed";//Cross Alert Msg input string symbolHeader="-----------------Symbol Settings------------------------------------------";//----- Symbol Settings input symbolTypeChoice symTypeChoice=MarketWatch;//Symbols To Scan- Market Watch/Symbol List Below input string symbols="AUDCAD,AUDCHF,AUDJPY,AUDNZD,AUDUSD,CADCHF,CADJPY,CHFJPY,EURAUD,EURCAD,EURCHF,EURGBP,EURJPY,EURNZD,EURUSD,GBPAUD,GBPCAD,GBPCHF,GBPJPY,GBPNZD,GBPUSD,NZDCAD,NZDCHF,NZDJPY,NZDUSD,USDCAD,USDCHF,USDJPY"; //Symbols To Scan input string symbolPrefix=""; //Symbol Prefix input string symbolSuffix=""; //Symbol Suffix input string printoutAndAlertHeader="-----------------Alert/Printout Settings--------------------------------------";//----- Alert/Printout Settings input int alertInternalMinutes=30;//Alert Wait Time In Min for same Pivot alert Msg input yesnoChoiceToggle popupAlerts=Yes;//Use Popup Alerts? input yesnoChoiceToggle notificationAlerts=Yes;//Use Notification Alerts? input yesnoChoiceToggle emailAlerts=No;//Use Email Alerts? input yesnoChoiceToggle showBidPriceOnAlert=No;//Show Bid Price in Alert Msg input yesnoChoiceToggle printOutPivotPoints=No;//Print Out Pivot Values - For Testing Values input int printOutPivotPointsSymbolIndex=0;//Index Value Of Symbol To Print Out input string bouncedHeader="-----------------Bounced Mode Alerts Settings------------------------------------------";//----- Bounce Settings input ENUM_TIMEFRAMES bouncedCandleTF=PERIOD_M15;//Time Frame Candles For Bounced Alerts input yesnoChoiceToggle candleColorFilter=Yes;//Use Candle Color Filter input int bounceXBarsWait=0;//Alert Wait Time In Bars for same Pivot alert Msg input string offResistanceBounceMSG=" - Price Crossed Then Closed Below";//Msg For Bounce Off Resistance input string offSupportBounceMSG=" - Price Crossed Then Closed Above";//Msg For Bounce Off Support input string bbFilterHeader="-----------------Bollinger Bands Filter Settings------------------------------------------";//----- Bollinger Bands Filter input string note="Near/Cross/Bounce Alerts only when price is above upper band or when price is below lower band";//Filter note input yesnoChoiceToggle useBollingerBands=No;//Use BollingerBands upper/lower Filter input ENUM_TIMEFRAMES BBtimeFrame=PERIOD_M30;//Bollinger Bands: Timeframe input int BBperiod=20;//Bollinger Bands: Period input double BBdeviation=2;//Bollinger Bands: Deviations input int BBShift=0;//Bollinger Bands: Shift input ENUM_APPLIED_PRICE BBAppliedPrice=PRICE_CLOSE;//Bollinger Bands: Apply to input string showAlertsHeader="-----------------Enable/Disable Alerts For Specified Pivot Point----------------------------------------------";//----- Will Affect All the Alert Modes input string showAlertsStandardPivotHeader="Standard Pivot Point--------------------------------------------";//----- Standard Pivot Point Settings input enabledisableChoiceToggle MidPointAlerts=Disable;//Mid Pivot Point Alerts input enabledisableChoiceToggle showStandardPivotR4=Enable;//Standard Pivot R4 input enabledisableChoiceToggle showStandardPivotR3=Enable;//Standard Pivot R3 input enabledisableChoiceToggle showStandardPivotR2=Enable;//Standard Pivot R2 input enabledisableChoiceToggle showStandardPivotR1=Enable;//Standard Pivot R1 input enabledisableChoiceToggle showStandardPivotPP=Enable;//Standard Pivot PP input enabledisableChoiceToggle showStandardPivotS1=Enable;//Standard Pivot S1 input enabledisableChoiceToggle showStandardPivotS2=Enable;//Standard Pivot S2 input enabledisableChoiceToggle showStandardPivotS3=Enable;//Standard Pivot S3 input enabledisableChoiceToggle showStandardPivotS4=Enable;//Standard Pivot S4 input string StandardMidPivotHeader="-----------------Standard Mid Pivot Points";//----- Standard Mid PP input enabledisableChoiceToggle showStandardPivotMR4=Enable;//Standard Pivot mR4 input enabledisableChoiceToggle showStandardPivotMR3=Enable;//Standard Pivot mR3 input enabledisableChoiceToggle showStandardPivotMR2=Enable;//Standard Pivot mR2 input enabledisableChoiceToggle showStandardPivotMR1=Enable;//Standard Pivot mR1 input enabledisableChoiceToggle showStandardPivotMS1=Enable;//Standard Pivot mS1 input enabledisableChoiceToggle showStandardPivotMS2=Enable;//Standard Pivot mS2 input enabledisableChoiceToggle showStandardPivotMS3=Enable;//Standard Pivot mS3 input enabledisableChoiceToggle showStandardPivotMS4=Enable;//Standard Pivot mS4 input string showAlertsFibonacciPivotHeader="Fibonacci Pivot Point--------------------------------------------";//----- Fibonacci Pivot Point Settings input enabledisableChoiceToggle showFibonacciPivotR200=Enable;//Fibonacci Pivot R200 input enabledisableChoiceToggle showFibonacciPivotR161=Enable;//Fibonacci Pivot R161 input enabledisableChoiceToggle showFibonacciPivotR138=Enable;//Fibonacci Pivot R138 input enabledisableChoiceToggle showFibonacciPivotR100=Enable;//Fibonacci Pivot R100 input enabledisableChoiceToggle showFibonacciPivotR78=Enable;//Fibonacci Pivot R78 input enabledisableChoiceToggle showFibonacciPivotR61=Enable;//Fibonacci Pivot R61 input enabledisableChoiceToggle showFibonacciPivotR38=Enable;//Fibonacci Pivot R38 input enabledisableChoiceToggle showFibonacciPivotPP=Enable;//Fibonacci Pivot PP input enabledisableChoiceToggle showFibonacciPivotS38=Enable;//Fibonacci Pivot S38 input enabledisableChoiceToggle showFibonacciPivotS61=Enable;//Fibonacci Pivot S61 input enabledisableChoiceToggle showFibonacciPivotS78=Enable;//Fibonacci Pivot S78 input enabledisableChoiceToggle showFibonacciPivotS100=Enable;//Fibonacci Pivot S100 input enabledisableChoiceToggle showFibonacciPivotS138=Enable;//Fibonacci Pivot S138 input enabledisableChoiceToggle showFibonacciPivotS161=Enable;//Fibonacci Pivot S161 input enabledisableChoiceToggle showFibonacciPivotS200=Enable;//Fibonacci Pivot S200 input string showAlertsWoodiePivotHeader="Woodie Pivot Point--------------------------------------------";//----- Woodie Pivot Point Settings input enabledisableChoiceToggle showWoodieR1=Enable;//Woodie Pivot R1 input enabledisableChoiceToggle showWoodieR2=Enable;//Woodie Pivot R2 input enabledisableChoiceToggle showWoodiePP=Enable;//Woodie Pivot PP input enabledisableChoiceToggle showWoodieS1=Enable;//Woodie Pivot S1 input enabledisableChoiceToggle showWoodieS2=Enable;//Woodie Pivot S2 input string showAlertsCamarillaPivotHeader="Camarilla Pivot Point--------------------------------------------";//----- Camarilla Pivot Point Settings input enabledisableChoiceToggle showCamarillaR1=Enable;//Camarilla Pivot R1 input enabledisableChoiceToggle showCamarillaR2=Enable;//Camarilla Pivot R2 input enabledisableChoiceToggle showCamarillaR3=Enable;//Camarilla Pivot R3 input enabledisableChoiceToggle showCamarillaR4=Enable;//Camarilla Pivot R4 input enabledisableChoiceToggle showCamarillaR5=Enable;//Camarilla Pivot R5 input enabledisableChoiceToggle showCamarillaPP=Enable;//Camarilla Pivot PP input enabledisableChoiceToggle showCamarillaS1=Enable;//Camarilla Pivot S1 input enabledisableChoiceToggle showCamarillaS2=Enable;//Camarilla Pivot S2 input enabledisableChoiceToggle showCamarillaS3=Enable;//Camarilla Pivot S3 input enabledisableChoiceToggle showCamarillaS4=Enable;//Camarilla Pivot S4 input enabledisableChoiceToggle showCamarillaS5=Enable;//Camarilla Pivot S5 int numSymbols=0; //the number of symbols to scan int alertIntervalTimeSeconds; //wait time between same alert message for pivot point string symbolList[]; // array of symbols string symbolListFinal[]; // array of symbols after merging post and prefix datetime symbolTimeframeTimeP[]; //array of symbol dates today used for checking for new day for each symbol double Pivots[][20]; //stores all the pivot points for each timeframe double PivotsCheck[][20]; //stores all the pivot points for each timeframe //stores all the bool flags to help detect price cross pivot point for each timeframe bool PivotsFlag[][20]; //stores the time to wait for alert time interval for each pivot points timeframe datetime PivotsWaitTill[][20]; //stores all the bool flags to help detect price cross pivot point for each timeframe bool PivotsZoneFlag[][20]; //num of pivots for each formula int numPPStandard=17; int numPPCamarilla=11; int numPPWoodie=5; int numPPFibonacci=15; //bool for the enable/disables specified pivot alerts and thier pivot names in correct index order bool showStandard[17]; string standardPivotNames[]= { "PP", "S1", "S2", "S3", "R1", "R2", "R3", "R4", "S4", "mR4", "mR3", "mR2", "mR1", "mS1", "mS2", "mS3", "mS4", }; bool showCamarilla[11]; string camarillaPivotNames[]= { "PP", "S1", "S2", "S3", "S4", "R1", "R2", "R3", "R4", "R5", "S5", }; bool showWoodie[5]; string woodiePivotNames[]= { "PP", "S1", "S2", "R1", "R2" }; bool showFibonacci[15]; string fibonacciPivotNames[]= { "PP", "R38", "R61", "R78", "R100", "R138", "R161", "R200", "S38", "S61", "S78", "S100", "S138", "S161", "S200", }; string pivotTimeframeName; ///////////////////////////////////////////////////////////////////////////////////////////// //variables for bounced check alerts datetime symbolNewCandleCheck[][1];//keep track of current candle time so will know if new candle starts datetime bouncedWaitTill[][20]; int symbolPPIndex[][1];//keep track of the pivot point index that was crossed for all symbols in list, they start all set to -1 //keep track of the symbol pivot cross state, they start all set to 0 when bull candle cross pp from below set to 1 for opposite set 2 //hold that state untill a oppposite candle closses above or below then reset ot reset when new pivot cross update state int PivotState[][1] ; string indiName="MPPPSA"+"-"+"UniqueID-"+(string)UniqueID; input string dashBoardHeader="-----------------Dashboard Settings--------------------------------------";//----- Dashboard Settings input yesnoChoiceToggle useDashboard=Yes;//Use DashBoard? input int widthX=28;//X Dashboard +Moves right, -Moves left input int widthY=28;//Y Dashboard +Moves down, -Moves up input int symbolXnear=85;//X Between Columns Symbol-Near input int nearXpt=35;//X Between Columns Near-PT input int ptXPP=40;//X Between Columns PT-PP input int ppXtime=25;//X Between Columns PP-Time input string FontHeader="Arial Bold";//Font of the headers input string Font="Arial";//font of the labels input int fontText=9;//Font Size Labels input int textH=14;//Y Spacing Between Rows input color headerColors=clrViolet;//Color of Header input color symbolColor=clrWhite;//Color of Symbol Rows int textHEnd=0; input timeChoice timeChoiceOption=Local;//Local/Server Time For Time Last Alert input color resistantColor=clrRed;//Resistant PP Color input color supportColor=clrLime;//Support PP Color input color pivotColor=clrYellow;//Pivot Color input int listLabelSize=40;//Num Of Alert Msg In List Below input bool usePivotColor=True;//Label Color use res/sup/piv colors for alerts input color listLabelColor=clrAquamarine;//List Label Color input color timeLastAlertColor=clrAquamarine;//Time Last Alert Label Color input string templateName="Default";//Open Chart Template input ENUM_TIMEFRAMES openChartTimeFrame=PERIOD_H1;//Open Chart TimeFrame input yesnoChoiceToggle roundNearest=Yes;//Rounded Off To The Nearest Integer? input pipPointChoice pipPointSelection=Points;//Pips/Points? input int decimalPlaces=0;//Number Of Digits After Decimal Point (0-8). string listLabelNames[]; //initial start int OnInit() { SetChartProperties(); if(EventSetTimer(refreshTime)==false) { Alert("ERROR CODE: "+(string)GetLastError());//check error code for timer } IndicatorSetString(INDICATOR_SHORTNAME,indiName);//name of indicator used for when symbol not found error will remove indicator from chart alertIntervalTimeSeconds=alertInternalMinutes*60;//waiting time between alerts updateSpecifiedPivotPointAlerts();//set the bool for the show pivot alerts if(symTypeChoice==MarketWatch) { int numSymbolsMarketWatch=SymbolsTotal(true); numSymbols=numSymbolsMarketWatch; ArrayResize(symbolListFinal,numSymbolsMarketWatch); for(int i=0; ipivot set to true else false, used to dectect price cross pivot point double bid=MarketInfo(symbol,MODE_BID); //if using bounced alert get the current time of that symbol m15 TF candle so when new candle open we will know its a new candle if(alertModeSelection==Cross_And_Bounce_Alerts || alertModeSelection==Near_And_Bounce_Alerts || alertModeSelection==Bounce_Only_Alerts) { symbolNewCandleCheck[symbolIndex][0]=iTime(symbol,bouncedCandleTF,0); } double points=MarketInfo(symbol,MODE_POINT); double pipPoints=xxPoints*points; switch(pivotSelection)//initalize seleted pivot point forumula { case Standard : standardPivotPoint(pivotTimeframe,Pivots,symbolIndex,symbol);//Gets the values break; case Camarilla : camarillaPivotPoint(pivotTimeframe,Pivots,symbolIndex,symbol);//Gets the values break; case Woodie : woodiePivotPoint(pivotTimeframe,Pivots,symbolIndex,symbol);//Gets the values break; case Fibonacci : fibonacciPivotPoint(pivotTimeframe,Pivots,symbolIndex,symbol);//Gets the values break; } for(int l=0; l=Pivots[symbolIndex][i]) PivotsFlag[symbolIndex][i]=true; else PivotsFlag[symbolIndex][i]=false; } } else if(alertModeSelection==Near_Alerts || alertModeSelection==Near_And_Bounce_Alerts) { for(int i=0; i=pivotLow)//check if inzone == false { PivotsZoneFlag[symbolIndex][i]=true; } else { PivotsZoneFlag[symbolIndex][i]=false; } } } if(printOutPivotPoints==Yes && printOutPivotPointsSymbolIndex==symbolIndex)// if yes will call the print out method to show the pivot point values in alert pop up { printOutPivotPoint(printOutPivotPointsSymbolIndex); } } } //check for alert conditions void PivotCheck(int symbolIndex, int numOfPivotPoints,bool &showRef[],string &pivotNamesRef[])//method to look for the alert conditions using the pivot flags or bounced check method { if(symbolTimeframeTimeP[symbolIndex]!=NULL) { bool result;//bool for bid>pivot test with flag double bid; double points; double pipPoints; int digits; string ppTimeFrame; string symbolName; symbolName=symbolListFinal[symbolIndex]; bid=MarketInfo(symbolName,MODE_BID); points=MarketInfo(symbolName,MODE_POINT); digits=(int)MarketInfo(symbolName,MODE_DIGITS); pipPoints=xxPoints*points; ppTimeFrame=pivotTimeframeName; if(alertModeSelection!=Bounce_Only_Alerts) { for(int j=0; j=Pivots[symbolIndex][j]; if(result!=PivotsFlag[symbolIndex][j]) { PivotsFlag[symbolIndex][j]=result; if(useBollingerBands==Yes) { if(isUpperLowerBollinger(symbolIndex)==true && TimeCurrent()>=PivotsWaitTill[symbolIndex][j] && showRef[j]==true) { PivotsWaitTill[symbolIndex][j]=(TimeCurrent()+alertIntervalTimeSeconds); doAlert(symbolName,ppTimeFrame,pivotNamesRef[j]); } } else if(useBollingerBands==No) { if(TimeCurrent()>=PivotsWaitTill[symbolIndex][j] && showRef[j]==true) { PivotsWaitTill[symbolIndex][j]=(TimeCurrent()+alertIntervalTimeSeconds); doAlert(symbolName,ppTimeFrame,pivotNamesRef[j]); } } } } else if(alertModeSelection==Near_Alerts || alertModeSelection==Near_And_Bounce_Alerts) { double pivotHigh=Pivots[symbolIndex][j]+pipPoints; double pivotLow=Pivots[symbolIndex][j]-pipPoints; result=((bid<=pivotHigh) && (bid>=pivotLow));//get 1 or 0 if(result!=PivotsZoneFlag[symbolIndex][j]) { PivotsZoneFlag[symbolIndex][j]=result; if(useBollingerBands==Yes) { if(isUpperLowerBollinger(symbolIndex)==true && TimeCurrent()>=PivotsWaitTill[symbolIndex][j] && showRef[j]==true && PivotsZoneFlag[symbolIndex][j]==true) { PivotsWaitTill[symbolIndex][j]=(TimeCurrent()+alertIntervalTimeSeconds); doAlert(symbolName,ppTimeFrame,pivotNamesRef[j]); } } else if(useBollingerBands==No) { if(TimeCurrent()>=PivotsWaitTill[symbolIndex][j] && showRef[j]==true && PivotsZoneFlag[symbolIndex][j]==true) { PivotsWaitTill[symbolIndex][j]=(TimeCurrent()+alertIntervalTimeSeconds); doAlert(symbolName,ppTimeFrame,pivotNamesRef[j]); } } } } }//end of } //code for bounce check if(useBollingerBands==Yes && isUpperLowerBollinger(symbolIndex)==true) { BouncedCheck(symbolIndex,numOfPivotPoints,symbolPPIndex,Pivots,PivotState,ppTimeFrame,pivotNamesRef,showRef); } else if(useBollingerBands==No) { BouncedCheck(symbolIndex,numOfPivotPoints,symbolPPIndex,Pivots,PivotState,ppTimeFrame,pivotNamesRef,showRef); } } } //printout values void printOutPivotPoint(int index)//prints out the values of all the pivot points and names used for testing and seeing the values to compare { if(index>numSymbols-1 || index<0) { Alert("printOutPivotPointsSymbolIndex invalid index number"); } else { string printMessage=""; if(pivotSelection==Standard) { string pivotLevelName=pivotTimeframeName; int digits=(int)MarketInfo(symbolListFinal[index],MODE_DIGITS); for(int j=0; j=low)//if true means a pivot point was between the high and low so there was a cross { countFound++;//increments 1 evertime enter if statement PivotIndexCrossed[k]=1;//set to 1 mean was crossed correctPivotIndex=k;//set that pivot index so we know which pivot point that was } else if(open>ppArrayRef[i][k] && ppArrayRef[i][k]<=high && ppArrayRef[i][k]>=low)//if true means a pivot point was between the high and low so there was a cross and Beasrish open candle price greater than pivot { countFound++; PivotIndexCrossed[k]=1; correctPivotIndex=k; } } bool isBullishCandle=false; if(openclose)//bearish { isBearishCandle=true; } //if countFound more than 1 pivot it must of been a huge move so check if was bullish or bearish candle then get the best level bool firstNumberGrabed=false; double highest=0; double lowest=0; if(countFound>1) { if(isBullishCandle==true)//bullish candle and found multiple pivot crossing so look for highest priced pivot point and use that one { for(int n=0; nhighest) { highest=ppArrayRef[i][n]; correctPivotIndex=n;//index of the pivot to get name and price } } } } } else if(isBearishCandle==true) { for(int n=0; n 1 loop //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// bool foundR=false; bool foundP=false; bool foundS=false; if(countFound>=1) { if('R'==StringGetChar(PivotNamesRef[correctPivotIndex],0)) { foundR=true; } else if('P'==StringGetChar(PivotNamesRef[correctPivotIndex],0)) { foundP=true; } else if('S'==StringGetChar(PivotNamesRef[correctPivotIndex],0)) { foundS=true; } else if('m'==StringGetChar(PivotNamesRef[correctPivotIndex],0)) { if('R'==StringGetChar(PivotNamesRef[correctPivotIndex],1)) { foundR=true; } else { foundS=true; } } } //if pivot state is not zero but priced crossed new pivot reset to 0 if(pivotStateRef[i][0]!=0 && countFound>=1 && pivotStateRef[i][0]!=correctPivotIndex) { pivotStateRef[i][0]=0; correctPivotIndexRef[i][0]=-1; } //ALERT TYPE 1 if(pivotStateRef[i][0]==0 && countFound>=1) { if(foundR==true && close= bouncedWaitTill[i][correctPivotIndex])) { bouncedWaitTill[i][correctPivotIndex]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndex],'R'); } } else if(candleColorFilter==No) { if(showRef[correctPivotIndex] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndex])) { bouncedWaitTill[i][correctPivotIndex]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndex],'R'); } } } else if(foundS==true && close>ppArrayRef[i][correctPivotIndex]) { if(candleColorFilter==Yes && isBullishCandle==true && isBearishCandle==false)//bounced off of S has to close Bullish color Candle Above S { if(showRef[correctPivotIndex] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndex])) { bouncedWaitTill[i][correctPivotIndex]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndex],'S'); } } else if(candleColorFilter==No) { if(showRef[correctPivotIndex] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndex])) { bouncedWaitTill[i][correctPivotIndex]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndex],'S'); } } } else if(foundP==true && close>ppArrayRef[i][correctPivotIndex]) { if(candleColorFilter==Yes && isBullishCandle==true && isBearishCandle==false)//bounced off of S has to close Bullish color Candle Above S { if(showRef[correctPivotIndex] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndex])) { bouncedWaitTill[i][correctPivotIndex]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndex],'S'); } } else if(candleColorFilter==No) { if(showRef[correctPivotIndex] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndex])) { bouncedWaitTill[i][correctPivotIndex]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndex],'S'); } } } else if(foundP==true && close= bouncedWaitTill[i][correctPivotIndex])) { bouncedWaitTill[i][correctPivotIndex]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndex],'R'); } } else if(candleColorFilter==No) { if(showRef[correctPivotIndex] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndex])) { bouncedWaitTill[i][correctPivotIndex]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndex],'R'); } } } } //ALERT TYPE 2 if(pivotStateRef[i][0]==0 && countFound>=1) { if(foundR==true && close>ppArrayRef[i][correctPivotIndex]) { pivotStateRef[i][0]=1; correctPivotIndexRef[i][0]=correctPivotIndex; } else if(foundS==true && close= bouncedWaitTill[i][correctPivotIndexRef[i][0]])) { bouncedWaitTill[i][correctPivotIndexRef[i][0]]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndexRef[i][0]],'R'); } } else if(candleColorFilter==No) { pivotStateRef[i][0]=0; if(showRef[correctPivotIndexRef[i][0]] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndexRef[i][0]])) { bouncedWaitTill[i][correctPivotIndexRef[i][0]]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndexRef[i][0]],'R'); } } } else if(foundS==true && close>ppArrayRef[i][correctPivotIndexRef[i][0]]) { if(candleColorFilter==Yes && isBullishCandle==true && isBearishCandle==false)//bounced off of S has to close Bullish color Candle Above S { pivotStateRef[i][0]=0; if(showRef[correctPivotIndexRef[i][0]] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndexRef[i][0]])) { bouncedWaitTill[i][correctPivotIndexRef[i][0]]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndexRef[i][0]],'S'); } } else if(candleColorFilter==No) { pivotStateRef[i][0]=0; if(showRef[correctPivotIndexRef[i][0]] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndexRef[i][0]])) { bouncedWaitTill[i][correctPivotIndexRef[i][0]]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndexRef[i][0]],'S'); } } } else if(foundP==true && close>ppArrayRef[i][correctPivotIndexRef[i][0]]) { if(candleColorFilter==Yes && isBullishCandle==true && isBearishCandle==false)//bounced off of S has to close Bullish color Candle Above S { pivotStateRef[i][0]=0; if(showRef[correctPivotIndexRef[i][0]] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndexRef[i][0]])) { bouncedWaitTill[i][correctPivotIndexRef[i][0]]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndexRef[i][0]],'S'); } } else if(candleColorFilter==No) { pivotStateRef[i][0]=0; if(showRef[correctPivotIndexRef[i][0]] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndexRef[i][0]])) { bouncedWaitTill[i][correctPivotIndexRef[i][0]]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndexRef[i][0]],'S'); } } } else if(foundP==true && close= bouncedWaitTill[i][correctPivotIndexRef[i][0]])) { bouncedWaitTill[i][correctPivotIndexRef[i][0]]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndexRef[i][0]],'R'); } } else if(candleColorFilter==No) { pivotStateRef[i][0]=0; if(showRef[correctPivotIndexRef[i][0]] &&(iTime(symbolName,bouncedCandleTF,bounceXBarsWait) >= bouncedWaitTill[i][correctPivotIndexRef[i][0]])) { bouncedWaitTill[i][correctPivotIndexRef[i][0]]=iTime(symbolName,bouncedCandleTF,0); doAlertBounce(symbolName,ppTimeFrame,PivotNamesRef[correctPivotIndexRef[i][0]],'R'); } } } } } //end of bounce } } //used to stop certain pivot points from being alerted void updateSpecifiedPivotPointAlerts()//used to stop certain pivot points from being alerted { if(showStandardPivotPP==Disable)//standard showStandard[0]=false; else showStandard[0]=true; if(showStandardPivotS1==Disable) showStandard[1]=false; else showStandard[1]=true; if(showStandardPivotS2==Disable) showStandard[2]=false; else showStandard[2]=true; if(showStandardPivotS3==Disable) showStandard[3]=false; else showStandard[3]=true; if(showStandardPivotR1==Disable) showStandard[4]=false; else showStandard[4]=true; if(showStandardPivotR2==Disable) showStandard[5]=false; else showStandard[5]=true; if(showStandardPivotR3==Disable) showStandard[6]=false; else showStandard[6]=true; if(showStandardPivotR4==Disable) showStandard[7]=false; else showStandard[7]=true; if(showStandardPivotS4==Disable) showStandard[8]=false; else showStandard[8]=true; if(showCamarillaPP==Disable) //Camarilla showCamarilla[0]=false; else showCamarilla[0]=true; if(showCamarillaS1==Disable) showCamarilla[1]=false; else showCamarilla[1]=true; if(showCamarillaS2==Disable) showCamarilla[2]=false; else showCamarilla[2]=true; if(showCamarillaS3==Disable) showCamarilla[3]=false; else showCamarilla[3]=true; if(showCamarillaS4==Disable) showCamarilla[4]=false; else showCamarilla[4]=true; if(showCamarillaR1==Disable) showCamarilla[5]=false; else showCamarilla[5]=true; if(showCamarillaR2==Disable) showCamarilla[6]=false; else showCamarilla[6]=true; if(showCamarillaR3==Disable) showCamarilla[7]=false; else showCamarilla[7]=true; if(showCamarillaR4==Disable) showCamarilla[8]=false; else showCamarilla[8]=true; if(showCamarillaR5==Disable) showCamarilla[9]=false; else showCamarilla[9]=true; if(showCamarillaS5==Disable) showCamarilla[10]=false; else showCamarilla[10]=true; if(showWoodiePP==Disable)//Woodie showWoodie[0]=false; else showWoodie[0]=true; if(showWoodieS1==Disable) showWoodie[1]=false; else showWoodie[1]=true; if(showWoodieS2==Disable) showWoodie[2]=false; else showWoodie[2]=true; if(showWoodieR1==Disable) showWoodie[3]=false; else showWoodie[3]=true; if(showWoodieR2==Disable) showWoodie[4]=false; else showWoodie[4]=true; if(showFibonacciPivotPP==Disable)//Fibonacci showFibonacci[0]=false; else showFibonacci[0]=true; if(showFibonacciPivotR38==Disable) showFibonacci[1]=false; else showFibonacci[1]=true; if(showFibonacciPivotR61==Disable) showFibonacci[2]=false; else showFibonacci[2]=true; if(showFibonacciPivotR78==Disable) showFibonacci[3]=false; else showFibonacci[3]=true; if(showFibonacciPivotR100==Disable) showFibonacci[4]=false; else showFibonacci[4]=true; if(showFibonacciPivotR138==Disable) showFibonacci[5]=false; else showFibonacci[5]=true; if(showFibonacciPivotR161==Disable) showFibonacci[6]=false; else showFibonacci[6]=true; if(showFibonacciPivotR200==Disable) showFibonacci[7]=false; else showFibonacci[7]=true; if(showFibonacciPivotS38==Disable) showFibonacci[8]=false; else showFibonacci[8]=true; if(showFibonacciPivotS61==Disable) showFibonacci[9]=false; else showFibonacci[9]=true; if(showFibonacciPivotS78==Disable) showFibonacci[10]=false; else showFibonacci[10]=true; if(showFibonacciPivotS100==Disable) showFibonacci[11]=false; else showFibonacci[11]=true; if(showFibonacciPivotS138==Disable) showFibonacci[12]=false; else showFibonacci[12]=true; if(showFibonacciPivotS161==Disable) showFibonacci[13]=false; else showFibonacci[13]=true; if(showFibonacciPivotS200==Disable) showFibonacci[14]=false; else showFibonacci[14]=true; } //check if values are correct void checkValuesForValid(int symbolIndex,int numOfPivotPoints) { string symbol=symbolListFinal[symbolIndex]; switch(pivotSelection)//initalize seleted pivot point forumula { case Standard : standardPivotPoint(pivotTimeframe,PivotsCheck,symbolIndex,symbol);//Gets the values break; case Camarilla : camarillaPivotPoint(pivotTimeframe,PivotsCheck,symbolIndex,symbol);//Gets the values break; case Woodie : woodiePivotPoint(pivotTimeframe,PivotsCheck,symbolIndex,symbol);//Gets the values break; case Fibonacci : fibonacciPivotPoint(pivotTimeframe,PivotsCheck,symbolIndex,symbol);//Gets the values break; } for(int i=0; iupperBand || symbolBidPrice