How do I fix this error in my indicator?

 

Welcome!


I am a newbie in MQL4.

I tried to create custom indicator for (this indicator "THV3 Trix v4.01 Div.ex4")


Draw Up Arrow in Chart Window: Cross-Lines to UP

Draw Down Arrow in Chart Window: Cross-Lines to DOWN


These my try:

There are two problems

1- UP arrow is repeated more than once

2- Down arrow does not appear.

#property copyright ""
#property link      ""

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1  Blue
#property indicator_color2  Red

double UpBuffer[], DownBuffer[];
double dPoint = 0.0;

int init()
{
   IndicatorBuffers(2);
   
   SetIndexBuffer(0,UpBuffer);
   SetIndexStyle(0,DRAW_ARROW, STYLE_DASH, 4);
   SetIndexArrow(0, SYMBOL_ARROWUP);
   SetIndexLabel(0, "Up Signal");
   
   SetIndexBuffer(1,DownBuffer);
   SetIndexStyle(1,DRAW_ARROW, STYLE_DASH, 4);
   SetIndexArrow(1, SYMBOL_ARROWDOWN);
   SetIndexLabel(1, "Down Signal");
   
   IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
   IndicatorShortName("Cocktail Entry");
   
   dPoint = Point * MathPow(10, Digits % 2);
   
   return(0);
}

int deinit()
{
   return(0);
}


int start()
{
   int CountedBars = IndicatorCounted();
   
   if(CountedBars < 0) return(-1);
   
   int pos = 0;
   if(Bars > CountedBars + 1) pos = (Bars - CountedBars) - 1;
   
   string strComment = "";
   
   for(int i = pos; i > 0; i--)
   {
      double THV3Trix401DivValueZero = iCustom(Symbol(), 0, "THV3 Trix v4.01 Div", "", CLR_NONE, CLR_NONE, CLR_NONE, 2, "", CLR_NONE, CLR_NONE, CLR_NONE, false, false, false, false, true, true, "", 1, true, 750, "", 500, true, false, false, "", true, "", "", "", "", "", "", "", "", "", "", "", true, false, "", CLR_NONE, CLR_NONE, "", "", "", "", "", 0, i);
      double THV3Trix401DivValueTwo = iCustom(Symbol(), 0, "THV3 Trix v4.01 Div", "", CLR_NONE, CLR_NONE, CLR_NONE, 2, "", CLR_NONE, CLR_NONE, CLR_NONE, false, false, false, false, true, true, "", 1, true, 750, "", 500, true, false, false, "", true, "", "", "", "", "", "", "", "", "", "", "", true, false, "", CLR_NONE, CLR_NONE, "", "", "", "", "", 2, i);
      
      double THV3Trix401DivValueFirst = iCustom(Symbol(), 0, "THV3 Trix v4.01 Div", "", CLR_NONE, CLR_NONE, CLR_NONE, 2, "", CLR_NONE, CLR_NONE, CLR_NONE, false, false, false, false, true, true, "", 1, true, 750, "", 500, true, false, false, "", true, "", "", "", "", "", "", "", "", "", "", "", true, false, "", CLR_NONE, CLR_NONE, "", "", "", "", "", 1, i);
      double THV3Trix401DivValueThree = iCustom(Symbol(), 0, "THV3 Trix v4.01 Div", "", CLR_NONE, CLR_NONE, CLR_NONE, 2, "", CLR_NONE, CLR_NONE, CLR_NONE, false, false, false, false, true, true, "", 1, true, 750, "", 500, true, false, false, "", true, "", "", "", "", "", "", "", "", "", "", "", true, false, "", CLR_NONE, CLR_NONE, "", "", "", "", "", 3, i);
      
      if(THV3Trix401DivValueTwo > THV3Trix401DivValueZero)
      {
         UpBuffer[i] = Low[i] - 5 * dPoint;
         Alert("Buy Alert ", Symbol(), "-", Period());
      }
      
      if(THV3Trix401DivValueThree < THV3Trix401DivValueFirst)
      {
          DownBuffer[i] = High[i] + 5 * dPoint;
          Alert("Sell Alert ", Symbol(), "-", Period());
      }
   }
   
   Comment(strComment);
     
   return(0);
}
Files:
 

GolderLight:

I am a newbie in MQL4.

I tried to create custom indicator for (this indicator "THV3 Trix v4.01 Div.ex4")

  1. No kidding
  2. How the heck are we supposed to know if your iCustom call is anywhere remotely correct with out the indicator code? No mind readers here.
  3.    int CountedBars = IndicatorCounted();
       if(CountedBars < 0) return(-1);
       int pos = 0;
       if(Bars > CountedBars + 1) pos = (Bars - CountedBars) - 1;
       string strComment = "";
       for(int i = pos; i > 0; i--)
    Assuming the indicator does not look back, no mA(length), no DrawBegin calls, the above is
       int CountedBars = IndicatorCounted();
       if(CountedBars < 0) return(-1);
       string strComment = "";
       for(int i = bars - 1 - CountedBars; i > 0; i--)

 
Welcome! WHRoeder!
  1. Who told you I was kidding?!! (sorry!!!)
  2. I do not want to learn programming only asked to request and I expect that there is an answer for my problem.
  3. I do not have .mq4 code for indicator, I expect that it is not required (I not want a study of the behavior of indicator) because I want a one condition: lines Cross!


All I wanted to do a simple indicator to draw arrows, If this is possible I hope help, is not possible only told me!!


I appreciate your reply ... thanks !
 
GolderLight:
I do not want to learn programming only asked to request and I expect that there is an answer for my problem.
  1. No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.
  2. Without knowing the externals of the indicator with their exact order and type and without knowing the buffers order, the iCustom can't be verified - no mind readers here. The behavior of the indicator is irrelevant.
Reason: