Holes in price causing wrong indicator value

My AFL uses 2 different instruments. One is the base instrument (foreign) and the other is the tradedInstrument (primary chart instrument). For example CBOE index and ES. Now signals are triggered based on price crossing over some indicator created using the base Instrument. I am facing a problem when traded instrument has no price for few seconds while the base instrument has price(tick) for those seconds. because there are holes in the traded instrument even though base instrument has the price the indicator value is not properly calculated. Is there a way to fill such holes (like Foreign() )? I though about switching th traded instrument to foreign but that will be disastrous if for some reason the base instrument tick does not come through. I welcome all suggestions in this aspect.

Have you read the documentation on Pad & Align? That might be a good place to start.

Thankyou for replying. I tried that and getting somewhat different results but my concern is more from the chart/signal point of view. Backtester settings won’t effect signals. Let me try to explain.
All indicators are calculated from the foreign instrument. Imagine two charts. One has both primary and foreign instruments. The second chart has only the instrument that was used as foreign in the 1st chart.

10:25:01 ind1<ind2
10:25:02 ind2 crosses ind2 (according to second chart). But unfortunately primary instrument does not have a tick. So no cross here and no signal. Ideally should have got a signal (if i used the foreign instrument as the primary instrument then would have got a signal.) I would have sent a limit order there.
10:25:03 still no tick in primary instrument. so no signal yet.
10:25:04 finally a tick comes through in the primary instrument. may or may not cause a cross meaning maybe a signal but too late.

What i would want is kind of a blank bar (or copy of last bar) for times when no tick in primary instrument but tick exists in foreign instrument.

I could not find a way to edit the message so i have to repost this

Thankyou for replying. I tried that and getting somewhat different results but my concern is more from the chart/signal point of view. Backtester settings won’t effect signals. Let me try to explain.
All indicators are calculated from the foreign instrument. Imagine two charts. One has both primary and foreign instruments. The second chart has only the instrument that was used as foreign in the 1st chart.

10:25:01 ind1>ind2
10:25:02 ind2 crosses ind1 (according to second chart). But unfortunately primary instrument does not have a tick. So no cross here and no signal whereas there is a signal in second chart. Ideally should have got a signal in first chart as well. I would have sent a limit order then.
10:25:03 still no tick in primary instrument. so no signal yet.
10:25:04 finally a tick comes through in the primary instrument. may or may not cause a cross meaning maybe a signal but too late.

What i would want is kind of a blank bar (or copy of last bar) for times when no tick in primary instrument but tick exists in foreign instrument.

@Jefforey

Your problem (Data Holes in Real-Time Trading) - which can occur when a ticker is not traded or when the data feed is interrupted, has been discussed in the article below. Study it in details. You should find appropriate solution(s) :

http://www.amibroker.org/userkb/2007/06/26/data-holes-in-real-time-trading/

Besides, when you access foreign security data using foreign( Ticker, Datafield, fixup = 1) pay special attention to the fixup parameter which is responsible for dealing with data holes:

https://www.amibroker.com/guide/afl/foreign.html

1 Like