Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
time and sales script
Collapse
X
-
Tags: None
-
time and sales
thank you for the reply austin,
I am looking for the ninja trader script ( code ) that creates the time and sales
Comment
-
There isn't a specific script that prints out the time and sales, but this would do the trick:
Code:protected override void OnMarketData(MarketDataEventArgs e) { // Print some data to the Output window if (e.MarketDataType == MarketDataType.Last) { string msg = e.Price.ToString() + "\t" + e.Volume.ToString(); Print(msg); } }
AustinNinjaTrader Customer Service
Comment
-
Hi thanks for the sample code, which I expanded:
protected override void OnMarketData(MarketDataEventArgs e)
{
// Print some data to the Output window
if (e.MarketDataType == MarketDataType.Last)
{
string msg = "Last traded is" + e.Price.ToString() + "\t" + e.Volume.ToString();
Print(msg);
}
else if (e.MarketDataType == MarketDataType.Bid)
{
string msg = "Bid is " +e.Price.ToString() + "\t" + e.Volume.ToString();
Print(msg);
}
else if (e.MarketDataType == MarketDataType.Ask)
{
string msg = "Ask is" +e.Price.ToString() + "\t" + e.Volume.ToString();
Print(msg);
}
}
Question is : Why am I seeing duplicates? I thought OnMarketData is triggered only when there is a Lvl 1 change in bid, ask, last or its corresponding change volume?
e.g.
Bid is 8400 73
Ask is 8405 125
Bid is 8400 73
Ask is 8405 125
Comment
-
matthiasho,
Are you perhaps using multiple data series in your indicator?
Directly from the help guide for OnMarketData()
With multi-time frame and instrument strategies, OnMarketData() will be called for all unique instruments in your strategy. Use the BarsInProgress to filter the OnMarketData() method for a specific instrument. (BarsInProgress will return the first BarsInProgress series that matches the instrument for the event)Adam P.NinjaTrader Customer Service
Comment
-
Dear Adam.
No, I am not using multiple data series in my indicator.
Just pure and simple like the codes I provided.
In fact there isnothing in the Onbarupdate.
If you provide me with yr email, I can mail you my source code for you to take a look.
Thanks!
Comment
-
matthiasho, could it perhaps simply be the script is running double, i.e on another chart or workspace as well as you check the output window? If you would like us to take a look at the source, please send to support at ninjatrader dot com with a reference to this thread here.
Thanks,BertrandNinjaTrader Customer Service
Comment
-
hi the indicator is not running double. I only apply it to 1 chart
how to send source code to ninjatrader dot com?
[email protected]
Thanks
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by mangel2000, Today, 01:30 AM
|
0 responses
2 views
0 likes
|
Last Post
by mangel2000
Today, 01:30 AM
|
||
Started by Doxxxx, Today, 01:24 AM
|
0 responses
3 views
0 likes
|
Last Post
by Doxxxx
Today, 01:24 AM
|
||
Started by ezekilany, Today, 01:10 AM
|
0 responses
3 views
0 likes
|
Last Post
by ezekilany
Today, 01:10 AM
|
||
Started by usjavaburn, Today, 12:59 AM
|
0 responses
3 views
0 likes
|
Last Post
by usjavaburn
Today, 12:59 AM
|
||
Started by heatherjmarshalls, Today, 12:56 AM
|
0 responses
2 views
0 likes
|
Last Post Today, 12:56 AM |
Comment