Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to add Up and Down Arrows to boundary's with Renko Blocks using Strategy Builder?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to add Up and Down Arrows to boundary's with Renko Blocks using Strategy Builder?

    I want to add up or down arrows when price contacts TMA (triangle moving average) bands. Attached is a screen shot of the chart with trend boundary's that I want to have the arrows show up when the Renko blocks touch or pass through the boundary's.


    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);
    }

    }
    }
    }

    Attached Files

    #2
    Hi Tonofit, thanks for posting.

    The best way to share code is to Export the strategy and posting the .zip file. Consider using the CrossAbove/CrossBelow conditions to see if the price crosses the TMA value:




    Best regards,
    -ChrisL

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    649 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    573 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    576 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X