Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Updated July 10, 2015
Top Posters
looks_one
Big Mike
with 4 posts (2 thanks)
looks_two
Laurus12
with 2 posts (0 thanks)
looks_3
Jura
with 1 posts (1 thanks)
looks_4
DrQuantTrader
with 1 posts (0 thanks)
trending_up
6,701 views
thumb_up
3 thanks given
group
2 followers
forum
8 posts
attach_file
0 attachments
August 12th, 2011, 02:26 AM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,751 since Jun 2009
Thanks Given: 33,473
Thanks Received: 102,390
This should be easy, but I've just spent an hour trying to do it. I know the answer is obvious... but you know how sometimes you just can't see it.
I simply want to know what the Last trade volume was, as in the Last tick, what was the volume traded at that price. I need to know this intrabar.
Help?
@Jura , @SPMC , @Laurus12 to the rescue? Others?
Mike
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
August 12th, 2011, 02:36 AM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,751 since Jun 2009
Thanks Given: 33,473
Thanks Received: 102,390
Have tried this among 100 other things:
Code
vars: _lastvol ( 0 ), intrabarpersist _lastvolpersist ( 0 ); _lastvolpersist = volume ; _lastvol = volume ; print( text ( "Volume[0] = " , Volume [ 0 ], ", _lastvol = " , _lastvol , ", lastvol[1] = " , _lastvol [ 1 ], ", _lastvolpersist[0] = " , _lastvolpersist [ 0 ]));
Sample output:
Code
Volume[0] = 123.00, _lastvol = 123.00, lastvol[1] = 137.00, _lastvolpersist[0] = 123.00
Volume[0] = 123.00, _lastvol = 123.00, lastvol[1] = 137.00, _lastvolpersist[0] = 123.00
Have tried all the math, nothing accurately reports the last trade size.
Mike
August 12th, 2011, 05:29 AM
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690
Hm, good question Mike.
After some puzzling this seems (with the emphasize on seems) to work:
Quoting
1110131_121037 LastVol: 1 regularVol: 223 prevVol: 399
1110131_121039 LastVol: 8 regularVol: 231 prevVol: 399
1110131_121042 LastVol: 1 regularVol: 232 prevVol: 399
1110131_121044 LastVol: 6 regularVol: 238 prevVol: 399
1110131_121102 LastVol: 2 regularVol: 240 prevVol: 399
1110131_121110 LastVol: 1 regularVol: 241 prevVol: 399
1110131_121132 LastVol: 2 regularVol: 243 prevVol: 399
1110131_121134 LastVol: 1 regularVol: 244 prevVol: 399
1110131_121143 LastVol: 4 regularVol: 248 prevVol: 399
1110131_121151 LastVol: 4 regularVol: 252 prevVol: 399
1110131_121222 LastVol: 16 regularVol: 268 prevVol: 399
1110131_121238 LastVol: 2 regularVol: 270 prevVol: 399
1110131_121259 LastVol: 4 regularVol: 4 prevVol: 270
1110131_121300 LastVol: 3 regularVol: 7 prevVol: 270
1110131_121304 LastVol: 1 regularVol: 8 prevVol: 270
1110131_121310 LastVol: 3 regularVol: 11 prevVol: 270
1110131_121314 LastVol: 7 regularVol: 18 prevVol: 270
1110131_121320 LastVol: 9 regularVol: 27 prevVol: 270
1110131_121344 LastVol: 12 regularVol: 39 prevVol: 270
1110131_121352 LastVol: 5 regularVol: 44 prevVol: 270
1110131_121402 LastVol: 2 regularVol: 46 prevVol: 270
1110131_121428 LastVol: 8 regularVol: 54 prevVol: 270
1110131_121428 LastVol: 5 regularVol: 59 prevVol: 270
1110131_121434 LastVol: 2 regularVol: 61 prevVol: 270
1110131_121520 LastVol: 3 regularVol: 64 prevVol: 270
1110131_121520 LastVol: 1 regularVol: 65 prevVol: 270
Code
vars : intrabarpersist lastVolume ( 0 ), intrabarpersist volumeLastTrade ( 0 ); once cleardebug ; lastVolume = volume - volumeLastTrade ; volumeLastTrade = volume ; if lastVolume > 0 then begin // needed because my playback data has ticks with zero volume, somehow Print( date : 0 : 0 , "_" , time_s : 0 : 0 , Spaces ( 2 ), "LastVol: " , NumToStr ( lastVolume , 0 ), // volume of last tick update " regularVol: " , NumToStr ( Volume , 0 ), // current volume of the bar, at this point " prevVol: " , NumToStr ( Volume [ 1 ], 0 )); // this will plot the volume from the *close* of the previous bar end ; if BarStatus ( 1 ) = 2 then begin lastVolume = 0 ; volumeLastTrade = 0 ; end ;
August 12th, 2011, 12:03 PM
Norway
Experience: Advanced
Platform: MultiCharts, CQG, NinjaTrader
Broker: CQG, DTN IQFeed
Trading: EURO
Posts: 376 since Nov 2010
Thanks Given: 566
Thanks Received: 363
Mike. Sorry, but this is now over my head. I'll try to learn something while you guys go forward.
Just so I am sure, did you see my last reply from Curtis ?
Laurus
“If you wish to see the truth, then hold no opinions for or against anything.” - Hsin Hsin Ming
August 12th, 2011, 12:05 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,751 since Jun 2009
Thanks Given: 33,473
Thanks Received: 102,390
I received this from Dave @ MultiCharts . Haven't had a chance to test.
Code
var:
tick_vol ( 0 ),
curr_vol ( 0 ),
intrabarpersist tick_num ( 0 ),
intrabarpersist prev_vol ( 0 );
curr_vol = ticks ;
tick_vol = curr_vol - prev_vol ;
tick_num += 1 ;
once cleardebug ;
if lastbaronchart then
print( "Bar = " , currentbar , spaces ( 2 ), "Tick = " , tick_num ,
spaces ( 2 ), "Last tick volume = " , tick_vol );
prev_vol = curr_vol ;
if barstatus = 2 then tick_num = 0 ;
I see both of you used "cleardebug", I am unfamiliar with that and will need to check it out.
Mike
August 12th, 2011, 12:07 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,751 since Jun 2009
Thanks Given: 33,473
Thanks Received: 102,390
Big Mike
I see both of you used "cleardebug", I am unfamiliar with that and will need to check it out.
Clears output log. Cool.
Mike
August 12th, 2011, 12:22 PM
Norway
Experience: Advanced
Platform: MultiCharts, CQG, NinjaTrader
Broker: CQG, DTN IQFeed
Trading: EURO
Posts: 376 since Nov 2010
Thanks Given: 566
Thanks Received: 363
Big Mike
Clears output log. Cool.
Mike
Except from that I am now behind, this is very exciting. I'll step back and watch
Edit: And thank you for the clarification on the "Tells"
“If you wish to see the truth, then hold no opinions for or against anything.” - Hsin Hsin Ming
July 10th, 2015, 11:48 AM
Houston, TX
Posts: 8 since Feb 2015
Thanks Given: 3
Thanks Received: 0
Big Mike
Clears output log. Cool.
Mike
Laurus12
Except from that I am now behind, this is very exciting. I'll step back and watch
Edit: And thank you for the clarification on the "Tells"
Hello Mike, Laurus:
Did the above code work for you? If so, would you be so kind as to post a sample output chart?
Many thanks!
Last Updated on July 10, 2015