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
New NinjaScript NT8
Collapse
X
-
Hello,
You can create a NinjaScript Editor by going to New> NinjaScript Editor. There have been changes made to the NinjaScript Editor I would recommend to review the following link: http://ninjatrader.com/support/helpG...us/editor.htm\
I would also recommend reviewing the Code Breaking Changes at the following link: http://ninjatrader.com/support/helpG...ng_changes.htmCody B.NinjaTrader Customer Service
-
//This namespace holds Indicators in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators
{
public class Aindicator : Indicator
{
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "Aindicator";
Calculate = Calculate.OnBarClose;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
AddPlot(Brushes.Orange, "Test1");
}
else if (State == State.Configure)
{
}
}
protected override void OnBarUpdate()
{
PlotBrushes[0][0] = Brushes.Green;
}
Comment
-
Hello,
In your code you have not set the plot to anything.
To set the plot you will need to set the Value for the plot.
For example the following would set the plot to the close of the current bar plus two ticks:Code:protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Strategy here."; Name = "MyCustomStrategy1"; Calculate = Calculate.OnBarClose; EntriesPerDirection = 1; EntryHandling = EntryHandling.AllEntries; IsExitOnSessionCloseStrategy = true; ExitOnSessionCloseSeconds = 30; IsFillLimitOnTouch = false; MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix; OrderFillResolution = OrderFillResolution.Standard; Slippage = 0; StartBehavior = StartBehavior.WaitUntilFlat; TimeInForce = TimeInForce.Gtc; TraceOrders = false; RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose; StopTargetHandling = StopTargetHandling.PerEntryExecution; BarsRequiredToTrade = 20; } else if (State == State.Configure) { AddPlot(Brushes.Green, "Plot A"); } } protected override void OnBarUpdate() { //Add your custom strategy logic here. Value[0] = Close[0] + 2* TickSize; } }
Cody B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by geddyisodin, Today, 05:20 AM
|
0 responses
3 views
0 likes
|
Last Post
by geddyisodin
Today, 05:20 AM
|
||
Started by JonesJoker, 04-22-2024, 12:23 PM
|
6 responses
33 views
0 likes
|
Last Post
by JonesJoker
Today, 05:14 AM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
12 responses
3,239 views
0 likes
|
Last Post
by Leafcutter
Today, 05:08 AM
|
||
Hi
by AveryFlynn
Started by AveryFlynn, Today, 04:57 AM
|
0 responses
6 views
0 likes
|
Last Post
by AveryFlynn
Today, 04:57 AM
|
||
Started by RubenCazorla, 08-30-2022, 06:36 AM
|
3 responses
79 views
0 likes
|
Last Post
by PaulMohn
Today, 04:44 AM
|
Comment