Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing multiple lines...

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

    Drawing multiple lines...

    Hi,

    I´m building a strategy which has multiple levels of interest, the number of levels depends on the number of contracts the strategy is allowed to trade (cross a level = buy/sell one contract).
    How can I draw these levels without hardcoding them? (since how many there are can change)

    I tried storing them in an array and made a for-loop, but it only draws the last one...

    Thanks
    /nyrn2k

    #2
    Hello nyrn2k,

    Welcome to the NinjaTrader support forums.

    You had the right idea with an array, if you needed multiple values that is generally best as an array or collection. You can later update the collection or loop over it to do actions.

    My guess would be that you either did not change the tag on each loop iteration to create new objects or that there is a problem with the way the loops being executed. Tags need to be unique so if you are not doing something like "Tag" + i then it would just draw the last iteration.

    If you can attach what you started that would help me to understand the problem better.

    I look forward to being of further assistance.

    Comment


      #3
      Of course, "Tag" + i, that will probably do it!

      Thanks for the quick reply!
      /nyrn2k

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      45 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      31 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X