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

Loops and Output

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

    Loops and Output

    HI,

    Everything's cool.
    Last edited by stockgoblin; 04-01-2013, 07:26 AM.

    #2
    Hi Stockgoblin,

    Thanks for posting and your code.

    I am happy to help, I just need some more information.

    Could you give me a little more background on what you're trying to accomplish?
    This should help us give you a more complete answer to help you with this project.

    I noticed that you are using a FOR loop for the 'i' variable. The loop will increment the variable 'i' and doesn't hang on to it. You will need to determine when you want to hang onto a result of the iteration and store it in a special variable.

    This loop is designed to stop the increment of 'i' at 23. Were the numbers you mentioned examples or the result of the code?


    I look forward to your response.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Hi Stockgoblin,

      Thanks for the reply and code.

      I'm still have some trouble on how you want the code to work for you.

      Are you wanting to save random Variable numbers from the FOR loop? or do you want set ones to be saved?
      What I mean is when the FOR loop is running, do you want to grab random numbers from the loop like 3, 17, 4, 100 or do you want certain numbers to pull?

      When the number are calculated in the loop, what do you want the DrawRays to do exactly?

      I can see why some of the code isn't working. Your DrawRays are not using unique strings when the code needs to plot the ray lines. This looks like you may need to be much more dynamic in how you call for the DrawRays to be plotted, meaning you may need to create a separate class.

      I look forward to your response.
      Cal H.NinjaTrader Customer Service

      Comment


        #4
        Hi Stockgoblin,

        Thanks for the reply and clarification.

        From the same sample code you have supplied and what you are trying to accomplish, you are only highlighting two Rays that have matching slopes in the BarsAgo time frame.

        If you want more Rays to be drawn you need to have specific, not unique, tags for them to be drawn. Your are currently having two defined tags and only two rays highlighted.

        You would either have to have a variable to count up to 24 or however many Rays you would like to have highlighted in order to accomplish this.

        Another option would be to use an Array to store those tags and call them later.

        Below is a link to the MSDN for using and building Arrays in C#
        http://msdn.microsoft.com/en-us/libr...tem.array.aspx

        Please note that Custom Arrays are not a supported method by NinjaTrader.

        Let me know if I can be of further assistance.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Okay, I think we're way off of my original question.

          So I understand the basics:

          My loop outputs the following to the output window when my condition is met:

          14
          56

          When I use "i" in a Draw ray it uses 56

          How do I access the 14?

          Comment


            #6
            Hi Stockgoblin,

            You will need to create an array that will be able to store the values that you see in the output window. Each of those values has a drawn line on the chart and therefore a specific tag name which you can check by double clicking on the line and going to the Data Tab from your chart.

            When you run your loop, you can have it set to add the data to an array and use that array to call the info forward and highlight your Rays that match the criteria.

            Here is a link to our online help guide about IRay, that will allow you to read the tag directly.


            Also, here is a second link as well that covers the IDrawObject in the help guide.


            Let me know if I can be of further assistance.
            Cal H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by andrewtrades, Today, 04:57 PM
            0 responses
            3 views
            0 likes
            Last Post andrewtrades  
            Started by chbruno, Today, 04:10 PM
            0 responses
            3 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Started by josh18955, 03-25-2023, 11:16 AM
            6 responses
            436 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            6 views
            0 likes
            Last Post FAQtrader  
            Started by rocketman7, Today, 09:41 AM
            5 responses
            19 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X