#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Gui.Tools;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.Gui.Tools;
#endregion
//This namespace holds Add ons in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.AddOns
{
public class MyCustomAddOn : NinjaTrader.NinjaScript.AddOnBase
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Add on here.";
Name = "MyCustomAddOn";
}
else if (State == State.Configure)
{
AddVolumetric(Instrument.FullName, BarsPeriodType.Range, 15, VolumetricDeltaType.BidAsk, 1);
AddDataSeries(Instrument.FullName, BarsPeriodType.Tick, 1);
}
}
}
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How can I use Volumetric and DataSeries in AddOns?
Collapse
X
-
How can I use Volumetric and DataSeries in AddOns?
I'm trying to share code between a strategy and indicator without having to duplicate it. It seems that AddOns is the way to do it. However, I can't seem to use them in AddOns.
Code:Tags: None
-
Hello tonystarks,
Is the indicator hosted by a host strategy? (Meaning does the strategy call the indicator and add the indicator to the chart with AddDataSeries())?
If not, typically we would recommend a partial class, however we would recommend a partial class separate for indicators than strategies. A partial class of NinjaScript may work, but you also may find not all objects and tools available to indicators and strategies are available.
Below is a link to an example of a partial class.
Explanation: I wrote a base class Indicator class that I'm using to inherit all my other indicators from. So this baseclass is defined as: namespace NinjaTrader.NinjaScript.Indicators.AssistedTrades { public class ATBaseIndicator: Indicator { ... } } And any other indicator is defined as: namespace NinjaTrader.NinjaScr
With a custom addon class that is not a partial class, you will not be able to add data series directly.
If you pass the instance of the indicator or strategy to a static addon method, you can use that instance to perform functions.
Chelsea B.NinjaTrader Customer Service
- Likes 1
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
476 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
317 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
254 views
1 like
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
340 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
306 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
Comment