• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

4 digit precision instead of 5 digit precision

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

    4 digit precision instead of 5 digit precision

    how can i force a 4 digit precision for forex (eur/gbp/aud) and 2 digit precision(jpy) instead of the extra1/10 precision that i have today?
    the reason is that there are too many order changes that happens when i attach the order to indicator. the 1/10 precision is way too much for my simple systems.

    #2
    Pip size is determined automatically from the provider. This is to prevent rounding issues when configuring a pip size which is not native to the provider.

    Everything in NinjaTrader 8 is Tenth-pip under the hood and will display in whichever format the provider sends.

    This is not possible to configure.
    Patrick G.NinjaTrader Customer Service

    Comment


      #3
      if you are a trader and attach a order to the indicator, in Forex, the change order exceeds 120 changes every minute.
      i created a override EMA indicator that rounds to half pip instead of 1/10 of pip.
      #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.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 CustomEMA : Indicator
      {
      protected override void OnStateChange()
      {
      if (State == State.SetDefaults)
      {
      Description = @"Enter the description for your new custom Indicator here.";
      Name = "CustomEMA";
      Calculate = Calculate.OnPriceChange;
      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;
      Period = 1;
      AddPlot(Brushes.Tomato, "TrimmedEMA");
      }
      else if (State == State.Configure)
      {
      }
      }

      protected override void OnBarUpdate()
      {
      //Add your custom indicator logic here.
      Value[0]= Math.Round(EMA(Period)[0],4);
      if(IsFirstTickOfBar)
      Print("rounded value " + RoundUpToNearest(EMA(Period)[0]) + "original " + EMA(Period)[0]);

      }

      public Double RoundUpToNearest(Double passednumber)
      {
      if(TickSize==.00001)
      return Math.Round(passednumber*2,4)/2;
      else
      return Math.Round(passednumber*2,2)/2;

      }


      #region Properties
      [Range(1, int.MaxValue)]
      [NinjaScriptProperty]
      [Display(Name="Period", Order=1, GroupName="Parameters")]
      public int Period
      { get; set; }

      [Browsable(false)]
      [XmlIgnore]
      public Series<double> TrimmedEMA
      {
      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 CustomEMA[] cacheCustomEMA;
      public CustomEMA CustomEMA(int period)
      {
      return CustomEMA(Input, period);
      }

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

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

      public Indicators.CustomEMA CustomEMA(ISeries<double> input , int period)
      {
      return indicator.CustomEMA(input, period);
      }
      }
      }

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

      public Indicators.CustomEMA CustomEMA(ISeries<double> input , int period)
      {
      return indicator.CustomEMA(input, period);
      }
      }
      }

      #endregion

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by tdawson11, Today, 07:48 AM
      0 responses
      2 views
      0 likes
      Last Post tdawson11  
      Started by pstrusi, Today, 07:39 AM
      0 responses
      4 views
      0 likes
      Last Post pstrusi
      by pstrusi
       
      Started by vantojo, 06-19-2019, 04:06 PM
      6 responses
      34 views
      0 likes
      Last Post vantojo
      by vantojo
       
      Started by Mike661, Today, 07:22 AM
      0 responses
      7 views
      0 likes
      Last Post Mike661
      by Mike661
       
      Started by hothomas, Today, 07:17 AM
      1 response
      7 views
      0 likes
      Last Post hothomas  
      Working...
      X