Fix Arrow fix arrows permanently

 
Hello guys, I need to set all the arrows that come out in the graph permanently. With this code, if it goes off the internet connection, they disappear from the graph and do not want to happen. How can I fix the arrows permanently?

Thank you all


      //Indicator Buffer 1 Caso Sell
      if(iMA(NULL, PERIOD_CURRENT, MediaM_Periodo, 0, MODE_EMA, PRICE_CLOSE, 2+i) > iCustom(NULL, PERIOD_CURRENT, "FractalChannel", 1, 2+i)  //Moving Average > FractalChannel  + Candlestick Close
      && iMA(NULL, PERIOD_CURRENT, MediaM_Periodo, 0, MODE_EMA, PRICE_CLOSE, 1+i) < iCustom(NULL, PERIOD_CURRENT, "FractalChannel", 1, 1+i)  //Moving Average < FractalChannel  + Candlestick Close
      )
        {
         Buffer1[i] = High[i] + Distanza_Icona * myPoint; //Set indicator value at Candlestick High + fixed value
        }
 
fly7680: I need to set all the arrows that come out in the graph permanently. With this code, if it goes off the internet connection, they disappear from the graph and do not want to happen. How can I fix the arrows permanently?
  1. Your code is broken, fix it. Or post the rest.
  2. Do your lookbacks correctly.
  3. Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling (or moving my eyes) back and forth trying to read it. Edit the post with formatted code and you might get additional help.
 
I apologize you're right, this is the full code.
I would like to know how to fix the arrows on the chart.
If your Internet connection goes away or the MT4 is disconette, the arrows on the graph disappear.

I ask again apologize for not being more specific in early post

thank you


#property indicator_chart_window
#property indicator_buffers 2

#property indicator_type1 DRAW_ARROW
#property indicator_width1 2
#property indicator_color1 Blue
#property indicator_label1 "Sell"

#property indicator_type2 DRAW_ARROW
#property indicator_width2 2
#property indicator_color2 Lime
#property indicator_label2 "Buy"


double Buffer1[];
double Buffer2[];


double myPoint; //initialized in OnInit

void myAlert(string type, string message)
  {
   if(type == "print")
      Print(message);
   else if(type == "error")
     {
      Print(type+" | FractalMedia @ "+Symbol()+","+Period()+" | "+message);
     }
   else if(type == "order")
     {
     }
   else if(type == "modify")
     {
     }
  }


int OnInit()
  {   
   IndicatorBuffers(2);
   SetIndexBuffer(0, Buffer1);
   SetIndexEmptyValue(0, 0);
   SetIndexArrow(0, 242);
   SetIndexBuffer(1, Buffer2);
   SetIndexEmptyValue(1, 0);
   SetIndexArrow(1, 241);
   //initialize myPoint
   myPoint = Point();
   if(Digits() == 5 || Digits() == 3)
     {
      myPoint *= 10;
     }
   return(INIT_SUCCEEDED);
  }


int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime& time[],
                const double& open[],
                const double& high[],
                const double& low[],
                const double& close[],
                const long& tick_volume[],
                const long& volume[],
                const int& spread[])
  {
   int limit = rates_total - prev_calculated;
   //--- counting from 0 to rates_total
   ArraySetAsSeries(Buffer1, true);
   ArraySetAsSeries(Buffer2, true);
   //--- initial zero
   if(prev_calculated < 1)
     {
      ArrayInitialize(Buffer1, 0);
      ArrayInitialize(Buffer2, 0);
     }
   else
      limit++;
   
    
      //Indicator Buffer 1
      if(iMA(NULL, PERIOD_CURRENT, 4, 0, MODE_EMA, PRICE_CLOSE, 2+0) > iCustom(NULL, PERIOD_CURRENT, "FractalChannel", 1, 2+0) 
      && iMA(NULL, PERIOD_CURRENT, 4, 0, MODE_EMA, PRICE_CLOSE, 1+0) < iCustom(NULL, PERIOD_CURRENT, "FractalChannel", 1, 1+0)  
      )
        {
         Buffer1[0] = High[0] + 1 * myPoint; 
        }
     
      //Indicator Buffer 2
      if(iMA(NULL, PERIOD_CURRENT, 4, 0, MODE_EMA, PRICE_CLOSE, 2+0) < iCustom(NULL, PERIOD_CURRENT, "FractalChannel", 0, 2+0)
      && iMA(NULL, PERIOD_CURRENT, 4, 0, MODE_EMA, PRICE_CLOSE, 1+0) > iCustom(NULL, PERIOD_CURRENT, "FractalChannel", 0, 1+0) 
      )
        {
        Buffer2[0] = Low[0]  - 1 * myPoint; 
        }
      
     
   return(rates_total);
  }
 
  1.    if(prev_calculated < 1)
         {
          ArrayInitialize(Buffer1, 0);
    Had you read the documentation, you would know that buffers are automatically initialized
  2.   else
          limit++;
    Where is your loop using limit?
  3. Already answered: "do your lookbacks correctly."
 

The for loop I deleted it because the historian was not true and when the internet goes away sposatavano the arrows on the chart. I read but I did not understand lookbacks correctly.

Sorry

Code delede:

else
      limit++;
   
   //--- main loop
   for(int i = limit-1; i >= 0; i--)
     {
      if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation   



 
WHRoeder:
  1. Had you read the documentation, you would know that buffers are automatically initialized

Where ?

Buffers are initialized when you use SetIndexBuffer, they are NOT re-initialized when the number of bars increase (prev_calculated=0 after the first call).

 
You are right guys, but unfortunately I understand little English and I did not understand the buffers
Should I set the buffer differently?

Thanks again and sorry for my lack of preparation
 
angevoyageur: Where ?
Buffers are initialized when you use SetIndexBuffer, they are NOT re-initialized when the number of bars increase (prev_calculated=0 after the first call).
I forgot it changed in 600. That use to be the case:
int ArrayInitialize( void array[], double value)
Sets all elements of a numeric array to the same value. Returns the count of initialized elements.
Note: It is not recommended to initialize index buffers in the custom indicator init() function as such functions are initialized automatically with an "empty value" at allocation and re-allocation of buffers.
Parameters:
array[]   -   Numeric array to be initialized.
value   -   New value to be set.
Sample:
  //---- initializing of all array elements with 2.1
  double myarray[10];
  ArrayInitialize(myarray,2.1);
Reason: