Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Translate from NT7 to NT8 -

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

    Translate from NT7 to NT8 -

    Code:
     if (Instrument.MasterInstrument.InstrumentType == InstrumentType.Forex)
                {
                    if (String.Compare(Instrument.MasterInstrument.Name, 0, "USD", 0, 3) == 0)
                    {
                        m_pipCalcMode = 2;
                    }
                    else if (String.Compare(Instrument.MasterInstrument.Name, 3, "USD", 0, 3) == 0)
                    {
                        m_pipCalcMode = 1;
                        m_pipValue = 10;
                    }
                    else
                    {
                        string tmp = Instrument.MasterInstrument.Name.Substring(3, 3);
                        string FXPairName;
    
                        if (tmp == "JPY" || tmp == "CHF" || tmp == "CAD")
                        {
                            FXPairName = "$" + "USD" + tmp;
                            m_pipCalcMode = 4;
                        }
                        else
                        {
                            FXPairName = "$" + tmp + "USD";
                            m_pipCalcMode = 3;
                        }
                        Add(FXPairName, BarsPeriod.BarsPeriodType, BarsPeriod.Value);
                    }
                }
    This code is in a function after the OnBarUpdate {} . In NT7 it works fine, in NT8 is giving me an error. How do I do Add() in NT8?

    Basically, this section is calculating the risk to determine the lot size depening upon the value of the stop loss compared to the account balance. So it has to calcualte the value of the stop loss based upon the underlyning pair and the quoting currency. So if it is not the quoting currency, then it must add it at this function.


    -Stearno
    Last edited by stearno; 04-16-2016, 11:23 AM.

    #2
    Hello stearno,

    Thank you for writing in.

    You will want to use AddDataSeries() when adding additional data series: https://ninjatrader.com/support/help...dataseries.htm

    I would highly suggest taking a look at the Code Breaking Changes section of the NinjaTrader 8 help guide for a high level overview of the NinjaScript changes you can expect between NinjaTrader 7 and NinjaTrader 8: https://ninjatrader.com/support/help...ng_changes.htm

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Yes, I know how to add a data series. But what I was trying to do something different than the normal. But I guess after thinking I can do the same thing the normal way.

      Thanks for your help.

      Stearno

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X