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

Indicator or Alert?

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

    Indicator or Alert?

    Good Morning,
    I run 2 Stochastics Fast indicators on my chart in the same window, plotting only the %D lines - so I have 2 lines. I need to create an indicator or alert that displays the difference between those 2 lines. I would prefer an oscillator that would plot a line that is the difference between the 2 lines but an alert would also work - to alert me when the difference hits a certain level.

    I have not programmed indicators nor alerts before but I do have programming experience so with a tutorial I might be able to do it.

    Would you suggest an indicator or alert and do you have any help materials?

    Thanks so much
    Mark Lewis

    #2
    Hello Marklhc1988,

    Thank you for the note.

    I have attached a sample indicator that will plot the spread of two stochastics fast indicators.

    There are a few key items that make this work.

    Firstly, I set up a plot to use by calling AddPlot in State.SetDefaults (Line 50).

    Second, I set up two StochasticsFast indicators at the class level (for performance reasons) and initialize them in State.DataLoaded (Lines 30, 31, 57, and 58)

    Thirdly, I perform the calculation in OnBarUpdate starting at line 62. The Values[][] array is a collection of the plots added to the script where the first index is the plot object itself and the second index is the BarsAgo value of the plot i.e. the value for the plot at the indexed bar.

    To import the script, download the attached file and import it by going to Tools>Import>NinjaScript addon.

    Please let me know if I can assist further.
    Attached Files
    Last edited by NinjaTrader_ChrisL; 02-18-2019, 11:04 AM.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris!
      Thanks so much for your quick response and for creating the indicator, I really appreciate it.

      ** Problem**

      Did you happen to create for NT8? I have NT7. In any event I downloaded the indicator and tried to import and got an error.

      Let me know,
      Thanks, Mark

      Comment


        #4
        Hello Marklhc1988,

        My apologies, I will convert the sample indicator for NT7 shortly.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Hello Marklhc1988,

          Thanks for your patience.

          I have added the NT7 version of the same indicator.

          Please let me know if I can assist further.
          Attached Files
          Chris L.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          26 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, Yesterday, 09:53 PM
          2 responses
          49 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          191 views
          0 likes
          Last Post Hasadafa  
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,230 views
          0 likes
          Last Post xiinteractive  
          Working...
          X