I get the undeclared identifier error and dont know how to fix it

 

 I'm new at learning to code, so im trying to add the standard deviation bands, to a VWAP indicator code I found on the Internet but I get the "FirstDevDaily" undeclared identifier error and dont know how to fix it.

//--- Standard Deviations Calculations ---

     if (Enable_1stStdDev && Enable_Daily)

     {

          for (nIdx=0; nIdx<rates_total; nIdx++)

          {

          nSDDailyTPV += nTotalTPV[nIdx];

          nSDDailyVol += nTotalVol[nIdx];

          nDailyVWAP[nIdx]               =0;

          double FirstMeanDaily[nIdx]    =0;      // To Calculate the mean of the VWAP

          double FirstDevDaily[nIdx]     =0;      // The standard deviation is the square root of the previous numbers

          VWAP_Buffer_1stUpperBand[nIdx] =EMPTY_VALUE;

          VWAP_Buffer_1stLowerBand[nIdx] =EMPTY_VALUE;

          

               nDailyVWAP[nIdx]=(nSDDailyTPV[nIdx]/nSDDailyVol[nIdx]);

               FirstMeanDaily[nIdx]=nDailyVWAP[nIdx].Mean;

               FirstDevDaily+=pow(nDailyVWAP[nIdx]-FirstMeanDaily[nIdx],2);

               FirstDevDaily=sqrt(FirstDevDaily/nIdx);

           }

           

           if (nSumDailyVol)

           {

               VWAP_Buffer_1stUpperBand[nIdx]=(FirstMeanDaily+FirstDevDaily);

               VWAP_Buffer_1stLowerBand[nIdx]=(FirstMeanDaily-FirstDevDaily);

           }

     }

//----------------------------------------

any help to improve the code will be appreciated, thanks

Standard Deviation - Trend Indicators - Technical Indicators - Price Charts, Technical and Fundamental Analysis - MetaTrader 5 Help
  • www.metatrader5.com
Standard Deviation — value of the market volatility measurement. This indicator describes the range of price fluctuations relative to Moving...
 
Krimelio:

Hi Krimelio,

to share code use the 'Code' button. I have corrected this for this time.

 

Every variable has to be declared before you can use it. See:

https://www.mql5.com/en/articles/100
https://www.mql5.com/en/articles/496

Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners
Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners
  • www.mql5.com
The Expert Advisors programming in MQL5 is simple, and you can learn it easy. In this step by step guide, you will see the basic steps required in writing a simple Expert Advisor based on a developed trading strategy. The structure of an Expert Advisor, the use of built-in technical indicators and trading functions, the details of the Debug mode and use of the Strategy Tester are presented.
 
thanks
Reason: