onBarUpdate not called anymore since version 7?

CleanCode

Member
Joined
Nov 12, 2025
Posts
7
Likes
2
Most of my custom studies stopped working since Motivewave 7 and I think I now figured out why:

@Override
public void onBarUpdate(DataContext dataContext) {
debug("onBarUpdate called!");
}

never creates any log line anymore. onTick(DataContext dataContext, Tick tick) however does! Did anyone else notice this behavior? I guess I need to change my code to use this method instead.

My StudyHeader includes the necessary

requiresBarUpdates = true,
supportsBarUpdates = true,
barUpdatesByDefault = true,

(I added all of them, and it still does not work)
 
Most of my custom studies stopped working since Motivewave 7 and I think I now figured out why:

@Override
public void onBarUpdate(DataContext dataContext) {
debug("onBarUpdate called!");
}

never creates any log line anymore. onTick(DataContext dataContext, Tick tick) however does! Did anyone else notice this behavior? I guess I need to change my code to use this method instead.

My StudyHeader includes the necessary

requiresBarUpdates = true,
supportsBarUpdates = true,
barUpdatesByDefault = true,

(I added all of them, and it still does not work)
Yes that is the reason - they changed it. Which actually sucks
 
Are you using that study with Linear or non-Linear bars?
Linear bars..

Yes that is the reason - they changed it. Which actually sucks
Sucks a lot... Do you know if there is an alternative? They just skipped it I guess.. This is so bad! Over the years I created many studies to make my trading life easier and this was the reason I would never switch to another trading software..

I quickly tried to use the onTick method instead, but I think this is not a good solution, it will slow down motivewave even more. For example I created an alert system, where I get an alert when a dynamically calculated level is touched. This would now need to be calculated on every tick, which does not necessarily lead to an update of the candle. But I'm only interested in an update of a candle!
 
Did you recompile your Study with the new SDK?

I have developed a study that draws bars/candles to my taste, it did not work as it is with the MW7 - the last bar was not updated. After recompiling the Study, as it was required and communicated by the MW dev team upfront the release, my study works just fine.

cheers.
 
Did you recompile your Study with the new SDK?

I have developed a study that draws bars/candles to my taste, it did not work as it is with the MW7 - the last bar was not updated. After recompiling the Study, as it was required and communicated by the MW dev team upfront the release, my study works just fine.

cheers.
Thanks for your response. Yes I did. Do you explicitly use the onBarUpdate method? Can you confirm that the following code does give you a log output?

@Override
public void onBarUpdate(DataContext dataContext) {
debug("onBarUpdate called!");
}
 
I wrote to support. In the meantime I had the idea, to call the onBarUpdate method manually, since the onTick method is still called. In onTick I'm just checking whether the close price has changed since the last call which would be the definition of a bar update.

1767630532351.png

But the values of the DataSeries are always zero:

1767630562251.png

Does someone else have this behavior? dataContext.getDataSeries().getClose() used to get the latest close price, this always worked!! But not anymore. I also tried getting the DataSeries of a specific barSize (the same of the chart where I use the study. I know if using a different barSize than the one set in the chart never really worked) but still, zero!

UPDATE:

It gets even weirder.. I now used tick.getPrice() instead of getting it from the DataContext. The var previousClose is just a float field of my study.

1767631301397.png

There is now a value for the currentClose but the log output gives:

1767631431950.png

previousClose = currentClose has no effect! On every call the previousClose var is zero. I always used study fields like this, but apparently since Motivewave 7 this is no longer possible.
 
Last edited:
I have several studies using onBarUpdate() in MW 7 without a problem.

Attached you will find a demo study that I have set up for myself to understand all the major lifecycle events in MW studies and when they fire. Maybe you could compile this yourself and check the output. This is how the debug log looks for me:

1767637282590.png
 

Attachments

On a side note, I found the study log confusing and unreliable sometimes. For better time sensitive logging you could replace the debug() calls with System.out.println() and then tail the file logs on the console (these are located at ~/Library/MotiveWave/output on a Mac, Windows I don't know).
 
Ok thanks a lot! I also see the logs. I guess there is an error when initializing my study and it is never fully loaded. I noticed, that the name of my study never appeared in the chart to be clickable to open its settings. I just thought that this would be because of changes in the structure with templates and so on. I will check all my code again. It was working for years, so something must have changed with the new version.
 
Maybe check the file logs for exceptions as mentioned above, some of the errors never appear in the study log
 
Thanks for all of your comments! I had some NullPointerExceptions when the study was initialized. A warning sign is, if the study name does not appear in the chart, then something went wrong.

The reason for the exceptions was that since Motivewave 7 the DataSeries is not available anymore as early as it was in version 6. It used to be available in the onLoad lifecycle method, but apparently it is no longer.

Another issue that I could not fix yet in the new version (and it was always problematic as far as I remember) is to get DataSeries of bar sizes other than the chart bar size. But I will open another thread for that.
 
Top