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

converting "set" for ninja 8

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

    converting "set" for ninja 8

    Hi
    I am trying to begin the (lengthy) process of converting to Ninja8, and on one indicator i am down to the last couple of errors but have hit a wall... I have a similar issue with .Set .....In ninja7 i have

    if(CurrentBar<tlength+1) return;
    Havg = SMA(High,tlength)[1];
    Lavg = SMA(Low,tlength)[1];
    if(Input[0]<Lavg) swing = -1;
    if(Input[0]>Havg) swing = 1;
    if(swing==-1)
    {
    if(previous_swing!=swing) Draw.ArrowDown(this, CurrentBar.ToString(), true, 0, Havg, Brushes.Gold);
    S=Havg;
    }
    where Lavg is a double. I have tried using the following in Ninja8
    S = Lavg;

    but its saying that the "property or indexer .... cannot be assigned to - it is read only" and also "cannot implicitly convert type 'double' to 'NinjaTrader.NinjaScript.Series<string>'

    Any ideas?

    Thanks in advance....

    #2
    Hello,

    Thank you for the post.

    Generally, Series<T> would need a BarsAgo value to be used, the .Set method did this for you in NT7.



    If you are trying to set a value, it would likely look like the following:

    Code:
    S[0] = Lavg;
    As I cannot see your whole script this would be a guess based on the error and what is available.
    You currently have an error
    "cannot implicitly convert type 'double' to 'NinjaTrader.NinjaScript.Series<string>'".
    This tells me that you have created a String series but you are trying to set a double value to that series without a BarsAgo.

    You would likely need to replace Series<string> with Series<double> if you wanted a double, or you would need to supply a String instead of a price to set the value.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Jesse - I'll play around with it and, if need be, be back!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by traderqz, Yesterday, 12:06 AM
      11 responses
      27 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by PaulMohn, Today, 03:49 AM
      0 responses
      7 views
      0 likes
      Last Post PaulMohn  
      Started by inanazsocial, Today, 01:15 AM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by rocketman7, Today, 02:12 AM
      0 responses
      10 views
      0 likes
      Last Post rocketman7  
      Started by dustydbayer, Today, 01:59 AM
      0 responses
      4 views
      0 likes
      Last Post dustydbayer  
      Working...
      X