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

Help needed with my first indicator please

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

    Help needed with my first indicator please

    I am a newby at developing indicators and am having some trouble working on one in NT7.

    1. How do I send something to the print output window? I know where to find it, and have included the following line in my code: Print (“Calc1:” + Calc1); The indicator compiles ok, but I see nothing on the output window.
    2. I have created a DrawText line in the indicator, which is intended to show the results of my calculation on the 1st panel of the chart. When I add the indicator to the chart, all I get is the text string which refers to my calculation. I believe I need to convert the double of my calculation ToString. Can someone give an example of how that would be written in the string location of the DrawText?
    3. Additionally, my results should show up above several bars on the chart, but currently I am only seeing the text string above the last bar to meet my conditions – if I change the conditions it appears above another bar that meets it. In the DrawText code, I have shown the barsAgo as 0, but do I need to be referring to CurrentBar in some way to get all of them to show?
    4. DrawText (Tagcalc1, "calc1", 0, High[0] + 4 * TickSize, Color.Black);

    Thanks in advance

    #2
    1. You would need to reload all historical data(rightlick on the chart) with an open output window (if you have the indicator apllied to the chart) or reapply the indicator to see the prints. however if your print is included in an if condition the obvious problem could also be that the if statement is never true.

    2. Calc1.ToString()

    3. that (if i undestand you correctly) would occur if the string that is the tag of the drawingtool stays the same. so DrawText("text", ...);
    if you put it like this the drawingtool will be updated for everybar. that is usefull if you dont want irrelevant historical spam on your chart.
    if you however want the drawingtools to be apllied to all candles that meet ur condition than u would need to alternate the stringtag, usally with "+CurrentBar" to include a number that is everchanging.
    so DrawText("text"+CurrentBar, ...);

    Comment


      #3
      Hello,

      Thank you for the questions.

      For debugging, I would suggest this guide: http://ninjatrader.com/support/forum...ead.php?t=3418

      Essentially all that is needed is to use
      Code:
      Print("Some value or text");
      If your varialbe name is calc1, you would just need to remove the quotes and add .ToString() or:

      Code:
      DrawText (Tagcalc1, calc1.ToString(), 0, High[0] + 4 * TickSize, Color.Black);
      For more than 1 object, you would need to make the Tag unique, appending the current bar to the tag is an easy way to do this:

      Code:
      DrawText (Tagcalc1 + CurrentBar, calc1.ToString(), 0, High[0] + 4 * TickSize, Color.Black);
      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Ha....
        I won

        Comment


          #5
          actually, your on top, so i guess u win.

          also

          thats what she said.

          Comment


            #6
            Absolutely awesome speed of response and great clear instructions which have all worked. You both won as far as I am concerned.

            Thanks!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,606 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            8 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            19 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            6 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            14 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X