Retrieve Bid/Ask Data from DataSeries

eickeee

Member
Joined
Aug 26, 2022
Posts
9
Likes
2
Hey,

in the calculate() method I get access to the DataContext which also allows me to request other DataSeries than selected for the chart. May someone help me to retrieve the bid/ask values for particular prices from the data series? In the JavaDoc I cannot find an appropriate methods.

Thanks!

1661538255250.png
 

eickeee

Member
Joined
Aug 26, 2022
Posts
9
Likes
2
Thanks for your reply, @Spin !

I saw those mentioned function from you and while this would give me a functionality to access some parts (OLHC) of a bid/ask "candle" there will be parts missing (see the pic below), for the other prices that do not fit the criteria. Does this make sense or am I missing something? 🤔

Another option probably would be to override onTick() and then build it up myself 🤔

Thanks!

1661593194715.png
 

Spin

Well-known member
Joined
May 22, 2019
Posts
477
Likes
191
I'm afraid you're a little bit too fast for me there, @eickeee 😁


What exactly have you coded ? (you changed a few lines in an existing Study, right ?) And what was the expected result ?

And -more to the point- what do you think you are missing ?
 

eickeee

Member
Joined
Aug 26, 2022
Posts
9
Likes
2
Hey, sorry for that 😁

What I want to do:
  • Use the information of a bid/ask or delta chart (comes via volume inprint study in MV) and create a study/signal from the data
  • For this I'd need to be access not just the OLHC data of the bar but more fine granular data - bid ask data for each tick level.
As far as I studied the API this is not possible in a comfortable way. What I found out, though, is that I could request tick data from a DataSeries and there get more details for bid/ask data. Something like this:

Code:
DataSeries dataSeries = dataContext.getDataSeries();
List<Tick> ticks = dataSeries.getInstrument().getTicks(
    dataSeries.getStartTime(idx),
    dataSeries.getEndTime(idx)
);

// now I can use methods like tick.isAskTick() or tick.getVolume() and create my own data structure that represents the bid/ask chart I initially wanted

But if someone knows a easier way I am all hears - I do not have to reinvent the wheel if not necessary 😅
 

Spin

Well-known member
Joined
May 22, 2019
Posts
477
Likes
191
I think you are on the right track.

However: I glanced over the VolumeImprint-Study and in onTick (line 1720 and following), I think you can get that granular data, and write it to the 'normal' dataseries (and use it somewhere else after that)

1661691101323.png



You could also do a check "isAskTick" and run parts of code depending the result:
Java:
@Override
    public void onTick(Tick tick)
    {
      if (tick.getTime() < start) return;
      if (tick.getTime() >= end) {
        series.setComplete(ind); // Note: if this is the current unfinished bar, the bar will not be set to complete
        ind++;
        updateNextInterval();
      }

      // lines added by Spin
      if (tick.isAskTick()){
        //run some code
         }
        else {
        // run other code
      }

        double tickAskSize = tick.getAskSize();
        series.setDouble(tickAskSize, Values.tickAskSize);
      // end lines added by Spin
   
      vp.onTick(tick);
    }


I only briefly checked, but perhaps you could test some more to see if that works ? :)
 
Last edited:

eickeee

Member
Joined
Aug 26, 2022
Posts
9
Likes
2
I glanced over the VolumeImprint-Study and in onTick (line 1720 and following)
Ohh, how did you do that? Would love to see how they are doing it 😁 Did you decompile one of their jars? 😬

And you are right that onTick() would be necessary for realtime while calculate() serves me with an option for historic data as well as when a bar is completed.
I for now thought that I'll just reside to calculate() and then update my signal/study whenever a bar was finished because it's enough for the scenario I have in mind.

But thanks already for your support, really appreciated 🙌
 

Spin

Well-known member
Joined
May 22, 2019
Posts
477
Likes
191
Glad to be of service :)

Some additional info: I did not need to decompile the .jar: it is (or was ? :unsure:) in the 275 'standard Studies' you can download from the SDK-page:
https://www.motivewave.com/support/sdk.htm

And that popup-window I got in IntelliJ (their coding-assistance modules are simply unequaled imo :LOL:)


EDIT: The 275 Studies are still downloadable here:
https://drive.google.com/file/d/1sXsxGFl233-u2wb67fyy5edvZc13eFvI/view

The SDK programming guide offers all the info you need to create your own Studies / Strategies. It is however not for the faint of heart :)
 
Last edited:

Ulfheoynn

Member
Joined
Sep 22, 2022
Posts
7
Likes
1
Hello @Spin ,

I searched for the Imprint Study in the folder but can't seem to find it. I would be grateful if you could precise the name.

Thank you.
 

Spin

Well-known member
Joined
May 22, 2019
Posts
477
Likes
191
It seems that you are right, @Ulfheoynn : it is indeed no longer present in that bundle. That must mean MW decided to no longer make the code public.

Most of the 'Study-help'-pages on the MW site have the phrase 'Study might be available on request', so perhaps a mail to support@motivewave.com might help ? :)
 

sebinho

Member
Joined
Nov 19, 2022
Posts
11
Likes
3
It seems that you are right, @Ulfheoynn : it is indeed no longer present in that bundle. That must mean MW decided to no longer make the code public.

Most of the 'Study-help'-pages on the MW site have the phrase 'Study might be available on request', so perhaps a mail to support@motivewave.com might help ? :)
Hey Spin,
I did contact Motivewave some time ago to get access to those orderflow studies but they are not willing to share it anymore. Would you be able to share them with me? Thanks a lot

I am currently building studies/strategies using the Ontick() function and I am encountering some issues...so any examples would be very helpful
 
Top