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

Not Plotting yet data is correct in data box

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

    Not Plotting yet data is correct in data box

    The data box is showing the correct values at the correct bars for my indicator however the AddPlot is not printing the brush.

    The brush was printing 90% of the time until I added "Open[0] < VWMA1[0]" and now here are 0 brushes.

    Here is some code
    Code:
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "DailyBuyZone";
    Calculate = Calculate.OnBarClose;
    IsOverlay = true;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    AddPlot(Brushes.Lime, "BZ1");
    AddPlot(Brushes.MediumSeaGreen, "BZ2");
    AddPlot(Brushes.Red, "BZ3");
    }
    else if (State == State.Configure)
    {
    AddDataSeries(BarsPeriodType.Day, 1);
    }
    
    protected override void OnBarUpdate()
    {
    if (CurrentBars[1]>0)
    {
    _BZ1 = 0;
    _BZ2 = 0;
    _BZ3 = 0;
    
    
    if (Close[0] > VWMA1[0] && Open[1] < VWMA1[1] && Open[0] < VWMA1[0] )
    
    continues with more code
    Any ideas why the brush no longer shows? Also why the brush only showed 90% of the time before I added the "Open[0] < VWMA1[0]"?

    Thanks

    #2
    Hello mlprice12,

    Are you making sure the plot is set on every bar?

    Is the plot set when Open[0] is less than VWMA1[0]?

    If there is a bar link missing, there will be no plot segments rendered between bars where there is no plot set.

    Use IsValidDataPoint() to confirm a value has been set.
    https://ninjatrader.com/support/help...ddatapoint.htm
    https://ninjatrader.com/support/foru...196#post820196
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea

      That was the problem. If the next bar has no data then the plot does not show for the previous bar.

      Is there a way to extend the plot an extra bar? Ex Bar 1 and Bar 2 have data but Bar 3 does not. Is there a way to make all 3 bars plot without changing the logic?

      Comment


        #4
        Hello mlprice12,

        Are you asking about the HigherTimeFrameIndicatorPlotExample_NT8 that demonstrates setting the current value to the previous bar's value that I have linked in post #2?

        Are you finding this example is inadequate?
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by MarianApalaghiei, Today, 10:49 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by love2code2trade, Yesterday, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Today, 09:43 PM
        0 responses
        8 views
        0 likes
        Last Post funk10101  
        Started by pkefal, 04-11-2024, 07:39 AM
        11 responses
        37 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Yesterday, 08:51 AM
        8 responses
        46 views
        0 likes
        Last Post bill2023  
        Working...
        X