Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SMA displacement

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

    SMA displacement

    I see you can set a displacement on a simple moving average on a chart, but you cannot set a displacement value on an SMA in an automated strategy. IS this true ?
    Is there a reason for this ?

    Thank you for your help

    shane

    #2
    Originally posted by shanemcdonald View Post
    I see you can set a displacement on a simple moving average on a chart, but you cannot set a displacement value on an SMA in an automated strategy. IS this true ?
    Is there a reason for this ?

    Thank you for your help

    shane
    Not true: you use the indexing capability.
    Code:
    double displacedSMAValue  = SMA(Close, Period)[displaceValue];
    Alternatively, use a named instance, and set the Displacement property.
    Code:
    private SMA displacedSMA;
    private int displacementValue = 10; //(say)
    private int Period = 10; //(say)
    Code:
    displacedSMA = SMA(Close, Period);
    displacedSMA.Displacement = displacementValue;

    Comment


      #3
      Hi

      Thank you very much for that info !
      That was good of you.

      shane

      Comment


        #4
        Hello Shane,

        Thank you for your post and Koganam for answering.

        Let us know if we can be of further assistance.
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by elirion, Yesterday, 09:32 PM
        0 responses
        6 views
        0 likes
        Last Post elirion
        by elirion
         
        Started by cre8able, Yesterday, 09:15 PM
        1 response
        8 views
        0 likes
        Last Post bltdavid  
        Started by cummish, Yesterday, 08:43 PM
        0 responses
        14 views
        0 likes
        Last Post cummish
        by cummish
         
        Started by Option Whisperer, Yesterday, 07:58 PM
        4 responses
        21 views
        0 likes
        Last Post Option Whisperer  
        Started by ETFVoyageur, 05-07-2024, 07:05 PM
        13 responses
        87 views
        0 likes
        Last Post ETFVoyageur  
        Working...
        X