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

doesn't SMA() return a double?

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

    doesn't SMA() return a double?

    If so, then why does this code not compile? The error message is that SMA cannot be implicitly converted into a double. I'm sure I'm missing something simple. Thank you for your help.

    /*if (varyStop) {
    stopLimit = SMA(Range(), 14);

    } else stopLimit = 10;
    */

    #2
    Originally posted by crmcwi View Post
    If so, then why does this code not compile? The error message is that SMA cannot be implicitly converted into a double. I'm sure I'm missing something simple. Thank you for your help.

    /*if (varyStop) {
    stopLimit = SMA(Range(), 14);

    } else stopLimit = 10;
    */
    SMA(Range(), 14) returns DataSeries
    if you need double you have to use SMA(Range(), 14)[0]

    Comment


      #3
      Originally posted by roonius View Post
      SMA(Range(), 14) returns DataSeries
      if you need double you have to use SMA(Range(), 14)[0]
      Thank you roonius. I realized my mistake when I woke up this morning.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by trilliantrader, Today, 08:16 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by bill2023, Yesterday, 08:51 AM
      3 responses
      20 views
      0 likes
      Last Post bltdavid  
      Started by yertle, Today, 08:38 AM
      0 responses
      4 views
      0 likes
      Last Post yertle
      by yertle
       
      Started by Mestor, 03-10-2023, 01:50 AM
      15 responses
      378 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by samish18, Yesterday, 08:57 AM
      10 responses
      28 views
      0 likes
      Last Post samish18  
      Working...
      X