Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Properties

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

    Custom Properties

    Hi I am looking into creating a Ninja Script that will hide drawing objects from specific time frame charts.

    For example if I draw a box on a 60minute time frame of an instrument chart, I do not want that same box displayed on the Day time frame chart of the same instrument. The reason is less clutter on the larger time frames so analysis is faster.

    I want to apply the rule/property at the time an object is being drawn so I can target specific objects rather than working with all objects, and I'd like to target specific time frame to prevent having to turn objects on and off when moving between time frames.

    While I know I will eventually work out how to code this feature as a script, I was wondering if anyone else has developed a script already that achieves this, or has worked out how to apply custom properties to drawing objects without the need for scripted code?

    One approach I am thinking about is obviously to take advantage of the connected charts in NJ8, and have larger time frames separated from smaller ones on separate charts (on multiple screens). The issue for me there, is I draw support and resistance lines on the higher time frames I want represented on the lower trading time frames. So unless there is a way to transpose drawing objects between charts, this connected chart method is not the answer for me?

    Kind regards

    Duncan

    #2
    Hello EastLondonKiwi, and thank you for your question. Probably the easiest way to do this would be to paint any chart objects you draw with a color that changes to transparent when an undesired BarsPeriod is present. Here is a code example which generates such a color dynamically.

    Code:
    [FONT=Courier New]            BarsPeriod period = ChartBars.Properties.BarsPeriod;
                bool visible = (
                       ( period.BarsPeriodType == BarsPeriodType.Minute )
                    && ( period.BarsPeriodValue == 1 )
                    );
                Brush boxColor =
                      visible
                    ? Brushes.ForestGreen
                    : Brushes.Transparent
                    ;[/FONT]
    This example was developed using this information from the help guide :



    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      ok thanks I'll take a look at the help guide on this subject and let you know how I got on.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by algospoke, Yesterday, 06:40 PM
      2 responses
      19 views
      0 likes
      Last Post algospoke  
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      45 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      21 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      181 views
      0 likes
      Last Post jeronymite  
      Working...
      X