#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 NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
65 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
139 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
75 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
50 views
0 likes
|
Last Post
|
Comment