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

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.
    JesseNinjaTrader Customer Service

    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 zstheorist, Today, 07:52 PM
      0 responses
      7 views
      0 likes
      Last Post zstheorist  
      Started by pmachiraju, 11-01-2023, 04:46 AM
      8 responses
      150 views
      0 likes
      Last Post rehmans
      by rehmans
       
      Started by mattbsea, Today, 05:44 PM
      0 responses
      6 views
      0 likes
      Last Post mattbsea  
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      33 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      6 views
      0 likes
      Last Post tkaboris  
      Working...
      X