Buffer Arrows Disappear

 
Can any gurus help, I dont know why these buffer arrows show when placed on a chart but wont show under test or any forward  pricing?
Files:
 
   PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE);
   PlotIndexSetDouble(1, PLOT_EMPTY_VALUE, EMPTY_VALUE);
⋮
   if(prev_calculated < 1)
     {
      ArrayInitialize(Buffer1, 0);
      ArrayInitialize(Buffer2, 0);
Why are you zeroing your buffers when no value is EMPTY_VALUE?
 
William Roeder:
Why are you zeroing your buffers when no value is EMPTY_VALUE?

I removed this Sir, but same result?

Files:
 
Brad Nicholson :
Can any gurus help, I dont know why these buffer arrows show when placed on a chart but wont show under test or any forward  pricing?

A few mistakes:

Why copy ALL-ALL bars on every tick ???

This is generally unnecessary - the indicator in OnCalculate already has an array of prices low []

   if(CopyBuffer(Adoubletop_handle, 2, 0, rates_total, Adoubletop_2) <= 0)
      return(rates_total);
   ArraySetAsSeries(Adoubletop_2, true);
   if(CopyLow(Symbol(), PERIOD_CURRENT, 0, rates_total, Low) <= 0)
      return(rates_total);
   ArraySetAsSeries(Low, true);


This is what immediately catches the eye

 
Vladimir Karputov:

A few mistakes:

Why copy ALL-ALL bars on every tick ???

This is generally unnecessary - the indicator in OnCalculate already has an array of prices low []


This is what immediately catches the eye

thank you, I removed this too but still the same, maybe an erroneous MT5 error?

 
Brad Nicholson :

thank you, I removed this too but still the same, maybe an erroneous MT5 error?

There are no errors in MetaTrade 5. Errors are only in your code.


I recommend taking a lighter example: based on the help for the iMA () indicator, make an indicator based on DRAW_ARROW. Would you be interested in this?

 
   for(int i = limit-1; i >= 0; i--)
Hi Brad, how are you ?

My guess,
under test or any forward  pricing  you'll mostly have this situation limit <= 0, thus your loop is never executed.
Place some print (limit, prev_calculated and rates_total) to  monitor that values, and you'll see.

Good luck.
 

Hi Guys, thanks for the assistance, I have created many arrow programs but I don't profess to know or be able to grasp what is going on here. It creates arrows you can see them but any forward arrows just vanish when you test it or put it into a live trading. It tried all that was suggested. I'm going to have to move this to the too hard basket, I admit, I am trying to punch above my weight but appreciate the assistance given.

Rgds

 
can you attach the custom indicator you use in your code ?
I'm not able to run your code without that custom indicator.
 
Soewono Effendi:
can you attach the custom indicator you use in your code ?
I'm not able to run your code without that custom indicator.

Hi Sef,

Here it is, this had me intrigued, was very curious but gave up in the end.  Wish you luck!

Files:
 
   for(int i=limit; i>=0 && !IsStopped(); i--)
...
BufferTop[i+min_bars]= ...

Inside A-double-top.mq5, the way the buffers are updated with index [i+min_bars] will never update the current bar (Bar0) for (min_bars > 0).

No idea why there is the min_bars, but it shows me clearly that the code will never update current candle (bar0).

Good luck

Reason: