Announcement

Collapse
No announcement yet.

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.

    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 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