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

Operand cannot be applied to indicator

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

    Operand cannot be applied to indicator

    I have the following:

    numStdDev * StdDev(Close, 20)

    However, it will not do the multiplication since StdDev is an indicator. How would I resolve this issue? Thank you.

    #2
    Hello cfree5119,
    Thanks for your post.

    To get the current value of StdDev use StdDev(Close, 20)[0]. To get the previous value of the StdDev you can use StdDev(Close, 20)[1] and so on.

    Thus you can modify your code simply as

    Code:
    numStdDev * StdDev(Close, 20)[B][0][/B]
    This will give you an double value.

    Please do let me know if I can be of any further assistance.

    Regards,
    Joydeep.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      I suppose I should have been more thourough... I am trying to use this within add(). Looks like this.

      Code:
      Add(MIN(Low, lowExitBandLength)[0] + (numStdDev * StdDev(Close, lowExitBandLength)[0]));
      This is yielding errors cs1502 and cs 1503. My lowExitBandLength and numStdDev are variables I have predefined.

      Comment


        #4
        Hello cfree5119,
        Thanks for the clarification.

        In your code you are trying to calculate the lookback period of the MIN indicator, and thus the issue. The lookback period is an integer, and the overload for the Add method in this case should be an indicator. Plesae see this help guide for further reference http://www.ninjatrader.com/support/h...s/nt7/add2.htm and http://www.ninjatrader.com/support/f...ead.php?t=3228

        What I get from your limited input is its better you create another indicator, which plots/calculates the desired value you want, and then call that indicator via the Add function in the strategy.

        Please do let me know if I can be of any further assistance.

        Regards,
        Joydeep.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Is there another way to plot this line without using the add method?

          Comment


            #6
            Hello cfree5119,
            To draw a line (plot), you have to use an indicator. A strategy cannot draw a Plot. However, you can assign value to a indicator dataseries from a strategy. Please refer to this reference sample for further reference http://www.ninjatrader.com/support/f...ead.php?t=6651

            In your case just create a blank indicator with one dataseris and assign value from the strategy using the above example.

            Please do let me know if I can be of any further assistance.

            Regards,
            Joydeep.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by geotrades1, Today, 10:02 AM
            0 responses
            2 views
            0 likes
            Last Post geotrades1  
            Started by rajendrasubedi2023, Today, 09:50 AM
            0 responses
            10 views
            0 likes
            Last Post rajendrasubedi2023  
            Started by ender_wiggum, Today, 09:50 AM
            0 responses
            4 views
            0 likes
            Last Post ender_wiggum  
            Started by bmartz, Today, 09:30 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by geddyisodin, Today, 05:20 AM
            3 responses
            24 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X