• 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 tgn55, Today, 07:22 AM
        0 responses
        2 views
        0 likes
        Last Post tgn55
        by tgn55
         
        Started by U0000999, Today, 05:17 AM
        0 responses
        4 views
        0 likes
        Last Post U0000999  
        Started by Prataturry89, Today, 03:40 AM
        0 responses
        5 views
        0 likes
        Last Post Prataturry89  
        Started by UltraFastKetoBoost28, Today, 02:43 AM
        0 responses
        6 views
        0 likes
        Last Post UltraFastKetoBoost28  
        Started by kojakojids, Today, 02:04 AM
        0 responses
        5 views
        0 likes
        Last Post kojakojids  
        Working...
        X