user3822: When the indicator launches, or when you switch timeframes on the chart, there's a 2 second delay.
I've done some research into this, and I read that it could be if the indicator code is not optimized or iCustom has some wrong input parameters that are causing the issue.
This calls scanner every single tick. | int counted_bars = IndicatorCounted(); if (counted_bars < 0) return(-1); if (counted_bars > 0) counted_bars--; barsLookback = barsLookback - counted_bars; scanner(); |
Scanner only looks at bar one. Only call it on a new bar. See How to do your lookbacks correctly. | #define LAST 1 // Normally zero #define BEGIN 1 // Normally Bars - 1 for(int iBar = BEGIN-prev_calculated; iBar >= LAST; --iBar){ scanner(); } #define REDRAW_BAR_LAST false // Redraw Bar LAST. return rates_total - REDRAW_BAR_LAST - LAST; |
whroeder1:
Thanks, I'll look into it and get back if I have any other questions.
This calls scanner every single tick. | |
Scanner only looks at bar one. Only call it on a new bar. See How to do your lookbacks correctly. |
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi everyone,
I made a dashboard that scans 7 pairs for price action candlesticks on 5 different time frames. Rather than waste time explaining it further, I'll just show a picture.
Anyway, the dashboard calls on iCustom for 4 different indicators.
When the indicator launches, or when you switch timeframes on the chart, there's a 2 second delay.
I've done some research into this, and I read that it could be if the indicator code is not optimized or iCustom has some wrong input parameters that are causing the issue.
Originally, I didn't specify any parameters of the indicators for iCustom, so I thought I'd try specifying parameters. No difference; the dashboard still takes 2 seconds to load and 2 seconds when switching timeframes.
I also looked back at the code to see if that was it. People mentioned that it could be the indicators are calculating every bar on every tick. I wasn't using "counted_bars = IndicatorCounted();", so I added it to OnCalculate (as per the example in the help manual), but it still doesn't make a difference in terms of loading time and when switching timeframes.
Anyway, here's some relevant code:
Dashboard call to check indicators
Dashboard calls to iCustom
The Price Action indicators essentially follow the same template among each other, with the biggest difference being the calculations for finding the Price Action candles, so rather than posting all the code, I'll post the Properties, Input Parameters, OnInit, and OnCalculate.
The PinBar and Inside Candle indicators have a few extra input parameters. These parameters are: