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

Problems with Cumulative Delta Indicator

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

    #16
    Hi Jim,

    I would appreciate it if you could assist me further. The volumetric delta in your indicator ( barsType.Volumes[CurrentBar].BarDelta ) is converted into a string and drawn as a text below the bars.

    I wish to create a variable say VolumetricDelta, whereby VolumetricDelta[0] = delta for current bar and VolumetricDelta[1] = delta for previous bar and so forth.

    Can you advise how I can do this?

    Thank so much

    Comment


      #17
      Hello Rainmakersg,

      It sounds like you want to create a Series<double> to hold BarDelta for each bar in the data series. You can create a Series<double> called VolumetricDelta, and then assign VolumetricDelta[0] the value returned from barsType.Volumes[CurrentBar].BarDelta.

      Series<T> - https://ninjatrader.com/support/help...t8/seriest.htm

      You can also make this Series public if you want to allow a hosting script to read it. A related example can be found below.

      SampleBoolSeries - https://ninjatrader.com/support/help...alues_that.htm

      We look forward to assisting.
      JimNinjaTrader Customer Service

      Comment


        #18
        Hi Jim,

        I used Addplot(), so VolumetricDelta is automatically converted to a Series<double>. I inserted VolumetricDelta[0] and VolumetricDelta[1] into an IF-ELSE statement so that arrows are drawn if certain conditions are met. So far, I am only able to get things working when I insert one VolumetricDelta[1] into one set of IF-ELSE statement. When I insert another VolumetricDelta[1] into one more set of IF-ELSE statement, nothing happens.

        I am trying to troubleshoot, so I created the Series<double> from scratch as you have suggested. But I got stuck at setting values for VolumetricDelta[0].

        I tried to assign directly:
        VolumetricDelta[0]= barsType.Volumes[CurrentBar].BarDelta
        Didn't work

        Then I tried to covert from long to double:
        VolumetricDelta[0]= Convert.ToDouble(barsType.Volumes[CurrentBar].BarDelta)
        Also didn't work

        Then I tried to covert from long to string to double:
        VolumetricDelta[0]= Convert.ToDouble(barsType.Volumes[CurrentBar].BarDelta.ToString())
        Also didn't work

        Kindly assist.

        Secondly, is the [CurrentBar] in barsType.Volumes[CurrentBar].BarDelta giving the problem I am experiencing with the multiple VolumetricDelta[1] I am trying to call?

        Thanks.

        Comment


          #19
          Hello Rainmakersg,

          I suggest creating a very simple indicator that assigns a value to a plot so you can confirm that you can properly add a plot and that you can properly assign plot values.

          I also suggest using the Log tab of the Control Center to look for any errors that you might be receiving. You can add debugging prints to identify the specific line of code that is generating the error. Always do this when something "doesn't work." You will need to confirm that the code assigning the plot value is in fact being reached, and you will need to ensure your script is not hitting any errors. Debugging prints can be used to confirm your code is reaching that line. (Place a print beside the line of code that is assigning the plot value, in the same code block as that plot value assignment.)

          Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

          Once you can verify that you can create and assigns plot value in a simple test indicator, please test it in this script, and ensure you are assigning the plot value in BarsInProgress == 0.

          Please also note that if you have added a plot, you will need to remove and re-add the script because State.SetDefaults will not be processed after reloading the script with F5.

          If you have further questions on errors, please copy them by selecting them in the Log tab of the Control Center and pasting them in your reply.

          We look forward to assisting.
          JimNinjaTrader Customer Service

          Comment


            #20
            Hi Jim,

            Thanks so much for your assistance. I caught the bug.
            Last edited by Rainmakersg; 10-26-2020, 08:37 PM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by DavidHP, Today, 07:56 AM
            0 responses
            0 views
            0 likes
            Last Post DavidHP
            by DavidHP
             
            Started by Aviram Y, 08-09-2023, 09:04 AM
            10 responses
            298 views
            0 likes
            Last Post MrHump
            by MrHump
             
            Started by jpapa, Today, 07:22 AM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by kevinenergy, 02-17-2023, 12:42 PM
            116 responses
            2,758 views
            1 like
            Last Post kevinenergy  
            Started by franatas, 12-04-2023, 03:43 AM
            7 responses
            106 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X