NexusFi: Find Your Edge


Home Menu

 





Possible issue with Buy, sell, and net volume


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one ratfink with 8 posts (4 thanks)
    2. looks_two Cheech with 7 posts (4 thanks)
    3. looks_3 Cilla with 3 posts (2 thanks)
    4. looks_4 memonic with 3 posts (0 thanks)
    1. trending_up 4,796 views
    2. thumb_up 10 thanks given
    3. group 4 followers
    1. forum 22 posts
    2. attach_file 2 attachments




 
Search this Thread

Possible issue with Buy, sell, and net volume

  #11 (permalink)
 m20alberto 
sevilla España
 
Experience: Intermediate
Platform: Ninjatrader
Trading: indicadores
Posts: 26 since Mar 2016
Thanks Given: 2
Thanks Received: 7

Hello, a possible solution would be telling you that the previous candle close if the bid vol is "bearish" adds to the sales, and the vol. of ask subtracts purchases, and vice versa, according to the closing of the previous candle.
I'm not a programmer, can you code it for N8 ???? Thank you.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
What broker to use for trading palladium futures
Commodities
Trade idea based off three indicators.
Traders Hideout
 
  #12 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,426


m20alberto View Post
Hello, a possible solution would be telling you that the previous candle close if the bid vol is "bearish" adds to the sales, and the vol. of ask subtracts purchases, and vice versa, according to the closing of the previous candle.
I'm not a programmer, can you code it for N8 ???? Thank you.

There isn't really a problem needing a solution, only a misunderstanding.

I'm not currently working with NT8 but the code ideas are just the same, in the code I posted the 'buying' flag does what you suggest with a candle close, only tighter. I would think there are plenty of other correct NT8 solutions already out there, sorry I can't help more at this time.

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
  #13 (permalink)
 m20alberto 
sevilla España
 
Experience: Intermediate
Platform: Ninjatrader
Trading: indicadores
Posts: 26 since Mar 2016
Thanks Given: 2
Thanks Received: 7


I want to make a vol indicator, but I'm not a programmer, someone can help me ... I've been in the markets for years and I'm looking for a way to "know or approach" contracts that are not closed and that are stuck ... for N8

Reply With Quote
  #14 (permalink)
Cilla
Oxford UK
 
Posts: 10 since Apr 2019
Thanks Given: 4
Thanks Received: 5


ratfink View Post
No problem, you clarified a point I only covered indirectly anyway.

Thank you, Ratfink. I also have a question about onMarketData, but it's a little "involved" so might take me a while to work out a clear description of my issue - I'll put it as a separate post.

Reply With Quote
  #15 (permalink)
 Cheech 
Mesa, AZ/USA
 
Experience: Intermediate
Platform: NinjaTrader, ThinkorSwim
Broker: AMP Futures/CQG, TDA
Trading: Currency Futures, my Harley Davidson
Posts: 107 since Jun 2012
Thanks Given: 43
Thanks Received: 133


Cilla View Post
I think it would mean that the Price was somewhere between the Bid and the Ask, not that the Bid and Ask were the same.


I thought about some more after the post and realized I made an incorrect assumption that they would be equal and gave it more thought. There are a number of possible combinations of Bid$, Ask$, and Price tests, some of which I believe to be irrational. So, I changed the code to test for Bid = Ask just to see if that condition really occurred and although in the test that I ran the counts of that condition were in the minority (but did occur) the rest would fall into some other categories some of which would be the in between category you mentioned.

Knowing what I do now I will do individual tests for each of what I believe to be "rational" combinations while still counting the others and see what happens. If no counts show up in either the other category or what I tested as a rational combination then between the two at least I would have identified the "rational" combinations that could occur.

The next thing would to be determined what might be rules for counting the volume as either a buy or sell for each condition and see how it matches to what the NT code does now. I suspect that the only fall out would be the original issue of the Bid=Ask = Price condition, which although it does not happen frequently (at least with the ES), it does happen. For that condition I have no idea why one choice (buy vs. sell) would be more correct than the other.

Also, the test was using historical data (with tick replay) which may or may not be the same as the real time data, potentially a whole other issue.



*** Update ***

Just finished the additional combination tests. Checking again 30 days of tick replay data against the ES there were hits on 3 conditions; (1) Price equal ask and Price Greater than Bid, (2) Price Equal Bid and Price Less than Ask, and, (3) Price equal to both Bid and Ask.

Concerning the last condition of the 44,000 plus bars processed (unknown number of trades, there were only 85 hits with a volume of 9,907 against a total volume of 2.8 M, a very small percentage. I'll collect some data on real time trades but unless something is amiss I suspect it too will have a low percentage. With such a small percentage of hits I doubt NT will make any changes so unless something is radically off with the real time data I'll consider this issue closed.

Started this thread Reply With Quote
Thanked by:
  #16 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,426

@Cheech, @Cilla

As I just posted in another thread the point being missed is that the relative position of Ask and Bid is only relevant when the Last event occurs, regardless of how many times or where either or both of them move prior to the next Last event. Hence the need for local variable storage for correct handling.

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #17 (permalink)
 Cheech 
Mesa, AZ/USA
 
Experience: Intermediate
Platform: NinjaTrader, ThinkorSwim
Broker: AMP Futures/CQG, TDA
Trading: Currency Futures, my Harley Davidson
Posts: 107 since Jun 2012
Thanks Given: 43
Thanks Received: 133


ratfink View Post
@Cheech, @Cilla

As I just posted in another thread the point being missed is that the relative position of Ask and Bid is only relevant when the Last event occurs, regardless of how many times or where either or both of them move prior to the next Last event. Hence the need for local variable storage for correct handling.

Anything done in either my testing or the indicator was only on the Last event as I wasn't concerned what happened prior to that time.

Started this thread Reply With Quote
Thanked by:
  #18 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,426


Cheech View Post
Anything done in either my testing or the indicator was only on the Last event as I wasn't concerned what happened prior to that time.

Yes, I just checked and NT8 is giving you the e.Ask and e.Bid prices separately in the event so that makes sense, NT7 did not do that.

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
  #19 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,426

@Cheech, @Cilla

Thinking more about this issue it would seem that we are missing the time precedence factor, such that in the case where Bid = Ask = Price is *really* seen, then it must be the most recent event change that takes precedence (i.e. whichever of Bid or Ask changed right before the Last event. That should take the arbitrary factor out of the volume allocation that you have seen.

As such the NT8 OMD interface cannot be used in its object form (with e.Bid and e.Ask delivered concurrent with the 'Last' event e.Price) and it must be used in the old NT7 manner with a new precedence flag needed for both versions. (Here I am assuming that NT8 does also deliver separate events for Bid and Ask as well as Last in the same way as NT7.)

It may of course just be a historical data artefact (which NT8 was supposed to correct with millisecond timestamping since NT7 is flawed in both Historical and Market Replay modes for Bid/Ask behaviour).

However this NT8 caveat:

Prevents this issue being addressed in Tick Replay mode anyway, since we cannot separate the order of Ask and Bid arrival - end of story.

Regardless of historical data issues the time precedence should be usable in NT7 and NT8 in live running, although in the grand scheme I agree it is not likely to be a big deal, but it is more interesting than I first thought.

Cheers

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #20 (permalink)
 memonic 
Jaén Spain
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Emini ES
Posts: 8 since Aug 2017
Thanks Given: 10
Thanks Received: 0



Cheech View Post
Anything done in either my testing or the indicator was only on the Last event as I wasn't concerned what happened prior to that time.

Hi Cheech
thanks for your indicator. I would like to use in strategy backtesting with Tick replay. Nt8 ask me an erro "on state change"

fpgBuySellNetVolume_V21 = fpgBuySellNetVolume_V2(Close, fpgBuySellNetVolumeMAsType.EMA, 15, 50, 0, fpgBuySellNetVolumeMAsSmoothType.SMA, 5, 0, 0);

Do you know where could be the error.
thanks in advance

Reply With Quote




Last Updated on July 12, 2019


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts