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.

    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 cmtjoancolmenero, Yesterday, 03:58 PM
      2 responses
      19 views
      0 likes
      Last Post cmtjoancolmenero  
      Started by Stanfillirenfro, 04-22-2024, 09:19 AM
      8 responses
      59 views
      0 likes
      Last Post Stanfillirenfro  
      Started by olisav57, Yesterday, 07:39 PM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by cocoescala, 10-12-2018, 11:02 PM
      7 responses
      942 views
      0 likes
      Last Post Jquiroz1975  
      Started by oviejo, Today, 12:28 AM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X