NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 06-18-2009, 08:57 AM   #1
TheChingachgook
Member
 
Join Date: Aug 2008
Posts: 59
Thanks: 0
Thanked 0 times in 0 posts
Default Premarket GetCurrentBid() GetCurrentAsk()

[IMG]file:///C:/DOCUME%7E1/Benutzer/LOCALS%7E1/Temp/moz-screenshot.jpg[/IMG]I have a problem with the Bid/Ask prices in the premarket phase.

I try to scan for gappers during the premarket phase. if you look at the attachment you can see, that in the marketAnalyzer is a valid Bid/AskPrice.

If I want to get access of the bid/askPrice in an Indicator the GetCurrentBid() and GetCurrentAsk() are delivering another value like the MarketAnalyzer.

Then I found out, that there exists a MarketData-member, where the prices are correct. But when the the indicator is used in the MarketAnalyzer the MarketData-member is null ... and the GetCurrentBid() and GetCurrentAsk() are delivering again the wrong values

does anybody know how I could get access to the right Bid/Ask values in the MarketAnalyzer during the premarket phase?

Many thanks for you help in advance.

TheChingachgook is offline  
Reply With Quote
Old 06-18-2009, 09:04 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Please provide the line of code you are using for your print statement and in which method it was placed in. Thank you.
NinjaTrader_Josh is offline  
Reply With Quote
Old 06-18-2009, 09:25 AM   #3
TheChingachgook
Member
 
Join Date: Aug 2008
Posts: 59
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi Josh

Thank you for your quick reply ... here is the code line.

This problem only occures in the premarket phase - if you try it during market hours the values are correct

if ( MarketData != null )
Print ( Instrument.MasterInstrument.Name + "; GetCurrentAsk(): " + GetCurrentAsk() + "; GetCurrentBid(): " + GetCurrentBid()
+ "; MarketData.Bid.Price: " + MarketData.Bid.Price + "; MarketData.Ask.Price: " + MarketData.Ask.Price
+ "; " + Time[0].Year + "." + Time[0].Month + "." + Time[0].Day );
TheChingachgook is offline  
Reply With Quote
Old 06-18-2009, 09:26 AM   #4
TheChingachgook
Member
 
Join Date: Aug 2008
Posts: 59
Thanks: 0
Thanked 0 times in 0 posts
Default

oops .. this call happens in the OnBarUpdate()-event
TheChingachgook is offline  
Reply With Quote
Old 06-18-2009, 09:30 AM   #5
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Can you please try this inside OnMarketData and use the MarketDataEventArgs?
NinjaTrader_Josh is offline  
Reply With Quote
Old 06-18-2009, 09:34 AM   #6
TheChingachgook
Member
 
Join Date: Aug 2008
Posts: 59
Thanks: 0
Thanked 0 times in 0 posts
Default

OK - thank you for this hint - since the market is running now I will try it tomorow
TheChingachgook 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
GetCurrentBid/Ask on Multiple Instruments SystemTrading General Programming 2 11-06-2008 08:57 AM
GetCurrentAsk Question through NT beauw Automated Trading 17 10-06-2008 08:10 AM
GetCurrentAsk Multi time nigeleyre Strategy Development 4 10-02-2008 12:39 PM
GetCurrentBid/Ask SystemTrading Miscellaneous Support 1 08-20-2008 01:19 PM
NT hangs on GetCurrentBid/Ask? ATI user Indicator Development 5 10-09-2007 05:19 AM


All times are GMT -6. The time now is 10:45 PM.