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

FYI: Random [BarsAgo] indexing issue with Draw.Ray()

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

    FYI: Random [BarsAgo] indexing issue with Draw.Ray()

    Just giving you guys a heads up on this weird behavior I saw today. This indicator has always drawn the Rays correctly as far as I have seen.
    Here is the code used in the indicator.
    Code:
    Draw.Ray(this, "AskLine", false, [B][U]-2[/U][/B], dblAsk, [U][B]-3[/B][/U], dblAsk, bshAskLine, DashStyleHelper.Solid, 2);
    Draw.Ray(this, "BidLine", false, [U][B]-2[/B][/U], dblBid, [B]-3[/B], dblBid, bshBidLine, DashStyleHelper.Solid, 2);
    You'll notice this happened with data after the market closed on Friday, so maybe that's a clue as to why the bar index location on the chart was interpreted wrong.
    Click image for larger version

Name:	SNAGHTML3d0cf5bb.PNG
Views:	184
Size:	73.4 KB
ID:	1118917
    After reloading the chart the lines were drawn correctly. No need to reply back. I'm just passing this along to you guys.
    Thanks.
    Attached Files

    #2
    Hello zacharydw00,

    It appears you have some invalid code.

    Negative values are not allowed for barsAgo indexes.

    Draw.Ray(this, "AskLine", false, -2, dblAsk, -3, dblAsk, bshAskLine, DashStyleHelper.Solid, 2);

    You will need to change the code so that only positive values are used for barsAgo indexes with Draw methods.

    See the forum threads below which have details.
    Hey everyone, I have an indicator I am working on that has a plot that I want to see for 10 or so future bars so as the candles are developing I can see the candles relative to the indicator. I also want to use it as somewhat of a projection. I tried adding to my series using negative bars ago, like this DataToPlot[-1] =

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      It appears you have some invalid code.
      Negative values are not allowed for barsAgo indexes.
      Hi ChelseaB,
      As I stated in the first post the indicator works correctly except for that one incident. And, as these screenshots show negative values work just fine.

      Click image for larger version

Name:	Negative index works correctly 1.png
Views:	267
Size:	179.7 KB
ID:	1119147Click image for larger version

Name:	Negative index works correctly 2.png
Views:	260
Size:	182.9 KB
ID:	1119148Click image for larger version

Name:	Negative index works correctly 3.png
Views:	266
Size:	184.1 KB
ID:	1119146Click image for larger version

Name:	Negative index works correctly 4.png
Views:	289
Size:	187.3 KB
ID:	1119145
      Side note, I wanted to attach a video to show the indicator works fine using negative numbers, but the site didn't allow that. That would be helpful if this site would allow that in the future.

      Regards,
      Zac

      Comment


        #4
        Hello Zac,

        Using is negative indexes is not supported by NinjaTrader.

        I recommend you change the code and only use positive barsAgo values.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        27 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 04-23-2024, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        193 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,235 views
        0 likes
        Last Post xiinteractive  
        Working...
        X