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

Floating window or Floating Box

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

    Floating window or Floating Box

    Hello.

    Please, excuse me for my English.

    It's possible to create a NinjaScript that display a floating window like Data Box?

    If it's not possible, it's possible to create a floating Box (rectangle) with drag and drop caabilities?

    Or How to display data in Data Box without drawing these on the chart? For example, the Range of the current bar.

    This is an indicator of Position Size and I need to display in the Data Box the EntryPoint, Stop, StopSize, Risk, and Number of contratcts. All this data is already display on the upper left corner of the chart and my Idea is to display this data in the Data Box instead on the upper left corner of the chart.

    I use the Value.Set(Ent) and the entry is displayed into the Data Box, but I don't know how to display several data.

    Here is the code snippet:

    protected override void Initialize()
    {
    Add(new Plot(new Pen(Color.DarkGreen,2), PlotStyle.Line, "Range"));
    Add(new Plot(new Pen(Color.DarkGreen,2), PlotStyle.Line, "Entry"));

    Overlay = true;
    CalculateOnBarClose = false;
    DisplayInDataBox = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.

    MaxRiskPerTrade = Math.Round(capital * maxDayRiskPercent / 100 / numTradesPerDay, 2);
    Max = High[0];
    Min = Low[0];
    Rng = Mx-Mn;
    Ent = Max + TickSize;
    Stp = Min - TickSize;
    tStp = Rng + (2 * TickSize);
    RiskFor1c = (tStp / TickSize* valueTick) + commission;

    Value.Set(Rng); // Values[0].Set(Rng)

    Value.Set(Ent); // Values[0].Set(Ent)
    }

    The Value.Set only work with one data, the last, and when I use Values[0] and Values[1] the data is showed in Data Box but the chart is see like the attached image.

    Thank you.




    Thank you.
    Attached Files
    Last edited by Federico; 07-05-2011, 03:52 PM.

    #2
    Hi Federico,

    For a supported technique to see values in the data box but not plotted: Set the indicator plot color to the same color as the chart background.

    Our framework is built with C#, so a lot of this you are capable of doing. We do not provide support for general C# -- only the NinjaScript items documented in our help guide and reference samples here on the forums. For a start on undocumented/ unsupported NinjaScript, the following thread may be helpful:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Ryan.

      Thank you for your quick response.

      Really do not want to program with not supported techniques.

      I completed my post after you send me your answer. Pleas, Could you check my post again? Im using supported techniques to show my results in data box without showing up on the chart.

      Thank you again.

      Comment


        #4
        This is more of a workaround than a programming technique. You can set the color of the indicator as the same color as the chart. Set your indicator plot to White rather than dark green and you'll see data box value but no visible lines.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Thank you very much again Ray.

          I solved the problem.

          I Attached the result.

          I create a Properties as DataSeries for each value on my results and then Set the properties values with my calculations. The other problem on the chart was solved setting AutoScale to false.

          This is the code Snippet:

          protected override void Initialize()
          {
          Add(new Plot(Color.DarkGreen, "Entry"));
          Add(new Plot(Color.Red, "Stop"));
          Add(new Plot(Color.Goldenrod, "Range"));

          Overlay = true;
          CalculateOnBarClose = false;
          DisplayInDataBox = true;
          AutoScale = false;
          }

          /// <summary>
          /// Called on each bar update event (incoming tick)
          /// </summary>
          protected override void OnBarUpdate()
          {
          // Use this method for calculating your indicator values. Assign a value to each
          // plot below by replacing 'Close[0]' with your own formula.

          MaxRiskPerTrade = Math.Round(capital * maxDayRiskPercent / 100 / numTradesPerDay, 2);
          Max = High[0];
          Min = Low[0];
          Rng = Mx-Mn;
          Ent = Max + TickSize;
          Stp = Min - TickSize;
          tStp = Rng + (2 * TickSize);
          RiskFor1c = (tStp / TickSize* valueTick) + commission;

          Entry.Set(Ent);
          Stop.Set(Stp);
          Range.Set(Rn);
          }

          In Properties I Added:

          [Browsable(false)]
          [XmlIgnore]
          public DataSeries Entry
          {
          get { return Values[0]; }
          }

          [Browsable(false)]
          [XmlIgnore]
          public DataSeries Stop
          {
          get { return Values[1]; }
          }

          [Browsable(false)]
          [XmlIgnore]
          public DataSeries Range
          {
          get { return Values[2]; }
          }
          Attached Files
          Last edited by Federico; 07-05-2011, 05:26 PM.

          Comment


            #6
            Thanks for sharing your results here with our community members.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              I forgot indicate that I do not plot the plots, that means I leave empty the public override Plot Method.


              public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
              {
              }

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rocketman7, Today, 02:12 AM
              5 responses
              23 views
              0 likes
              Last Post rocketman7  
              Started by trilliantrader, 04-18-2024, 08:16 AM
              7 responses
              28 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by samish18, 04-17-2024, 08:57 AM
              17 responses
              66 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by briansaul, Today, 05:31 AM
              1 response
              15 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by PaulMohn, Today, 03:49 AM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Working...
              X