Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to show results of a calculation in an indicator panel

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

    How to show results of a calculation in an indicator panel

    Hello

    I am building an indicator with the following logic.

    //Add your custom indicator logic here.

    //RoundDownToTickSize

    Print(string.Format("TICKS AWAY FROM UPPER BAND"));
    Print((GetCurrentAsk() - Bollinger(2, 14).Upper[0]) / TickSize );
    Print(string.Format("------"));


    Print(string.Format("TICKS AWAY FROM MIDDLE BAND"));
    Print((GetCurrentAsk() - Bollinger(2, 14).Middle[0]) / TickSize );


    Print(string.Format("------"));


    Print(string.Format("TICKS AWAY FROM LOWER BAND"));
    Print((GetCurrentAsk() - Bollinger(2, 14).Lower[0]) / TickSize );

    Print(string.Format("------"));


    I can see the results in Ninja Script output but how can I modify the above code so the calculations are shown in the indicator panel.

    Thank you for your assistance



    #2
    Hello manuel21,

    Most commonly you would use a Plot to display data, if the data you want to display would be on a bar by bar basis (think of the SMA) then AddPlot would be used. If you wanted to just display some values as text or other markers you can use drawing objects.


    Comment


      #3
      Thank you Jesse:

      I want to display the results as text only. No lines or anything like that.

      Could you modify this below code for me so it displays as text in the indicator panel. I am not a programmer at all.

      Print(string.Format("TICKS AWAY FROM MIDDLE BAND"));
      Print((GetCurrentAsk() - Bollinger(2, 14).Middle[0]) / TickSize );

      Thank you for your help​

      Comment


        #4
        Hello manuel21,

        If you are trying to draw just text you can use Draw.TextFixed. There is an example of using that method in the link below. What you have now are already strings, you could make them into a variable tha can be used with TextFixed like the following:

        string myString1 = "TICKS AWAY FROM MIDDLE BAND \n";
        myString1 += (GetCurrentAsk() - Bollinger(2, 14).Middle[0]) / TickSize;

        The variable myString1 can then be used with Draw.TextFixed. ​

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        602 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        347 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        559 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        559 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X