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

Plot Color - Prior Bar

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

    Plot Color - Prior Bar

    NT7
    I have an indicator for a range bar chart that plots a hash mark where the next range bar may start (predicts where next bar will start). The problem is that I end up with hash marks above and below all of the bars on the chart.

    Add(new Plot(Color.FromKnownColor(KnownColor.White), PlotStyle.Hash, "PHigh"));
    Add(
    new Plot(Color.FromKnownColor(KnownColor.White), PlotStyle.Hash, "PLow"));

    PHigh.Set(Low[0]+ (range*TickSize));
    PLow.Set(High[
    0]- (range*TickSize));

    I have tried the following to change the color of the plots on the prior bar to transparent but it results in nothing plotting on any bar.

    PlotColors[0][1] = Color.Transparent;
    PlotColors[1][1] = Color.Transparent;

    How can I "remove" the hashs that are plotted on all bars except the current bar.

    Thanks


    #2
    Hi Romulan,

    This type of indicator may work best as real time only. You can do this by adding the following to top of OnBarUpdate().

    if (Historical) return;
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      This doen't answer the question. I know it only should work on real time data. The problem is that I have hash marks plotting above and below all of the prior price bars that have printed which is very annoying.

      If I try the
      PlotColors[0][1] = Color.Transparent;
      PlotColors[1][1] = Color.Transparent;

      the Plot does not appear to work at all. The [x][1] must do something strange to the plots.

      If possible, I would like to make the hash marks "disappear" from all of the bars except the current bar that is printing.

      Thanks

      Comment


        #4
        Romulan, PlotColors[0][1] should do the trick actually, Using plots for upper and lower markers seems to be overkill because you are using two plot dataseries and two plot color series. This uses a lot of extra ram. Try using DrawText instead and use the minus sign or underscore. These will automatically disappear and will be redrawn if you do not uniquely name them per bar.

        Dan
        Last edited by eDanny; 09-13-2011, 01:27 PM.
        eDanny
        NinjaTrader Ecosystem Vendor - Integrity Traders

        Comment


          #5
          I don't have any trouble using the snippets you posted to see hash marks for the most recent bar only.

          Check log tab of control center for any error messages. You're likely getting index out of range issues.

          Try adding the line below to resolve this type of issue:
          if (CurrentBar < 1) return;
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Thats what I was looking for - DrawText - which solved my problem.Not that adept at C# yet.

            Comment


              #7
              eDan pointed me in right direction.

              You were right - was not checking for CurrentBar = 0 which caused invalid index. Still not used to looking at log!#%

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by GussJ, 03-04-2020, 03:11 PM
              11 responses
              3,221 views
              0 likes
              Last Post xiinteractive  
              Started by andrewtrades, Today, 04:57 PM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by chbruno, Today, 04:10 PM
              0 responses
              6 views
              0 likes
              Last Post chbruno
              by chbruno
               
              Started by josh18955, 03-25-2023, 11:16 AM
              6 responses
              436 views
              0 likes
              Last Post Delerium  
              Started by FAQtrader, Today, 03:35 PM
              0 responses
              9 views
              0 likes
              Last Post FAQtrader  
              Working...
              X