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 ETFVoyageur, Yesterday, 07:05 PM
      4 responses
      30 views
      0 likes
      Last Post ETFVoyageur  
      Started by JGriff5646, Yesterday, 10:02 PM
      2 responses
      21 views
      0 likes
      Last Post JGriff5646  
      Started by DawnTreader, Today, 05:58 PM
      0 responses
      5 views
      0 likes
      Last Post DawnTreader  
      Started by ntram, Today, 05:39 PM
      0 responses
      5 views
      0 likes
      Last Post ntram
      by ntram
       
      Started by giulyko00, Today, 11:49 AM
      2 responses
      12 views
      0 likes
      Last Post giulyko00  
      Working...
      X