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

Add Offset to price line

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

    Add Offset to price line

    Hi,

    The current indicator I use shows the priceline of the Low of the last bar. I want to add an offset of -1 tick to the line. How do you add that?

    Code:
     if (State == State.SetDefaults)
    {
    Description = @"photog53 Horizontal Line at Low Price";
    Name = "PriceLineLow";
    Calculate = Calculate.OnPriceChange;
    IsOverlay = true;
    DisplayInDataBox = false;
    DrawOnPricePanel = false;
    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;
    LineColor = Brushes.Black;
    LineStyle = DashStyleHelper.Dot;
    LineWidth = 2;
    RayLength = 5;
    UseExtendedLine = true;
    }
    else if (State == State.Configure)
    {
    }
    }
    
    protected override void OnBarUpdate()
    {
    if (UseExtendedLine)
    Draw.HorizontalLine(this, "Currprice", false, Low[0], LineColor, LineStyle, LineWidth);
    else if (CurrentBar > 30)
    Draw.Line(this, "CurrRay", false, RayLength, Low[0], 0, Low[0], LineColor, LineStyle, LineWidth);
    }
    Thanks!

    #2
    Hello Ousher,

    Where you have Low[0], this could be Low[0] - TickSize to subtract a tick from the low price.

    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DJ888, Today, 10:57 PM
    0 responses
    1 view
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by MacDad, 02-25-2024, 11:48 PM
    7 responses
    158 views
    0 likes
    Last Post loganjarosz123  
    Started by Belfortbucks, Today, 09:29 PM
    0 responses
    7 views
    0 likes
    Last Post Belfortbucks  
    Started by zstheorist, Today, 07:52 PM
    0 responses
    7 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    151 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Working...
    X