Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

access a list from OBU

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

    #16
    Jim,

    I hate to ask you that cause i feel like i am abusing but is it possible to use RenderTarget.DrawLine(start, end, myDxBrush); if you're coordinate are coming from a List.

    i got var listm = new List<double>();
    Of course if i extract with foreach i get all my prices from the list.
    But List has no GetXByBarIndex , there is always the index from the list. But will it work if i loop throught the list?

    ty

    Comment


      #17
      Hello Frank,

      When clients hit these walls going to deep into NinjaScript, we suggest they seek assistance from a consultant to build the script for them

      GetXByBarIndex is a ChartControl method. It would not be a method of a List.

      The indexes of the List would not be the same as the bar indexes, and would not be useful to convert to X coordinates with ChartControl.GetXByBarIndex.

      If the List<double> contains price values, or whatever you are trying to present on the chart panel, the values in the list would need to be converted to Y coordinates with GetYByValue, which is a ChartScale method. They also would need to be associated with a specific bar index.

      The information in this thread should ultimately clear the air behind when OnRender and OnBarUpdate would be used, and trying to do things in OnRender and give that information to OnBarUpdate (which should never be done.)

      At this point, you will need to get more familiar with the code your are working with: experiment, use prints to observe what you are giving various methods, and note your results so you can learn from your experiences.


      Last edited by NinjaTrader_Jim; 09-08-2021, 03:49 PM.

      Comment


        #18
        Jim,

        Can we go backward with OBU?

        I tried:

        Code:
        for (int i = (CurrentBar - lastLowestLowIndex); i <= CurrentBar; i++)
        {
        trackingVolume += Volume[i];
        trackingclose += Close[i];
        
        if (trackingVolume >= 1000000)
        {
        foundIndex = CurrentBar;
        
        break;
        }
        
        
        Print(" price" + Close[i]);
        Print("C" + i);
        //Print("FI" + foundIndex);
        I mean the only thing i can do is go from left side to the lowest point lastLowestLowIndex. But i try to do the opposite going from lastLowestLowIndex to the left side of the chart which would be CurrentBar?

        Now it goes from (left side of the chart CurrentBar? right 1604) to lastLowestLowIndex 840. But i want the opposite from 840 to 1604. Is it possible?

        Thanks

        Comment


          #19
          Jim,

          Sorry, i found the culprit (myself), i get it know.

          Thanks for everything.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          577 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X