• 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

Difference of Two Indicators?

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

    Difference of Two Indicators?

    HI, has anyone done an indicator to plot the difference of two indicators? What I've seen so far is spread stuff, that takes two instruments, but I want to take the running difference between two indicators, for instance RSI(14) and another indicator of 14 period or something like that. Thanks!

    #2
    Hello chinaexpert1a, thanks for your post.

    That can be done like this:

    Code:
    public class TestRSI : Indicator
        {
            private SMA _SMA0;
            private RSI _RSI0;
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    //...
                }
                else if (State == State.Configure)
                {
                }
                else if(State == State.DataLoaded)
                {
                    _SMA0 = SMA(14);
                    _RSI0 = RSI(14, 3);
                }
            }
    
            protected override void OnBarUpdate()
            {
                var diff = _SMA0[0] - _RSI0[0];
                Print(diff);
            }
        }
    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Great! Thank you... so I see you have provided me with code, hehe, I'm....? noooooob

      Chris, do I need to make a custom indicator? I do want to, you suggest the 7+Breaking or other route, hire a programmer. :/

      lol

      Thanks

      Andrew

      Comment


        #4
        Hi chinaexpert1a, thanks for your reply.

        This would need to be developed as a custom indicator. I'm not aware of any existing indicator that will do this. The Spread indicator is the only similar one I know of.

        Kind regards.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by digibob, 07-08-2020, 03:45 AM
        5 responses
        35 views
        0 likes
        Last Post johnnymustard  
        Started by kanavancbduk, Today, 01:21 AM
        0 responses
        7 views
        0 likes
        Last Post kanavancbduk  
        Started by yalmandraku, Today, 01:21 AM
        0 responses
        5 views
        0 likes
        Last Post yalmandraku  
        Started by kanavancbduk, Today, 01:20 AM
        0 responses
        4 views
        0 likes
        Last Post kanavancbduk  
        Started by josenfit, Today, 01:03 AM
        0 responses
        3 views
        0 likes
        Last Post josenfit  
        Working...
        X