title: How do I keep the string value the same when the indicator buffer no longer gives a value?
body: <p>I've coded a basic Expert Advisor to trigger a trade when the parameters are true. However, in this case the code will never meet all the requirements because the string value gives no value when the indicator buffer doesn't give a value.</p>
  <p>What I need help with is to make the string value for <code>saisignal</code> stay the same when triggered by the indicator buffer, after the bar has passed the arrow indicator, so that when the other signals are eventually indicating a trade, it can trigger a trade.</p>
  <pre><code>double closeAllTradesThisPair()
  {
    for (int i=OrdersTotal();i&gt;=0;i--)
     {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderSymbol()==Symbol())
      {
       OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),3,clrNONE);
      }
     }
   }
  
  void OnTick()
  {
   double saiup = iCustom( Symbol(), PERIOD_H1, &quot;super-arrow-indicator&quot;, 0, 0 );
   double saidn = iCustom( Symbol(), PERIOD_H1, &quot;super-arrow-indicator&quot;, 1, 0 );
   double osma1 =   iOsMA( Symbol(), PERIOD_H1, 12, 26, 9, PRICE_OPEN, 1 );
   double osma0 =   iOsMA( Symbol(), PERIOD_H1, 12, 26, 9, PRICE_OPEN, 0 );
   double stup  = iCustom( Symbol(), PERIOD_H1, &quot;super-trend&quot;, 0, 0 );
   double stdn  = iCustom( Symbol(), PERIOD_H1, &quot;super-trend&quot;, 1, 0 );
   double sar   =    iSAR( Symbol(), PERIOD_H1, 0.02, 0.2, 0 );
   double ma    =     iMA( Symbol(), PERIOD_H1, 20, 0, MODE_SMA, PRICE_CLOSE, 0 );
  
   string saisignal  = &quot;&quot;;
   string osmasignal = &quot;&quot;;
   string stsignal   = &quot;&quot;;
   string sarsignal  = &quot;&quot;;
   string masignal   = &quot;&quot;;
  
   if(saiup &lt; 1000)
    {
      saisignal = &quot;123&quot;;
    }
   if(saidn &lt; 1000)
    {
      saisignal = &quot;321&quot;;
    }
    
   if(osma1 &lt; osma0)
     {
      osmasignal = &quot;123&quot;;
    }
   if(osma1 &gt; osma0)
    {
      osmasignal = &quot;321&quot;;
    }
  
  if(stup &lt; 1000)
    {
      stsignal = &quot;123&quot;;
    }
  if(stdn &lt; 1000)
    {
      stsignal = &quot;321&quot;;
    }
   
  if(sar &lt; Bid)
    {
      sarsignal = &quot;123&quot;;
    }
  if(sar &gt; Bid)
    {
      sarsignal = &quot;321&quot;;
    }
  
  if(ma &lt; Bid)
    {
      masignal = &quot;123&quot;;
    }
  if(ma &gt; Bid)
    {
      masignal = &quot;321&quot;;
    } 
  
  for(int b=OrdersTotal()-1;b&gt;=0;b--)
    {
      if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES))
        {
          if(OrderSymbol()==Symbol())
            {
              if(OrderType()==OP_BUY)
                {
                  if(OrderStopLoss() &lt; Ask - (150*_Point))
                    {
                      OrderModify(OrderTicket(),OrderOpenPrice(),Ask-(150*_Point),OrderTakeProfit(),0,CLR_NONE);
                    }
                }
              if(OrderType()==OP_SELL)
                {
                  if(OrderStopLoss() &gt; Bid + (150*_Point))
                    {
                      OrderModify(OrderTicket(),OrderOpenPrice(),Bid+(150*_Point),OrderTakeProfit(),0,CLR_NONE);
                    }
                }
            }
        }
    }
                     
  if(saisignal == &quot;123&quot;)
    {
      if(osmasignal == &quot;123&quot;)
        {
          if(stsignal == &quot;123&quot;)
            {
              if(sarsignal == &quot;123&quot;)
                {
                  if(masignal == &quot;123&quot;)
                    {
                      double buyticket = OrderSend(Symbol(),OP_BUY,0.01,Ask,3,Ask-150*_Point,0,NULL,0,0,CLR_NONE);
                    }
                }
            }
        }
    }
  
  if(saisignal == &quot;321&quot;)
    {
      if(osmasignal == &quot;321&quot;)
        {
          if(stsignal == &quot;321&quot;)
            {
              if(sarsignal == &quot;321&quot;)
                {
                  if(masignal == &quot;321&quot;)
                    {
                      double sellticket = OrderSend(Symbol(),OP_SELL,0.01,Ask,3,Bid+150*_Point,0,NULL,0,0,CLR_NONE);
                    }
                }
            }
        }
    }
  Comment(&quot;   sai: &quot;,saisignal,&quot;   osma: &quot;,osmasignal,&quot;   st: &quot;,stsignal,&quot;   sar: &quot;,sarsignal,&quot;   ma: &quot;,masignal);
  }  
  </code></pre>