Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calling and Re-setting a variable from an indicator

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

    Calling and Re-setting a variable from an indicator

    I am using an indicator that I did not program as part of a wider strategy.

    The indicator draws an arrow when certain patterns develop. I know where in the code this is and will add a integer to switch form 0 to 1 when the arrow is drawn. Firstly how would I call this in my strategy? i.e. IF (Integer in Strategy == 1) Enter Long.

    I then want to re-set the integer in the indicator so a new entry can be triggered if the pattern shows up again later. Does anyone have any idea how I would do this?

    Thanks

    Mark

    #2
    MJUK10,

    I am happy to assist you.

    Please view the following two links, as I believe they will help you.

    Accessing variables within an indicator : http://www.ninjatrader.com/support/f...ead.php?t=4991

    Plotting from within a strategy : http://www.ninjatrader.com/support/f...ead.php?t=6651

    Please feel free to ask any questions, etc.

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Integer indicator from a double indicator

      Hy everyone!
      This is the problem. I need to have the integer value (every candle) from another indicator that plots on the chart double value (it's similar to SMA)
      I don't want to re-write the first indicator, but I just want to write a new one that takes the double value and plots (with dots) the integer value of the first one.
      Is this possible? And how I can do it?

      Thanks to everyone!

      This is my first post!

      Comment


        #4
        Hello,

        Yes, this would be possible as long as the integer value from the first indicator was accessible as a plot.

        Please see our References sampe on Indicator: Ensuring indicator plots are valid before programmatically accessing them - http://www.ninjatrader.com/support/f...ad.php?t=33061

        Welcome to our forums and let us know if you have any questions!
        MatthewNinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_AdamP View Post
          MJUK10,

          I am happy to assist you.

          Please view the following two links, as I believe they will help you.

          Accessing variables within an indicator : http://www.ninjatrader.com/support/f...ead.php?t=4991

          Plotting from within a strategy : http://www.ninjatrader.com/support/f...ead.php?t=6651

          Please feel free to ask any questions, etc.

          Please let me know if I may assist further.
          Adam

          Thanks for posting these, I have been through the various options and am having a hard time to understanding the best option for me.

          What I have is a very complicated indicator that I did not program (and could never code) which generates arrows on a chart when certain conditions are met. I want to enter a trade long or short when it draws up and down arrows.

          I have found the segment of the code that generates the arrow and will add a variable to this section that can then be used as a signal to enter trades. Say for example an integer. which goes from 0 to 1 for an up arrow or 0 to 2 for a down arrow. I would then need to reset it when the trade is entered from the strategy as it might one generate 2-3 signals per day.

          What would be the best way of doing this? Just so you know, I am a paying subscriber so any help you can give me on this would be appreciated. My system is struggling in this market and this could help it a lot.

          Many thanks

          Mark

          Comment


            #6
            Mark,

            It sounds like it would be a better idea to move that code from the indicator into the strategy itself. That way you can have more control over the orders, etc. If it generates a arrow whenever some condition is true, its pretty much the same thing as generating an order when a condition is true.

            Please let me know if I may assist further.
            Adam P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_AdamP View Post
              Mark,

              It sounds like it would be a better idea to move that code from the indicator into the strategy itself. That way you can have more control over the orders, etc. If it generates a arrow whenever some condition is true, its pretty much the same thing as generating an order when a condition is true.

              Please let me know if I may assist further.
              Thanks for the reply Adam. The thought had crossed my mind it's just the indicator is so complicated I'm not sure it would work. Could I send you the code for you to look at let me know if you think it would work?

              Thanks

              Mark

              Comment


                #8
                MJUK,

                Sure, if you want to post the code I'll be happy to take a look.

                You can also send it to [email protected] with ATTN : Adam in it.
                Adam P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by MJUK10 View Post
                  Adam

                  Thanks for posting these, I have been through the various options and am having a hard time to understanding the best option for me.

                  What I have is a very complicated indicator that I did not program (and could never code) which generates arrows on a chart when certain conditions are met. I want to enter a trade long or short when it draws up and down arrows.

                  I have found the segment of the code that generates the arrow and will add a variable to this section that can then be used as a signal to enter trades. Say for example an integer. which goes from 0 to 1 for an up arrow or 0 to 2 for a down arrow. I would then need to reset it when the trade is entered from the strategy as it might one generate 2-3 signals per day.

                  What would be the best way of doing this? Just so you know, I am a paying subscriber so any help you can give me on this would be appreciated. My system is struggling in this market and this could help it a lot.

                  Many thanks

                  Mark
                  1. Expose the property in the indicator that you wish to access from the strategy
                  2. In the strategy, create an instance of the indicator
                  3. Read the indicator instance properties as you require.
                  4. Depending on how you set the property in the indicator, the indicator will itself reset the property as needed, or you can reset it yourself by assigning a value to the property in the created instance.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  656 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  371 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  109 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  574 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  579 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X