shown Arrow problem

 
Hi,

I am programming an indicator which must shown an arrow on every day the conditions are met for all available days there are in my chart.

I've got it working when I met all the conditions with price. When I will met a condiont with pricetp, it doesn't work anymore and show every day an arrow. Can someone help me to solve this puzzle?

         if(Retrace0WBuffer[shfC]<price && PrevDayLoBuffer[shfC]<price) dn1[shfC]=High[shfC]+Distance; //This line works fine and shows a down arrow
         if(Retrace0WBuffer[shfC]<price && PrevDayLoBuffer[shfC]<pricetp) dn1[shfC]=High[shfC]+Distance; //This line doesn't work

Best regards,


Smika


//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxx

   if(prev_calculated < 0) return(-1); //fed
   int limits=rates_total-prev_calculated; //fed  
   
//   if(prev_calculated>0)
  //    limits++;
 for(int i=0;i<limits;i++)
{ 
if(i>Bars-1) continue;

 HighTargetaBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,0,i);
 LowTargetaBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,1,i);
 RangeHighBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,2,i);
 RangeLowBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,3,i);
 HighWkTargetaBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,4,i);
 LowWkTargetaBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,5,i); 
 Retrace0Buffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,6,i); 
 Retrace3Buffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,7,i);
 OpenDaBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,8,i); 
 OpenWkBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,9,i);  
 Retrace0WBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,10,i); 
 Retrace3WBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,11,i);
 PrevDayHiBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,12,i); 
 PrevDayLoBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,13,i);
 PrevWkHiBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,14,i); 
 PrevWkLoBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,15,i);
 DailyMidpointBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,16,i); 
 WeekMidpointBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,17,i);
 
 
 
}

for(int j=0; j<ObjectsTotal();j++)
{
      string name= ObjectName(j);
      double price=-1;
      datetime time1=0;

for(int k=0; k<ObjectsTotal();k++)
{
      string naam= ObjectName(k);
      double pricetp=-1;
      datetime time1tp=0; 
                          
//SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS                
  
         if(StringFind(name,"buy_sell_indi",0)!=-1 && StringFind(name,"Entry",0)!=-1){
         price=ObjectGetDouble(0,name,OBJPROP_PRICE1);
         time1=(datetime)ObjectGetInteger(0,name,OBJPROP_TIME1);
         int shfC=iBarShift(NULL,PERIOD_CURRENT,time1);



         if(StringFind(naam,"buy_sell_indi",0)!=-1 && StringFind(naam,"TP1",0)!=-1){
         pricetp=ObjectGetDouble(0,naam,OBJPROP_PRICE1);}
         time1tp=(datetime)ObjectGetInteger(0,naam,OBJPROP_TIME1);
         int shfC1=iBarShift(NULL,PERIOD_CURRENT,time1tp);        
        
           if(shfC>=0) {   
    
         if(Retrace0WBuffer[shfC]<price && PrevDayLoBuffer[shfC]<price) dn1[shfC]=High[shfC]+Distance; //This line works fine and shows a down arrow
         if(Retrace0WBuffer[shfC]<price && PrevDayLoBuffer[shfC]<pricetp) dn1[shfC]=High[shfC]+Distance; //This line doesn't work

         
                }}}}

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+


 
smika:I am programming an indicator which must shown an arrow on every day the conditions are met for all available days there are in my chart. I've got it working when I met all the conditions with price. When I will met a condiont with pricetp, it doesn't work anymore and show every day an arrow.
   int limits=rates_total-prev_calculated; //fed  
   
//   if(prev_calculated>0)
  //    limits++;
 for(int i=0;i<limits;i++)
{ 
if(i>Bars-1) continue;
:
   return(rates_total);
  1. Your post is almost unintelligible. If you are using mechanical translation, you must use simple language structure.
  2. After the initial run, limits is zero so your loop never runs.
  3. Do your lookbacks correctly.
 

I still can't get it work. Even when I read the links. Is there someone who can help me with the right direction without a link?


Smika

 
smika:

I still can't get it work. Even when I read the links. Is there someone who can help me with the right direction without a link?


Smika


Is my problem so difficult, so no body can help me with my problem?

 

Oke.... recode the code. But it still not working, maybe someone can help me?


//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxx
   if(prev_calculated < 0) return(-1); //fed
   int limits=rates_total-prev_calculated; //fed  
   
//   if(prev_calculated>0)
  //    limits++;
 for(int i=0;i<limits;i++)
{ 
if(i>Bars-1) continue;
 HighTargetaBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,0,i);
 LowTargetaBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,1,i);
 RangeHighBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,2,i);
 RangeLowBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,3,i);
 HighWkTargetaBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,4,i);
 LowWkTargetaBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,5,i); 
 Retrace0Buffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,6,i); 
 Retrace3Buffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,7,i);
 OpenDaBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,8,i); 
 OpenWkBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,9,i);  
 Retrace0WBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,10,i); 
 Retrace3WBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,11,i);
 PrevDayHiBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,12,i); 
 PrevDayLoBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,13,i);
 PrevWkHiBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,14,i); 
 PrevWkLoBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,15,i);
 DailyMidpointBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,16,i); 
 WeekMidpointBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,17,i);
 
}
for(int j=0; j<ObjectsTotal();j++)
{
      string name= ObjectName(j);
      double price=-1;
      datetime time1=0;
                          
//SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS                
  
         if(StringFind(name,"buy_sell_indi",0)!=-1 && StringFind(name,"Entry",0)!=-1){
         price=ObjectGetDouble(0,name,OBJPROP_PRICE1);
         time1=(datetime)ObjectGetInteger(0,name,OBJPROP_TIME1);
         int shfC=iBarShift(NULL,PERIOD_CURRENT,time1);
 
           if(shfC>=0) {   

double stp1;


stp1 = ObjectGetDouble(0,"buy_sell_indi"+_Symbol+"_MST1",OBJPROP_PRICE1);

    
         if(Retrace0WBuffer[shfC]<price && PrevDayLoBuffer[shfC]<price) dn1[shfC]=High[shfC]+Distance; //This line works fine and shows a down arrow
         if(Retrace0WBuffer[shfC]<stp1 && PrevDayLoBuffer[shfC]<stp1) dn1[shfC]=High[shfC]+Distance; //This line doesn't work
         
                }}}}
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
smika: . But it still not working, maybe someone can help me?
  1. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here and our crystal balls are cracked.
  2. Help you with what? You haven't stated a problem.

  3.    int limits=rates_total-prev_calculated; //fed  
       
    //   if(prev_calculated>0)
      //    limits++;
     for(int i=0;i<limits;i++)
    { 
    if(i>Bars-1) continue;
     HighTargetaBuffer[i]=iCustom(NULL,PERIOD_CURRENT,"fib_indi","",false,0,i);
    :
       return(rates_total);
    After the first run rates_total and prev_calculated will be the same so limit is zero and your for loop does nothing. You are only processing the first tick of bar zero.
              How to do your lookbacks correctly.

  4. smika: Even when I read the links. Is there someone who can help me with the right direction without a link?
    If you can't understand the information in the links, then you have no choice: pay (Freelance) someone to code it. We're not going to code it for you. 
Reason: