would it benefit your script if you would remove ArraysSetAsSeries in OnCalculate and instead make an incremental loop for the main loop?
// Set price and other buffers AsSeries //(removed) //ArraySetAsSeries(open,true); ArraySetAsSeries(high,true); //ArraySetAsSeries(low,true); ArraySetAsSeries(close,true); //ArraySetAsSeries(time,true); ArraySetAsSeries(tick_volume,true); // Check if there are enough bars for calculation //if(rates_total < SkipBars) return(0); // How many bars to calculate int count = rates_total - prev_calculated - SkipBars; // number of bars not yet calculated //if(prev_calculated > 0) count++; //(removed) // Main indicator calculation loop for(int i = count; i < rates_total; i++) { //code }
I'm not a Guru or anything, just making a suggestion.
would it benefit your script if you would remove ArraysSetAsSeries in OnCalculate and instead make an incremental loop for the main loop?
I'm not a Guru or anything, just making a suggestion.
Thanks for you reply.
Need to set ArrayAsSeries because my pattern calculations are 2+PrveIdx, 1+PrevIdx and PrevIdx. Without set as series, calculation does not work as it needs to be PrevIdx-2 ... (bit confusing when look at the chart).
Incremental loop also did not help.
Anyway thanks again for your suggestion and time.
regards

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear Fellows
I am trying to create custom indicator iCandlePatterns.mq5 for identifying patterns. The Indicators works fine when loaded for the first time on chart and finds patterns for all the history data.
However, after that it does not update patterns as new candles are formed. I could not find what is wrong in my code, so here I am seeking assistance from Gurus.
I have also created a class CCandlePatterns.mqh to get data in EA or Strategies. The is3BC() and is3WS() methods are returning false values even when the pattern is found by indicator.
It seems as indicator values are not updated, is3BC() method get a 'Zero' value instead of EMPTY_VALUES, and hence get a false result. If any other problem is causing this, I would request to help me on that too.
Below is the result from EATest run:
Necessary files are attached herewith including the screen shot of Tester Run and Live Chart data.
Also guide me how can I check pattern once on each new bar, instead of every tick in OnCalculate() method.
Support from the members to figure it out is highly appreciated. Thanks a lot in advance.