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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      134 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      75 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      119 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      114 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      90 views
      0 likes
      Last Post CarlTrading  
      Working...
      X