API Support Forum
OEC API > API Support > Momentum bar Subscription and data calculation
Author Topic: Momentum bar Subscription and data calculation
(2 messages, Page 1 of 1)
Moderators: VPfau
SSprikut637
Posts: 12
Joined: Apr 04, 2011


Posted: Aug 06, 2012 @ 09:24 AM             Msg. 1 of 2
Hello, Ruslan!
You've kindly addressed my previous question. My developer asked me to post another clarification pertaining to Momentum Bar calculations.
Thank you in advance for your prompt response.

Here is his question:
========
I am subscribing to momentum Bar via method :
Subscription s = oec.SubscribeBars(oec.Contracts[Contract], 30, barType, interval, false);
where,
Contract="ESM2"
barType="MomentumBar"
interval=4


I get 30 Bars in count with last Bar for e.g like.:


like Open =1331, high=1331,low=1330,close=1330 for 4 ticks (after 30 bars, I start getting bars each fraction of second)
then the next Bar should be
1. Open=1329.75 as Last close was with Low Price
2. Difference between High and Low should be 4 ticks
for e.g. High=1332 and low=1331
3. And Close= either 1332 or 1331
Then I wait for the next Bar.Let the last close was 1332 i.e at High Price
Then I wait for the Bar whose:
1. Open Price should be 1332.25
2. Diff B/w High and low shoukd be 4 ticks
3. And Close Price should be either equal to High Price or Low Price
But what happens here:
Since I was waiting for the Bar whose Open should be 1332.25 , It does not go with my expectation and new Bar start coming like this:

Open=1332 High=1332.25 Low=1331.25 close=1331.25
then next Bar

Open=1331.75 High=1331.75 low=1330.75 Close=1330.75
then Next Bar

Open=1330.75 High=1331.50 low=1330.50 Close=1330.50
and so On

Remember we were expecting for the new Bar with open Price =1332.25
but if price action reverses, instead of getting Bars with Open Price moving upward like 1332.25 I start getting Bars with Open Price moving downward like 1332,1331.75,1330.75
And This is the point where we Stop getting the expected Bar while momentum Bar is building on the platform (Tradestation) chart successfully while we are stuck in the application waiting for the expected Valid Bar.
Can you please help me on how to handle such data for Momentum Bar in my application or Is there any other way of getting the Valid Bars likewise we are getting in the Tradestation..???
===========
Sergey Sprikut

Sergey Sprikut
SSprikut637
Posts: 12
Joined: Apr 04, 2011


Posted: Aug 06, 2012 @ 10:20 AM             Msg. 2 of 2
My previous post was addressed to Ruslan. Not sure if he is available, so I'd appreciate if i get clarification for the question I've posted earlier. Thank you very much for your support.
===
My developer asked me to post another clarification pertaining to Momentum Bar calculations.
Thank you in advance for your prompt response.

Here is his question:
========
I am subscribing to momentum Bar via method :
Subscription s = oec.SubscribeBars(oec.Contracts[Contract], 30, barType, interval, false);
where,
Contract="ESM2"
barType="MomentumBar"
interval=4


I get 30 Bars in count with last Bar for e.g like.:


like Open =1331, high=1331,low=1330,close=1330 for 4 ticks (after 30 bars, I start getting bars each fraction of second)
then the next Bar should be
1. Open=1329.75 as Last close was with Low Price
2. Difference between High and Low should be 4 ticks
for e.g. High=1332 and low=1331
3. And Close= either 1332 or 1331
Then I wait for the next Bar.Let the last close was 1332 i.e at High Price
Then I wait for the Bar whose:
1. Open Price should be 1332.25
2. Diff B/w High and low shoukd be 4 ticks
3. And Close Price should be either equal to High Price or Low Price
But what happens here:
Since I was waiting for the Bar whose Open should be 1332.25 , It does not go with my expectation and new Bar start coming like this:

Open=1332 High=1332.25 Low=1331.25 close=1331.25
then next Bar

Open=1331.75 High=1331.75 low=1330.75 Close=1330.75
then Next Bar

Open=1330.75 High=1331.50 low=1330.50 Close=1330.50
and so On

Remember we were expecting for the new Bar with open Price =1332.25
but if price action reverses, instead of getting Bars with Open Price moving upward like 1332.25 I start getting Bars with Open Price moving downward like 1332,1331.75,1330.75
And This is the point where we Stop getting the expected Bar while momentum Bar is building on the platform (Tradestation) chart successfully while we are stuck in the application waiting for the expected Valid Bar.
Can you please help me on how to handle such data for Momentum Bar in my application or Is there any other way of getting the Valid Bars likewise we are getting in the Tradestation..???
===========
Sergey Sprikut

Sergey Sprikut