I watched and followed how this strategy builder video explained to do show up and down arrows.
https://paul-ninjatrader.tinytake.co...A4M184NTkwOTg3
My strategy builder code compiles to:
#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.NinjaScript.Indicators;
using NinjaTrader.NinjaScript.DrawingTools;
#endregion
//This namespace holds Strategies in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Strategies
{
public class TMABounds : Strategy
{
private NinjaTrader.NinjaScript.Indicators.Infinity.TmaBan ds TmaBands1;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Triangle Trend Bound Indicator with Arrows Up and Down";
Name = "TMABounds";
Calculate = Calculate.OnEachTick;
EntriesPerDirection = 1;
EntryHandling = EntryHandling.AllEntries;
IsExitOnSessionCloseStrategy = true;
ExitOnSessionCloseSeconds = 30;
IsFillLimitOnTouch = false;
MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
OrderFillResolution = OrderFillResolution.Standard;
Slippage = 0;
StartBehavior = StartBehavior.ImmediatelySubmit;
TimeInForce = TimeInForce.Gtc;
TraceOrders = false;
RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
StopTargetHandling = StopTargetHandling.ByStrategyPosition;
BarsRequiredToTrade = 20;
// Disable this property for performance gains in Strategy Analyzer optimizations
// See the Help Guide for additional information
IsInstantiatedOnEachOptimizationIteration = true;
}
else if (State == State.Configure)
{
}
else if (State == State.DataLoaded)
{
TmaBands1 = TmaBands(Close, 100, 2.618, 20);
TmaBands1.Plots[0].Brush = Brushes.Sienna;
TmaBands1.Plots[1].Brush = Brushes.AliceBlue;
TmaBands1.Plots[2].Brush = Brushes.MediumSeaGreen;
AddChartIndicator(TmaBands1);
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// Set 1
if ((Low[0] + (-4 * TickSize)) <= TmaBands1.LowerBand[0])
{
Draw.ArrowUpGreen(this, @"TMABounds Arrow Up Green_1 " + Convert.ToString(CurrentBars[0]) + @" ", true, 0, 0, Brushes.MediumSeaGreen);
}
// Set 2
if ((Close[0] + (4 * TickSize)) >= TmaBands1.UpperBand[0])
{
Draw.ArrowDownRed(this, @"TMABounds Arrow Down Red_1 " + Convert.ToString(CurrentBars[0]) + @" ", true, 0, 0, Brushes.Red);
}
}
}
}
Comment