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 wooofad, 06-15-2020, 01:08 PM
      8 responses
      92 views
      0 likes
      Last Post echoxray  
      Started by bubblegum, Today, 12:00 AM
      0 responses
      2 views
      0 likes
      Last Post bubblegum  
      Started by eseorvuda, Yesterday, 10:28 PM
      0 responses
      2 views
      0 likes
      Last Post eseorvuda  
      Started by ctrent, Yesterday, 09:58 PM
      0 responses
      5 views
      0 likes
      Last Post ctrent
      by ctrent
       
      Started by cxbnbvc, Yesterday, 09:25 PM
      0 responses
      2 views
      0 likes
      Last Post cxbnbvc
      by cxbnbvc
       
      Working...
      X