Can a map() execution be guaranteed to complete before the next price/volume update triggers a new one?

Hi all,

I’m developing a custom indicator that uses the Goertzel transform to extract dominant cycles from recent price data. These cycles are then used in a genetic algorithm to optimize amplitudes and reconstruct the signal with the most relevant components.

This logic is implemented inside the map(d, i, history) function.

I’ve observed that price and volume updates can trigger multiple executions of map() within the same forming bar, at a frequency higher than the chart’s selected timeframe. This is expected — and even desirable — for live reactivity, but raises a technical concern:

If my indicator is in the middle of a long computation and a new intra-bar update occurs, it seems that the ongoing map() execution is silently interrupted and a new one starts from scratch. No queuing, no completion, just dropped work.

To clarify:

  • I’m already using d.isComplete() and this.lastIndex to avoid redundant or unnecessary recalculations.
  • What I’m looking for is not a way to skip future updates, but a way to ensure that a map() already in progress is allowed to run to completion.

Is there any setting or design pattern in Tradovate that ensures a map() execution completes before another begins?

Or alternatively:

Is it confirmed that map() is interruptible and that partial executions can be discarded without finishing?

This behavior has important implications in cases like mine, where computationally expensive logic (e.g. signal reconstruction with optimized cycles) is sensitive to incomplete state or wasted cycles.

Thanks in advance for any insights or official clarification.

Federico

Sounds very interesting. I have no experience with indicators in Tradovate.

Have you considered doing it on a nodejs servers instead with real-time data? You will be in full control of the calculations and you could even have it take trades automatically.

Ciao Frik,

this sounds a little beyond my current skills, but I could learn how to do it if it’s the only feasible way.

Can a Node.js server receive data from Tradovate and then return the processed output to a Tradovate custom indicator to be displayed in a subchart?

Thank you!

I am happy to talk to you about the details and possibilities

@tikidave might have the answer

thanks I will write him as soon as possible we are discussing another issue too. Thanks.

Is there any setting or design pattern in Tradovate that ensures a map() execution completes before another begins?

Hmm, I have not noticed this behavior, and by definition, a map must process the entire list of data (and should not return early) and “map” the new result.

How are you determining the map is not fully complete?

1 Like

I’m developing a custom indicator that uses the Goertzel transform to extract dominant cycles from recent price data. These cycles are then used in a genetic algorithm to optimize amplitudes and reconstruct the signal with the most relevant components.

I was curious what indicator you were looking to build, are any of these what you’re looking for?

  1. Goertzel Cycle Period [Loxx] — Indicator by loxx — TradingView
  2. Goertzel Browser [Loxx] — Indicator by loxx — TradingView
  3. Goertzel Cycle Composite Wave [Loxx] — Indicator by loxx — TradingView