NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 12-11-2008, 04:01 AM   #1
fle__
Member
 
Join Date: Sep 2008
Posts: 41
Thanks: 0
Thanked 0 times in 0 posts
Default Above ask / Below bid

Just a quick question, as I can't find the answer in the forum.
I want to recognize above ask or below bid transactions, and plot dots on a tick chart to highlight the bar where it occur.

Modifying the BuySellVolume indicator, I test for before last tick size = before last ask size, and current price above last price (to recognise an above ask transaction).
But when comparing with T&S, it does not match.

My question : am I testing it the right way ? is it logically correct ?

PS : if you don't mind added a few word regarding the role of arraylist alBuy and alSell. In what are they usefull ?

Thank you for your answer

Code:
            if (firstPaint)
                firstPaint = false;
            else
            {
                double tradeVol = previousVol == 0 ? Volume[0] : Volume[0] - previousVol;
                if (Close[0] >= GetCurrentAsk() && tradeVol >= minTradeVol)
                {
                    buys += tradeVol;
                    if(previousVol == previousAskVol && Close[0] > previousAsk)
                        Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Above Ask", "Alert2.wav", 1, Color.Black, Color.Yellow);
                    if(tradeVol >= minBigVol && !Historical)
                        DrawDot("BigVol" + CurrentBar.ToString(), true, 0, Close[0], Color.LimeGreen);
                }
                else if (Close[0] <= GetCurrentBid() && tradeVol >= minTradeVol) 
                {
                    sells += tradeVol;
                    if(previousVol == previousBidVol && Close[0] < previousBid)
                        Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Below Bid", "C:\\WINDOWS\\Media\\Windows XP Ding.wav", 1, Color.Black, Color.Yellow);
                    if(tradeVol >= minBigVol && !Historical)
                        DrawDot("BigVol" + CurrentBar.ToString(), true, 0, Close[0], Color.Red);

                }
            }

            previousVol = Volume[0];
            previousAsk = GetCurrentAsk();
            previousBid = GetCurrentBid();
            previousAskVol = GetCurrentAskVolume();
            previousBidVol = GetCurrentBidVolume();
fle__ is offline  
Reply With Quote
Old 12-11-2008, 05:36 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,403
Thanks: 252
Thanked 972 times in 955 posts
Default

Hi fle,

Welcome to the NinjaTrader forum, you might want to dive into this discussion here - http://www.ninjatrader-support2.com/...ead.php?t=4231

I believe it answers some of your questions how to approach your project.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 12-11-2008, 07:59 AM   #3
fle__
Member
 
Join Date: Sep 2008
Posts: 41
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you for your prompt answer. This link is indeed very interesting.

But I'm afraid it does not answer my main concern, regarding how I can spot above bid or below ask condition.
like if I test for
"before last" ticksize = "before last" asksize, and last price above "before last" price
means that it is an above ask transactions ?
Regards
fle__ is offline  
Reply With Quote
Old 12-11-2008, 08:17 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,403
Thanks: 252
Thanked 972 times in 955 posts
Default

Hi fle__,
I guess with TickSize you mean the volume / transactions occured on the last tick. Best would be to debug your logic and watching the times and sales window for confirmation, then you know when you are on the right track.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 12-11-2008, 08:20 AM   #5
fle__
Member
 
Join Date: Sep 2008
Posts: 41
Thanks: 0
Thanked 0 times in 0 posts
Default

OK, thank you
fle__ is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BID/ASK Indicator Christoph Indicator Development 10 07-08-2009 06:53 AM
plot last ask/bid junkone Indicator Development 3 09-24-2008 06:50 AM
how to plot bid and ask junkone Charting 1 09-22-2008 04:06 AM
Bid Ask data rt-trader Market Analyzer 2 11-23-2007 03:22 PM
Bid / Ask Toad Automated Trading 1 06-01-2006 12:13 AM


All times are GMT -6. The time now is 10:34 AM.