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

draw.text question

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

    #16
    Hello imalil,

    Thanks for your reply.

    Regarding, "I noticed in Paul's MACrossover indicator you use many switch statements. Is my indicator of a similar type?" I have no basis with which to answer that. The MACrossover uses switch statements based on user selection of 1 of several possible moving averages to use (for fast and for slow).



    When you have multiple bars objects, each bars object will call OnBarUpdate() and when it does, depending on your coding, your references can shift to that bars array. For example:

    double test = High[0] - Low[0];
    When OBU is called by the 100 tick series that would be the High[0] and Low[0] of that series. When the 200 or 300 tick call OBU then the High and Low will be of those series so this shows that without segregation (by barsInProgress) or without specification of which High and Low, the value of test will change based on who calls OBU.

    Another example is

    double test = Highs[1][0] - Lows[1][0]; In this example on each OBU, test will be and can only be the value of the current bar of the 200 tick High - low.

    Again the above examples assume there is no BarsInProgress check.
    Paul H.NinjaTrader Customer Service

    Comment


      #17
      Thanks. I notice you always assign series variables in your examples. When using a MTF chart is it mandatory to use series in order to segregate the data series?

      Is it possible to run the code once then say something like, (right before the variable I want "myresult"):

      if (barsinprogress == 0)
      {var0 = myresult[0][0]}

      else if (barsinprogress == 1)
      {var1 = myresult[1][0]}

      else
      {var2 = myresult[2][0]}

      then draw.text:
      Draw.Text(this, "myText"+CurrentBar, var0.ToString(), 0, High[0]+ 5 * TickSize); // show the calculated value 5 ticks above the high on the primary series

      Draw.Text(this, "myTexta"+CurrentBar, var1.ToString(), 0, High[0]+ 10 * TickSize); // show the calculated value 10 ticks above the high on the primary series

      Draw.Text(this, "myTextb"+CurrentBar, var2.ToString(), 0, High[0]+ 15 * TickSize); // show the calculated value 15 ticks above the high on the primary series

      But I'm afraid it'll print over the wrong data series. Is there any way to tell draw.text to print as if (barsinprogress == 0) regardless of which var0-2 is printing?

      Thank you.

      Comment


        #18
        Originally posted by imalil View Post
        ...
        then draw.text:
        Draw.Text(this, "myText"+CurrentBar, var0.ToString(), 0, High[0]+ 5 * TickSize); // show the calculated value 5 ticks above the high on the primary series

        Draw.Text(this, "myTexta"+CurrentBar, var1.ToString(), 0, High[0]+ 10 * TickSize); // show the calculated value 10 ticks above the high on the primary series

        Draw.Text(this, "myTextb"+CurrentBar, var2.ToString(), 0, High[0]+ 15 * TickSize); // show the calculated value 15 ticks above the high on the primary series

        But I'm afraid it'll print over the wrong data series. Is there any way to tell draw.text to print as if (barsinprogress == 0) regardless of which var0-2 is printing?

        Thank you.
        If instead of High[0], you use Highs[0][0], your Draw.Text() call will always be referencing the primary chart bars.

        Comment


          #19
          Hello imalil,

          Thanks for your reply.

          What I suggest is that you code up a small demonstration/example of what you want to do and test it under the various conditions to help you understand what would get printed and where. If then the example does not perform as expected, post the visual results (chart) along with your code.

          Alternatively, you might consider hiring a 3rd party vendor who can provide coding services to create your indicator for you, if this is of interest we can provide references to 3rd party coders.
          Paul H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jclose, Today, 09:37 PM
          0 responses
          4 views
          0 likes
          Last Post jclose
          by jclose
           
          Started by WeyldFalcon, 08-07-2020, 06:13 AM
          10 responses
          1,413 views
          0 likes
          Last Post Traderontheroad  
          Started by firefoxforum12, Today, 08:53 PM
          0 responses
          9 views
          0 likes
          Last Post firefoxforum12  
          Started by stafe, Today, 08:34 PM
          0 responses
          10 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by sastrades, 01-31-2024, 10:19 PM
          11 responses
          169 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X