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 > Indicator Development

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

Reply
 
Thread Tools Display Modes
Old 07-12-2007, 06:08 PM   #1
shawnj
Senior Member
 
Join Date: Jan 2005
Location: , ,
Posts: 218
Thanks: 0
Thanked 0 times in 0 posts
Default Average Trade

I'm trying to develop an indicator to use in a Market Analyzer that simply will display the average trade in the contract's native currency. Using the column names in Market Analyzer that would be Realized PnL divided by Traded Contracts. With posibly having an input option to include Unrealized PnL.

If I use Performance.AllTrades.Count I get the following error:
"The name Performance does exisit in the current context."

So a couple of questions if I may:

1) How do I get rid of this error?

2) Is this the proper formula to get what I'm looking for:
Performance.AllTrades.Performance.Currency.CumProf it/Performance.AllTrades.Count

3) The best I can tell the code completion (the drop down list after typing a ".") does not seem to work?

4) Is there no F1 help? I would assume I could click on the word Performance and hit F1 and go to some help that would explain everything Performance can do and how to use it.

5) Where is there some help explaining everything Performance can do.

6) Are there any special coding tips for indicators that are just going to be used in Market Analyer?

7) Is there some way to set up the indicator such that it only updates anytime a trade is completed instead of tick-by-tick (or bar-by-bar)?

Here is what I've got:

[Description("Realized PL / Total Trades")]
[Gui.Design.DisplayName("aaAvg Trade")]
public class aaAvgTrade : Indicator
{
#region Variable;
double avgTrade;
#endregion

protected override void Initialize()
{
avgTrade=0.0;
Add(new Plot(Color.Orange, PlotStyle.Line, "AvgTrade"));
CalculateOnBarClose = false;
Overlay = false;
PriceTypeSupported = false;
}

protected override void OnBarUpdate()
{
avgTrade = Performance.AllTrades.Count;

if (avgTrade != 0)
avgTrade =
Performance.AllTrades.Performance.Currency.CumProf it / avgTrade;

AvgTrade.Set(avgTrade);
}
shawnj is offline  
Reply With Quote
Old 07-12-2007, 06:44 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

The Performance object is not available in the Indicator class. There is no currently supported approach to get what you want done.

4) Context sensitive help within NinjaScript Editor is not supported.

6) Nothing that I can think of.

7) Not at this time.
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-13-2007, 12:38 PM   #3
shawnj
Senior Member
 
Join Date: Jan 2005
Location: , ,
Posts: 218
Thanks: 0
Thanked 0 times in 0 posts
Default

Then could I make a request to add "Average Trade" to the column choices in Market Analyzer?
shawnj is offline  
Reply With Quote
Old 07-13-2007, 02:08 PM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Will put this on our list for future enhancement consideration.
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-14-2007, 09:25 AM   #5
shawnj
Senior Member
 
Join Date: Jan 2005
Location: , ,
Posts: 218
Thanks: 0
Thanked 0 times in 0 posts
Default

If you happen to consider it further, this would be the round turn average trade so using the column names of Market Analyzer it would be:

Realized PnL / ( Traded Contracts * 0.5 )
shawnj 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
Moving average of Pivot points nightowl Charting 3 07-01-2008 02:19 PM
Time of Day Average Volume ClayB1 Indicator Development 5 06-26-2007 07:00 AM
deleting spurious trade from sim trade list Arbitrageur Miscellaneous Support 2 09-12-2006 03:59 AM
IB Changing Average Cost Field SellUmHi Connecting 1 01-05-2006 02:32 AM
Average prices on super-dom? cody Miscellaneous Support 5 02-27-2005 08:00 AM


All times are GMT -6. The time now is 01:56 PM.