DDS(drake delay stochastic) indicator delays in updating candle values

 

Hi folks, 

I created a expert adviser to alert whenever the dds value reverse its direction,  this expert adviser runs every 5 minutes and watch over the M15 chart. The following is the code snippet that I use to retrieve dds values of the previous closed candles.

         double currentTfDDS_0 = iCustom(symbol, tf, "Drake Delay Stochastic", Slw,Pds, Slwsignal, Barcount, 0, 1);

        double currentTfDDS_2 = iCustom(symbol, tf, "Drake Delay Stochastic",  Slw,Pds, Slwsignal, Barcount, 0, 2);                    

   

Now the problem I face is that this values delay in updating whenever new candle started.

say the time is now 5.14pm and at 5.15 pm it closes 15 minute candle. so the value you get by iCustom(symbol, tf, "Drake Delay Stochastic", Slw,Pds, Slwsignal, Barcount, 0, 0) at 5.14 will be moved to second candle at 5.15  which you get by iCustom(symbol, tf, "Drake Delay Stochastic", Slw,Pds, Slwsignal, Barcount, 0, 1). The problem is that it delays from this happening. some time it takes more than one minute to update. Have anyone faced similar problem and Have you found any solution like can you refresh indicator to get the newer values and How you can do that

 
I could resolve it following a onTick based approach, Earlier I used a timer to run the logic for every five minutes Still I use a timer but Logic only runs when indicator changes the value for the first closed candle. Hope it is clear! I store indicator values whenever it changes I run the logic. My thought is that you cant trust indicator for on time updates. so you wait indicator to change its value and runs the program without further delay