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

Error Message

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

    #16
    Originally posted by NinjaTrader_Jesse View Post
    Hello Trader17,

    No this would not be in line with how the sample is coded. The BarsAgo you have used would be correct for any indicator that uses BarsAgo but this is not an indicator and has specific indexes used instead. I mentioned in the last post that you won't be using a BarsAgo here but you are instead using the CurrentBar.

    Here is the example again on how to do 1 BarsAgo when using the CurrentBar:

    Code:
    CurrentBar - 1
    You will also need to check that there is enough data before trying that:

    Code:
    if(CurrentBar < 1) return;
    The result would look just like the help guide sample except you have added minus one to the CurrentBar where it is used:

    Code:
    Print("Delta for current bar: " + barsType.Volumes[CurrentBar].BarDelta);
    Print("Delta for prior bar: " + barsType.Volumes[CurrentBar[B] - 1[/B]].BarDelta);
    I look forward to being of further assistance.
    Thank you. So if I am comparing the Deltas on the last 5 bars I would start off with:

    Code:
    if(CurrentBar < 5) return;
    Correct? Even though why would it be required if there are enough bars to start on the chart? Or would it not be able to see there are not enough bars to calculate yet?

    Thank you.
    Last edited by Trader17; 10-20-2018, 11:56 AM.

    Comment


      #17
      I am trying to use the Bar Delta comparison and I get an error message. How do I compare 2 Bar Deltas in Ninja Script?
      Thank you.
      Attached Files

      Comment


        #18
        Hello Trader17,

        Have you copied and pasted the entire example from the help guide? The error would indicate you have missed part of the sample. I can see you do not have the variable barsType declared which is in the sample along with the error handling:

        Code:
        if (Bars == null)
        return;
        
        
        NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType [B]barsType [/B]= Bars.BarsSeries.BarsType as     
        NinjaTrader.NinjaScript.BarsTypes.VolumetricBarsType;
        
        if (barsType == null)
        return;

        You can also know this as we are using C# and the error presented lets us know why you are seeing this error.

        The name barsType does not exist
        would mean specifically what it says, you have used the word and case "barsType" and that does not exist here. That would indicate a missing variable declaration if it is a variable you are trying to use.


        I look forward to being of further assistance.

        JesseNinjaTrader Customer Service

        Comment


          #19
          I copied and pasted this I made in Builder but could not compile it because of the error. So I add the missing code just above the Buy and Sell rules?
          Thank you.

          Comment


            #20
            Thank you very much. I did not get any error message any more. Also why the green vertical line on the left margin?
            Thank you.
            Attached Files

            Comment


              #21
              Hello Trader17,

              Thank you for the update.

              As for the green lines, I am unsure offhand what this is called. It appears that if you are using the light skin, you will see orange for an edit that is unsaved/compiled and green for a change that is saved/compiled. I will need to get further clarification on this.




              I look forward to being of further assistance.
              Last edited by NinjaTrader_Jesse; 10-22-2018, 10:17 AM.
              JesseNinjaTrader Customer Service

              Comment


                #22
                Thank you vry much!! Ninja Trader Rocks!!!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Skifree, Today, 03:41 AM
                1 response
                2 views
                0 likes
                Last Post Skifree
                by Skifree
                 
                Started by usazencort, Today, 01:16 AM
                0 responses
                1 view
                0 likes
                Last Post usazencort  
                Started by kaywai, 09-01-2023, 08:44 PM
                5 responses
                603 views
                0 likes
                Last Post NinjaTrader_Jason  
                Started by xiinteractive, 04-09-2024, 08:08 AM
                6 responses
                23 views
                0 likes
                Last Post xiinteractive  
                Started by Pattontje, Yesterday, 02:10 PM
                2 responses
                23 views
                0 likes
                Last Post Pattontje  
                Working...
                X