My iCustom indicator changes more frequently in EA than chart

 

I am using a custom indicator that draws up and down arrows for fractals.
Below is one the hour timeframe and the indicator is working correctly.


https://i.stack.imgur.com/Y3eUa.png


The problem is when I call the indicator using below code in an EA and monitor those values to detect changes OnTick():

  double UpArrowValue = iCustom(_Symbol,_Period,"Market\Fractals", 1, 10.0, 0,1);

  double DownArrowValue = iCustom(_Symbol,_Period,"Market\Fractals", 1, 10.0, 1,1);

I see the following changes:

2019.02.19 19:00:00 FractalReader EURUSD,H1: 2019-02-19 19:00 Up Arrow Value Changed: 1.1366

2019.02.19 18:00:00 FractalReader EURUSD,H1: 2019-02-19 18:00 Up Arrow Value Changed: 1.1352

2019.02.19 17:00:00 FractalReader EURUSD,H1: 2019-02-19 17:00 Up Arrow Value Changed: 1.1349

2019.02.19 16:00:00 FractalReader EURUSD,H1: 2019-02-19 16:00 Up Arrow Value Changed: 1.1331

2019.02.19 15:00:00 FractalReader EURUSD,H1: 2019-02-19 15:00 Up Arrow Value Changed: 1.131

2019.02.19 11:00:00 FractalReader EURUSD,H1: 2019-02-19 11:00 Up Arrow Value Changed: 1.1334

2019.02.19 10:00:00 FractalReader EURUSD,H1: 2019-02-19 10:00 Up Arrow Value Changed: 1.1333

2019.02.19 09:00:00 FractalReader EURUSD,H1: 2019-02-19 09:00 Up Arrow Value Changed: 1.1314

2019.02.19 07:00:00 FractalReader EURUSD,H1: 2019-02-19 07:00 Up Arrow Value Changed: 1.1309

2019.02.19 02:02:00 FractalReader EURUSD,H1: 2019-02-19 02:02 Up Arrow Value Changed: 1.1323

2019.02.19 01:00:00 FractalReader EURUSD,H1: 2019-02-19 01:00 First Up Arrow: 1.1322

2019.02.19 00:00:00 FractalReader EURUSD,H1: 2019-02-19 00:00 First Down Arrow: 1.1298

Not all of the above resulted in an arrow being drawn, but all of the arrows drawn are one of those lines. I believe it has something to do with OnTick() vs bars only being drawn on the hour. The indicator uses whatever timeframe you pass to it.

How can I figure out when a signal change results in an arrow being drawn? Is there anything to capture from an indicator besides iCustom()?

 

Do not double post.

Your other topic has been deleted.

 
Keith Watford:

Do not double post.

Your other topic has been deleted.

Apologies, thank you.
 

OK I think I figured out the discrepancy by watching my the indicator in action.


I get additional values because the indicator is flagging on the current bar as it is being formed.  So it says "Yes, one bar to the left is a fractal, but then the current bar 0 may continue moving up or down so it is no longer a fractal".

Lets say it is operating on bar 1 (one to the left of the current bar being drawn).  It is monitoring bar 2 and bar 0 for fractal formation.  Any advice on moving the whole thing left one so it only is checking out bar 3, 2, and 1.  This way if it detects a fractal, it is a true fractal because bar 0 and its movements are not being considered.

Reason: