how to keep saving an indicator value in mql4

 
I want to keep saving a value for Zigzag indicator and save it as a buffer
 

Makes no sense

  1. “A value” is one value. “A buffer” is an array of values.
  2. Only indicators have buffers.
  3. Why would you save in a buffer? You would be showing the same as Zigzag.
 
William Roeder #:

Makes no sense

  1. “A value” is one value. “A buffer” is an array of values.
  2. Only indicators have buffers.
  3. Why would you save in a buffer? You would be showing the same as Zigzag.

I am still learning 

I want to save these values from zigzag and i don't want it to be changed unless some conditions are not being achieved 

 

I have already get them from this Code


double arr[6]={0.0,0.0,0.0,0.0,0.0,0.0};

      for (int i = 0;i<1000;i++)

      {

      

      double ZigZag = iCustom(_Symbol,PERIOD_CURRENT,"ZigZag",0,i);

        if(ZigZag != EMPTY_VALUE && ZigZag != 0)

        {

        if (arr[0] == 0.0)

        {

        arr[0]=ZigZag;

        }

         else if (arr[1] == 0.0)

          {

           arr[1] = ZigZag;

          }

           else if (arr[2] == 0.0)

           {

            arr[2] = ZigZag;

           }

            else if (arr[3] == 0.0)

            {

             arr[3] = ZigZag;

            }

             else if (arr[4] == 0.0)

             {

              arr[4] = ZigZag;

             }

              else if (arr[5] == 0.0)

               {

                arr[5] = ZigZag;

               break;

               }

      

         }

       }
 
KIOS #: I have already get them from this Code
Please edit your post (don't create a new post) and replace your code properly (with "</>" or Alt-S), or attach the original file directly with the "+ Attach file" button below the text box.

 
Fernando Carreiro #:
Please edit your post (don't create a new post) and replace your code properly (with "</>" or Alt-S), or attach the original file directly with the "+ Attach file" button below the text box.

Ok thank you
 
KIOS #:

I have already get them from this Code


You want to keep the 6 most recent pivot points available in an array at all times ? 

 
KIOS #:

Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

 
Your code
double arr[6]={0.0,0.0,0.0,0.0,0.0,0.0};
      for (int i = 0;i<1000;i++)
      {
      double ZigZag = iCustom(_Symbol,PERIOD_CURRENT,"ZigZag",0,i);
        if(ZigZag != EMPTY_VALUE && ZigZag != 0)
        {
        if (arr[0] == 0.0)
        {
        arr[0]=ZigZag;
        }
         else if (arr[1] == 0.0)
          {
           arr[1] = ZigZag;
          ⋮
Simplified
double arr[6]; int count=0;
      for (int i = 0;i<1000 && count < 6;++i){
          double ZigZag = iCustom(_Symbol,PERIOD_CURRENT,"ZigZag",0,i);
          if(ZigZag != EMPTY_VALUE && ZigZag != 0){
             arr[count++]=ZigZag;
      }
 
Keith Watford #:

Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

Thank You Keith

and thanks for the update

 
Lorentzos Roussos #:

You want to keep the 6 most recent pivot points available in an array at all times 

Please find the attached Screen shot I want to keep these values forever, however the chart is moving 

Reason: