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

draw lines only for current session

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

    draw lines only for current session

    Hi, I made an indicator that draws lines to show me gaps between highs and lows a couple bars apart, but I can't find a way to get it to only draw the lines for that day/session. The only choices i have in the "maximum bars lookback" box of the setup are 256 or infinite. I end up with a screen covered in lines. I only want the lines drawn for the current session. Is there a way?
    thanks,
    David

    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 2)
    return;




    // Set 1
    if (High[0] < Low[2])
    {
    Draw.HorizontalLine(this, "DownGaplineHigh" + CurrentBar, Low[2], Brushes.Red);
    Draw.HorizontalLine(this, "DownGaplineLow"+ CurrentBar , High[0], Brushes.Green);
    }

    if (Low[0] > High[2])
    {
    Draw.HorizontalLine(this, "upGaplineLow"+ CurrentBar , Low[0], Brushes.Magenta);
    Draw.HorizontalLine(this, "upGaplineHigh" + CurrentBar, High[2], Brushes.Chartreuse);
    }

    #2
    Hello trader3000a,

    You would need to use a Line tool if you wanted to span between bars instead of across the chart. When using the Line tool it asks for a BarsAgo which you could use Bars.BarsSinceNewTradingDay as the start bars ago. 0 would be used for the end BarsAgo. You could update the line at a later time using the same values to extend it onto any new bars where it should be visible.



    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by punkiy2111, 08-31-2021, 10:42 AM
    16 responses
    951 views
    0 likes
    Last Post muchacha  
    Started by gbourque, Yesterday, 04:11 PM
    5 responses
    19 views
    0 likes
    Last Post gbourque  
    Started by dtl-saw, 12-29-2022, 09:12 AM
    42 responses
    3,113 views
    1 like
    Last Post aligator  
    Started by AlphaOptions, 06-18-2013, 08:24 AM
    4 responses
    2,162 views
    0 likes
    Last Post ybforex
    by ybforex
     
    Started by mly916, Today, 03:17 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Working...
    X