Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market Analyzer - Alerts only when the bar close

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

    Market Analyzer - Alerts only when the bar close

    Hi,

    I have set up an alert and used "Rearm type: On bar close" for my market analyzer. But it triggers anytime the condition matches still.

    Is there anyway to get around this? Basically I want it to wait until the next bar and then run through the tickers and alert me if my conditions are met within the previous candle.

    #2
    Hello JustinCross,

    Thank you for your post.

    The Market Analyzer updates each tick and does not natively have a concept of bars. To set an alert based on bars, set up a chart with your desired bar type, right click on the chart, select Alerts and set your alert that way.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      I think I just created my first indicator that does what I need. Trying to test it now.

      Comment


        #4
        #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.DrawingTools;
        #endregion

        //This namespace holds Indicators in this folder and is required. Do not change it.
        namespace NinjaTrader.NinjaScript.Indicators
        {
        public class PreviousBarClosingPrice : Indicator
        {
        protected override void OnStateChange()
        {
        if (State == State.SetDefaults)
        {
        Description = @"The closing price of the previous bar";
        Name = "PreviousBarClosingPrice";
        Calculate = Calculate.OnBarClose;
        IsOverlay = true;
        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.White, "PlotPreviousBarClosingPrice");
        }
        else if (State == State.Configure)
        {
        }
        }

        protected override void OnBarUpdate()
        {
        if (CurrentBar<1) {
        return;
        }
        PlotPreviousBarClosingPrice[0] = Close[0];
        Value[0] = PlotPreviousBarClosingPrice[0];
        }

        #region Properties
        public Series<double> PlotPreviousBarClosingPrice
        {
        get { return Values[0]; }
        }
        #endregion
        }
        }

        #region NinjaScript generated code. Neither change nor remove.

        namespace NinjaTrader.NinjaScript.Indicators
        {
        public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
        {
        private PreviousBarClosingPrice[] cachePreviousBarClosingPrice;
        public PreviousBarClosingPrice PreviousBarClosingPrice()
        {
        return PreviousBarClosingPrice(Input);
        }

        public PreviousBarClosingPrice PreviousBarClosingPrice(ISeries<double> input)
        {
        if (cachePreviousBarClosingPrice != null)
        for (int idx = 0; idx < cachePreviousBarClosingPrice.Length; idx++)
        if (cachePreviousBarClosingPrice[idx] != null && cachePreviousBarClosingPrice[idx].EqualsInput(input))
        return cachePreviousBarClosingPrice[idx];
        return CacheIndicator<PreviousBarClosingPrice>(new PreviousBarClosingPrice(), input, ref cachePreviousBarClosingPrice);
        }
        }
        }

        namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
        {
        public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
        {
        public Indicators.PreviousBarClosingPrice PreviousBarClosingPrice()
        {
        return indicator.PreviousBarClosingPrice(Input);
        }

        public Indicators.PreviousBarClosingPrice PreviousBarClosingPrice(ISeries<double> input )
        {
        return indicator.PreviousBarClosingPrice(input);
        }
        }
        }

        namespace NinjaTrader.NinjaScript.Strategies
        {
        public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
        {
        public Indicators.PreviousBarClosingPrice PreviousBarClosingPrice()
        {
        return indicator.PreviousBarClosingPrice(Input);
        }

        public Indicators.PreviousBarClosingPrice PreviousBarClosingPrice(ISeries<double> input )
        {
        return indicator.PreviousBarClosingPrice(input);
        }
        }
        }

        #endregion
        Last edited by JustinCross; 07-26-2019, 08:23 PM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by samir, Today, 07:00 PM
        0 responses
        9 views
        0 likes
        Last Post samir
        by samir
         
        Started by travisloneker, Today, 06:52 PM
        0 responses
        6 views
        0 likes
        Last Post travisloneker  
        Started by InfraredBusa, Today, 05:50 PM
        0 responses
        3 views
        0 likes
        Last Post InfraredBusa  
        Started by White Fork, Today, 04:56 PM
        1 response
        8 views
        0 likes
        Last Post White Fork  
        Started by steveyinyang, Today, 02:48 PM
        3 responses
        22 views
        0 likes
        Last Post steveyinyang  
        Working...
        X