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

using loops

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

    #16
    Hello kaywai,

    Thanks for your reply.

    As we have previously discussed, your data series DemandPoint will only contain a value when it is written to so you will have to broaden your search for the last 5 entries by looping back more than 5 bars and testing to see if the barsago index of DemandPoint contains a value. Once you have count 5 then you can break from the loop.
    Paul H.NinjaTrader Customer Service

    Comment


      #17
      Hi Paul,

      I tried to do that but with the code I shared with you yesterday was painting rays through each point but some of those rays made zero sense as they had a starting point that seemed random to me.

      Secondly, when I did a Print(DemandPoint[a]), where a is 0 to 4 in a loop, only when a is 0 were any of the points in DemandPoint data series correct throughout the chart. I was getting values that were not zero when the loop made its what from 1 through 4 and I don't know where those numbers were derived because they were of the same date as DemandPoint[0].

      Thirdly, when I tried to print the values of DemandPoint[0] and DemandPoint[1], I can see where all the values from DemandPoint[0] are derived from but I don't know where the values of DemandPoint[1] come from. It looks arbitrary. How am able to extract each unique DemandPoint[0]?

      Thirdly, I did broaden my search to 100 but there were just too many rays being drawn, so I reduced the code I shared with you to 5, to make it easier on the eyes.

      I was trying to identify the 5 base points where I would have rays drawn through them when a certain criteria was true, ie, when a point before it, is lower than it but I wasn't able to do so via code, or rather, I didn't know how to.

      I've attached an output.txt, chart and code for you to reference the third point. Is DataSeries the right thing to use or am I doing something wrong?

      if you could provide some guidance on how to progress, I will work my way through.

      Regards
      Kay Wai
      Attached Files
      Last edited by kaywai; 08-08-2020, 03:16 AM.

      Comment


        #18
        Hello kaywai,

        Thanks for your post.

        I will review what you posted but also want to point out another example that might be helpful to review for what you are doing. In the NT user apps is this indicator: https://ninjatraderecosystem.com/use...trend-spotter/

        Last edited by NinjaTrader_PaulH; 08-10-2020, 08:56 AM. Reason: Removed a reference to an NT8 indicator that is not available to NT7.
        Paul H.NinjaTrader Customer Service

        Comment


          #19
          Thanks PaulH. Will also take a look the suggested indicator.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by usazencort, Today, 01:16 AM
          0 responses
          1 view
          0 likes
          Last Post usazencort  
          Started by kaywai, 09-01-2023, 08:44 PM
          5 responses
          602 views
          0 likes
          Last Post NinjaTrader_Jason  
          Started by xiinteractive, 04-09-2024, 08:08 AM
          6 responses
          22 views
          0 likes
          Last Post xiinteractive  
          Started by Pattontje, Yesterday, 02:10 PM
          2 responses
          20 views
          0 likes
          Last Post Pattontje  
          Started by flybuzz, 04-21-2024, 04:07 PM
          17 responses
          230 views
          0 likes
          Last Post TradingLoss  
          Working...
          X