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

Y anchor point wrong while plotting object

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

    Y anchor point wrong while plotting object

    Dear Support,

    I get a strange error while trying to plot some object in my script:

    Click image for larger version

Name:	NQ 09-20 (15 UniRenko T15R40O10) 2020_07_17 (20_28_06).png
Views:	396
Size:	103.7 KB
ID:	1110259

    As you can see the green dot have all the Y anchor point wrong.

    My function is very simple and it is:

    if (Close[0] > (High[1] + 4 * TickSize)
    && Close[1] > Open[1]
    && Close[2] < Open[2]
    && Time[1] != tempoBarra
    && ToTime(Time[0]) > 153000 && ToTime(Time[0]) < 220000)
    {
    Draw.Dot(this, "entry" + CurrentBar, true, Time[0], Close[0], Brushes.Lime);
    tempoBarra = Time[1];
    }

    In the same chart I have another custom indicator that plot the value of swing as text and the y value is correct as you can see.

    How can I fix this?

    There are not log error message in log tab or in the ninjascript output

    thank you, best regards

    Andrea

    #2
    Sorry, but I noted that using Calculation,OnEahTick also X value are wrong.
    While using OnBarClose, only Y vlue are wrong
    Click image for larger version

Name:	NQ 09-20 (15 UniRenko T15R40O10) 2020_07_17 (21_14_50).png
Views:	323
Size:	106.4 KB
ID:	1110262

    Comment


      #3
      Hello AndreaBhs,

      If Calculate is OnBarClose, I would expect the drawn object to appear at the close price of the bar.

      If Calculate is OnEachTick, then the drawn object will appear at whatever the current bar price is at the time the condition was true. This could be at a different price than when the bar has finished building.

      Does this also occur with Minute bars?

      May I test the script on my end to confirm that this code is drawing those objects?

      If so, remove all other code from the script except for the part that draws this dot.

      To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
      1. Click Tools -> Export -> NinjaScript...
      2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
      3. Click the 'Export' button
      4. Enter a unique name for the file in the value for 'File name:'
      5. Choose a save location -> click Save
      6. Click OK to clear the export location message
      By default your exported file will be in the following location:
      • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
      Below is a link to the help guide on Exporting NinjaScripts.


      Once exported, please attach the file as an attachment to your reply.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Dear Chelesea B.

        Thank you for your support

        Attached my indicator to view.

        Yes, this occur also with minute charts, but the problem is only for this indicator.
        The all others that I did work correctly, I don't know about this

        thank you, best regards

        Andrea
        Attached Files
        Last edited by AndreaBhs; 07-20-2020, 03:40 AM.

        Comment


          #5
          Hello AndreaBhs,

          The script you have provided has Calculate set to .OnEachTick. May I confirm TickReplay is disabled?

          In real-time the dot can be drawn anywhere within prices that were received while the bar was open. On a minute chart, the dot may not be at the close and could be anywhere within the high and low of a minute based bar. (With Renko this could be above, below, or in the middle of the bar as renko bars do not show all prices reached while the bar was open)

          In historical data Calculate will be OnBarClose. Are you seeing the dot at the close of the bar in historical data?

          When I have tested the script you have provided on a 1 minute chart with TickReplay disabled, I am seeing the historical drawing objects are at the close of the bar.

          Below is a link to a video.


          With the exact steps shown in the video are you getting different behavior?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Dear ChelseaB,
            I solved problem by creating a new indicator.
            Something was wrong in the previous, I renamed it and compile and it now work correctly.

            thank you,
            best Regards

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by guyonabuffalo, Yesterday, 10:01 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by thumper57, Yesterday, 04:30 PM
            3 responses
            12 views
            0 likes
            Last Post thumper57  
            Started by DT215, 01-14-2023, 07:59 PM
            4 responses
            132 views
            1 like
            Last Post NinjaTrader_BrandonH  
            Started by ETFVoyageur, Yesterday, 12:52 AM
            2 responses
            32 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by Skifree, Yesterday, 02:50 PM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_Kimberly  
            Working...
            X