Indicator Result index may not match actual bar index

Created at 06 Jul 2020, 23:38
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
ER

ergun

Joined 26.04.2020

Indicator Result index may not match actual bar index
06 Jul 2020, 23:38


Hello,

I have an indicator which i use in my bot. The indicator generates simple signals like 1,0,-1. I have been using this indicator in my bot like a month now. Until last night everything was fine. Somehow since last night things got weird like my indicator started producing only 0 for the lastbar so my bot became useless. I dived into the problem and found a bizarre thing.

My indicator generates signals for each bar and in my bot in " OnBar()" method i check for the finalized last bars signal and act accordingly. But this time i found out that using :

myIndicator.Signal.Last(0)

in the bot sometimes i get the value of new started bar and sometimes the result of finalized bar from the indicator??? This made me think if it is possible that; the calculation of indicator for the finalized bar sometimes do not finish before i receive the bar for the market? In some markets for ex EURUSD it gives me the last finalized bars' signal not the newly created not finalized bar. But even for some markets let say GBPUSD there is a shift of 2 bars (i receive the signal for the last bar 2 bars later)??? I found this out by drawing my indicator and logging everything.

Is such thing possible? Or is it possible that there is another problem which you can think of?

Unfortunately i can not share the code because it is a client indicator :(

The key point is; it worked fine nearly a month now but suddenly i have these shifts and inconsistencies. Do i need to clear some cache or something like that? Is it possible to be sure of the index of signal matches the actual bar index? I thought using a second signal for indexing and using bar start times as references then i realized in some markets start of the bar can delay couple of seconds which will defeat the whole point.

All ideas and help is appreciated.

Best

PS: I am using 30min, 1h and 4h bars. I made my tests on 1min bars


@ergun
Replies

PanagiotisCharalampous
07 Jul 2020, 08:36

Hi ergun,

Unfortunately without source it is not possible to give you an advise. If you can create a sample indicator that reproduces the problem it would be helpful.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous