• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sma < >

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

    Sma < >

    So do SMAs have values? How can I make SMAs have values? I do not want to use CrossAbove or CrossBelow, as they are events. I would like to know the condition of the two moving averages. i.e. SMA(fast) is above SMA(slow). Thanks for any help.


    #2
    Hi

    The mistake seems to be that the bar the indicators are operated on isn't specified.

    You need to put:

    Code:
    if( SMA(fast)[0] > SMA(fast)[0] )
    
       do something
    The bar isn't specificed if you code something like:

    Code:
    if( Rising(SMA(fast)) == true )
    
       do something

    Comment


      #3
      Hello Rhyshaelkan,

      Thank you for your post.

      arbuthnot is correct, you need to reference the barsAgo index for the indicator's value. [0] being the current value.
      Originally posted by arbuthnot View Post
      Code:
      if( SMA(fast)[0] > SMA(fast)[0] )
      
         do something
      Patrick H.NinjaTrader Customer Service

      Comment


        #4
        Thank you for pointing me in the right direction arbuthnot, and Patrick. Compiled without issue. Now to move on to some testing of variables.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Newtrader101, Today, 06:31 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_EricB  
        Started by Tyler7498, Today, 07:34 PM
        0 responses
        4 views
        0 likes
        Last Post Tyler7498  
        Started by Woomera, Today, 07:24 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Started by Newtrader101, Today, 12:31 PM
        2 responses
        13 views
        0 likes
        Last Post Newtrader101  
        Started by kweiss, Today, 06:42 PM
        0 responses
        2 views
        0 likes
        Last Post kweiss
        by kweiss
         
        Working...
        X