Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Update MAEnvelopes indicator on a chart using Indicator Script

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

    Update MAEnvelopes indicator on a chart using Indicator Script

    Hi,

    I have a chart with a MAEnvelopes (EMA) indicator already added and displayed.
    I also have an indicator script that adds information on the chart while OnBarUpdate. At certain condition, I am trying to update the MAEnvelopes parameters and redraw. Is there a way to this from within the indicator script?

    Thank You for your help.

    #2
    Hello,

    Thank you for the post.

    If you are asking that the existing indicator has a change in parameters and then is reloaded, unfortunately this would not be possible to directly automate. The F5 button would need to be pressed to reload the chart, but that would also reload all indicators.

    To have a dynamic indicator, you would likely need to create your own indicator that watches the other indicators needed, and then plots their values. The single indicator could provide conditions and then change the actual parameters used when it calls on the other indicators to get values.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thank You Jesse,
      Could you direct me to an example on how to put MAEnvelopes dynamic indicator in the indicator script, or other similar series?

      Comment


        #4
        Hello,

        The most simple example would be to create a new indicator and then change the default syntax. I will provide steps below to assist in creating a test script.

        You can call most indicators in the same manor, you would provide the indicators name, followed by parenthesis and any parameters the indicator takes. Finally followed by the Plot trying to be accessed.

        Steps to test:

        Click Tools -> New NinjaScript -> indicator
        Give the indicator a name and click Generate.

        Look for the OnBarUpdate section, and the following line:

        Code:
        Plot0.Set(Close[0]);
        Replace the line with the following syntax instead:

        Code:
        Plot0.Set(MAEnvelopes(1.5,3,14).Upper[0]);
        In this case, the indicator is calling the MAEnvelopes and getting the Current value of the Upper plot. The [0] at the end denotes zero bars ago or the current value.

        By creating this test indicator, this would display the overall syntax needed to plot 1 value from another indicator, if you needed to plot more than 1 value you would need to add additional plots and set values to those plots as well.




        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by RubenCazorla, 08-30-2022, 06:36 AM
        3 responses
        77 views
        0 likes
        Last Post PaulMohn  
        Started by f.saeidi, Yesterday, 12:14 PM
        9 responses
        23 views
        0 likes
        Last Post f.saeidi  
        Started by Tim-c, Today, 03:54 AM
        0 responses
        3 views
        0 likes
        Last Post Tim-c
        by Tim-c
         
        Started by FrancisMorro, Today, 03:24 AM
        0 responses
        5 views
        0 likes
        Last Post FrancisMorro  
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,772 views
        0 likes
        Last Post Leafcutter  
        Working...
        X