PDA

View Full Version : time and sales script


euroventure
02-16-2010, 01:57 PM
where can I locate the time and sales ninja script

NinjaTrader_Austin
02-16-2010, 02:02 PM
euroventure, I'm not exactly sure what you're asking for, but you can get to the NinjaTrader Time & Sales window from File -> New -> Time and Sales.

euroventure
02-16-2010, 02:53 PM
thank you for the reply austin,

I am looking for the ninja trader script ( code ) that creates the time and sales

NinjaTrader_Austin
02-16-2010, 03:02 PM
There isn't a specific script that prints out the time and sales, but this would do the trick:

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);
}
}

matthiasho
10-04-2011, 09:54 PM
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

NinjaTrader_AdamP
10-05-2011, 08:26 AM
matthiasho,

Are you perhaps using multiple data series in your indicator?

Directly from the help guide for OnMarketData() (http://www.ninjatrader.com/support/helpGuides/nt7/index.html?onmarketdata.htm)

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)

For more information on BarsInProgress, please see this link (http://www.ninjatrader.com/support/helpGuides/nt7/index.html?barsinprogress.htm).

matthiasho
10-05-2011, 06:01 PM
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!

NinjaTrader_Bertrand
10-06-2011, 02:09 AM
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,

matthiasho
10-07-2011, 12:35 AM
hi the indicator is not running double. I only apply it to 1 chart

how to send source code to ninjatrader dot com?

????@ninjatrader.com

Thanks

NinjaTrader_Bertrand
10-07-2011, 02:37 AM
Thanks Matthias, please email us at "support at ninjatrader dot com" with a reference to this thread here.