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

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 Bogdan097, Yesterday, 03:25 PM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by knowmad, Yesterday, 03:52 AM
      3 responses
      44 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by MSerag, 05-06-2024, 11:52 PM
      5 responses
      30 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Aviram Y, Today, 06:03 AM
      0 responses
      2 views
      0 likes
      Last Post Aviram Y  
      Started by Skifree, Yesterday, 11:21 AM
      5 responses
      17 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X