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

Update Appearance on Shape Across Charts

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

    Update Appearance on Shape Across Charts

    Hi-

    I couldnt find the answer to this....I have created a custom rectangle that allows me to use the keyboard to choose a preset appearance of the Area color. If I have the shape set to All Charts, so its visible across all, when I update the shapes appearance, it only updates on the current chart. I would like it to be a global update but not sure how I can achieve this?

    Thanks!

    Nick.

    #2
    Hello ptpatrader,

    Thanks for your post.

    It would be expected that NinjaScript changes to a global drawing object would not propagate to all charts.

    However, this can be worked around by doing something like the following, but note that this will change the owner of the drawing object.

    Code:
    foreach (DrawingTool dt in DrawObjects)
    {
        if (dt is HorizontalLine && dt.IsGlobalDrawingTool)
        {
            (dt as NinjaTrader.NinjaScript.DrawingTools.Line).Stroke. Brush = CurrentBar % 2 == 0 ? Brushes.Purple : Brushes.Crimson;
            DrawingTool.SetDrawingToolCommonValues(dt, (dt as IDrawingTool).Tag, (dt as IDrawingTool).IsAutoScale, this, true);
        }
    }
    That being said, I have added a vote on your behalf for an existing feature request to support this. This request is being tracked under the number SFT-4438.

    As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

    Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

    Please let us know if we may be of further assistance to you.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Brandon for your help. If I update a shape on any chart, it updates on all charts, so its definitely disappointing that from code that same process doesnt exist, but understood.

      Thanks for submitting the change request.
      Nick.

      Comment


        #4
        Hey Brandon,

        So my shape is a descendent of ShapeBase. That code logic you have there takes a DrawingTool - does this mean that in my shape I cannot cast myself to a drawingtool?

        My shape receives a hotkey press, and then applies an appearance style to its Area which is on ShapeBase:

        AreaBrush = SupplyStrongAreaColor;
        OutlineStroke = SupplyStrongOutlineStroke;

        This works and updates the current chart. I was thinking that I could cast myself as a IDrawingTool. That doesnt work because arg 4 of SetDrawingTools is expecting the NinjaScriptBase but this is happening in a ShapeBase child class.

        I am assuming your code is running in a NinjaScript - I am just using the Ninja Editor so its impossible to reflect the types here. The code you shared seems to be only executable from an indicator not a shape....if I could gain access to a script or just the DrawingTool interface somehow that would work...

        Comment


          #5
          Hello ptpatrader,

          Thanks for your note.

          ShapeBase inherits from DrawingTool and can be cast as a DrawingTool or could be cast to ShapeBase if you wanted.

          You could view the Shapes.cs file located in the DrawingTools folder of the NinjaScript Editor window. On line 21 of this file, we can see the ShapeBase inherits from DrawingTool.

          Let us know if we may assist further.
          Brandon H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ETFVoyageur, Today, 10:13 PM
          0 responses
          2 views
          0 likes
          Last Post ETFVoyageur  
          Started by guyonabuffalo, Today, 10:01 PM
          0 responses
          2 views
          0 likes
          Last Post guyonabuffalo  
          Started by cre8able, 05-09-2024, 09:15 PM
          3 responses
          21 views
          0 likes
          Last Post cre8able  
          Started by jpeep, 08-16-2020, 08:31 AM
          17 responses
          502 views
          0 likes
          Last Post notenufftime  
          Started by ETFVoyageur, 05-07-2024, 07:05 PM
          15 responses
          125 views
          0 likes
          Last Post ETFVoyageur  
          Working...
          X