Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Round2TickSize anomaly

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

    Round2TickSize anomaly

    Is this a bug or a feature?
    In the 6E instrument I want to ensure a constant is properly rounded as I will being comparing against it..
    I used this code:
    if (CurrentBar <= 1) marketProfitPts = .003;
    Print(CurrentBar + "mkt 1 set " + marketProfitPts.ToString());
    Print(CurrentBar + "mkt br " + marketProfitPts.ToString());
    marketProfitPts = Instrument.MasterInstrument.Round2TickSize(marketP rofitPts);
    Print(CurrentBar + "mkt ar " + marketProfitPts.ToString());.

    I get these results:
    0mkt 1 set 0.003
    0mkt br 0.003
    0mkt ar 0
    The rounding set the value to 0
    Data series is defintely 6E (Eurodollar). Tthis is in a strategy.
    What do I not understand?

    #2
    ****pit Error. Ignore Post

    Comment


      #3
      My 6E is set to tick size 0.0001/US $ ( tools->instrument mgr->6e)

      My DX is set to tick size .0005/US$

      DX Future US Dollar Index 0.005 1000 NinjaTrader.Cbi.MasterInstrument

      When I add this code to DX 09-11 chart (which adds a DX 09-11 (but I guess that's not important, since I don't access it), but probably what is important is that I'm on a DX 09-11 chart), and run it, I get rounded to .005.

      If I go with .3 with .005 rounding on DX,

      MP = 0.3 To_String=0.3 rounded=0.3
      MP = 0.3 To_String=0.3 rounded=0.3

      Your stuff should be rounding to .003 with a .00001 round? something is not right.

      let me check with 6e.


      Code:
              public double marketprofits = 0.003;
              #endregion
      
              /// <summary>
              /// This method is used to configure the strategy and is called once before any strategy method is called.
              /// </summary>
              protected override void Initialize()
              {
                  CalculateOnBarClose = false;
                  Add("DX 09-11",    PeriodType.Minute, 3);  //BarsInProgress = 1 = VIX
      ...
      
      
          Print ( "MP = " + marketprofits + " To_String=" + marketprofits.ToString() + " rounded=" + Instrument.MasterInstrument.Round2TickSize(marketprofits) );

      **NT** Enabling NinjaScript strategy 'vix/aec770bbe0d14ac783f2c1eaccbc63b5' : On MP = 0.003 To_String=0.003 rounded=0.005
      MP = 0.003 To_String=0.003 rounded=0.005
      MP = 0.003 To_String=0.003 rounded=0.005
      MP = 0.003 To_String=0.003 rounded=0.005


      Originally posted by roland_nt View Post
      Is this a bug or a feature?
      In the 6E instrument I want to ensure a constant is properly rounded as I will being comparing against it..
      I used this code:
      if (CurrentBar <= 1) marketProfitPts = .003;
      Print(CurrentBar + "mkt 1 set " + marketProfitPts.ToString());
      Print(CurrentBar + "mkt br " + marketProfitPts.ToString());
      marketProfitPts = Instrument.MasterInstrument.Round2TickSize(marketP rofitPts);
      Print(CurrentBar + "mkt ar " + marketProfitPts.ToString());.

      I get these results:
      0mkt 1 set 0.003
      0mkt br 0.003
      0mkt ar 0
      The rounding set the value to 0
      Data series is defintely 6E (Eurodollar). Tthis is in a strategy.
      What do I not understand?

      Comment


        #4
        Originally posted by roland_nt View Post
        ****pit Error. Ignore Post
        haha ok

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        27 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 04-23-2024, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        193 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,235 views
        0 likes
        Last Post xiinteractive  
        Working...
        X