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

Modified Indicator Problem

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

    Modified Indicator Problem

    Hi,

    I am trying to modify the standard Darvas box indicator to provide buy and sell signals. I have added buy and sell (up & down) arrows to the indicator, but want to add one additional condition to the sell signal requirement.

    I am simply having trouble with an "if" statement in which I want two conditions to be satisfied before printing the arrow. I'm just having trouble getting a current and last value for the "boxTop" variable. I'm trying to do this as simply as possible. I've attached the program for review. Line 81 is the trouble spot where I'm stuck. Since I am pretty poor with ninjascript, I'm hoping I can get a little help as this is the only remaining part I'm trying to solve.

    Thank you,

    Lee
    Attached Files

    #2
    Hello lee612801,

    Thanks for the file.

    boxTop is a double therefore it does not have a series of data but only the one instance of the object. If you want to store values to look back into you may want to use a DataSeries object so you can store calculations and use the "[]" bracket method for boxTop instead of a double;

    You may see the following thread that gives an example of using a DataSeries object to store calculations.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thanks JC,

      before I get back to the programming issue, i now have another issue I have never seen. I have been working with the ninjascript editor for this indicator. Now, if i try to import or export a ninjascript, i get an error saying "You have custom Ninjascript files on your PC that have programming errors. These errors must be resolved before you can import a Ninjascript archive file". I have no idea why this happened and no clue how to go about fixing it. I have not had this problem before and don't know what to do. i tried restarting the system, but that did not work.

      Please Help! Do you think the application is hosed, or is there a way to fix this?

      Thanks,

      Lee

      Comment


        #4
        Hello Lee,

        This will be because of the syntax issue with Line 81 of your code in DarvasMod.cs as you cannot apply indexing with [] to an express of a double type.

        So you can either comment out Line 81 to get your code to a compilable state or remove the "[]" indexing brackets and right click inside the DarvasMod.cs to make sure it is in a compilable state. Note that errors will be shown at the botttom of the NinjaScript Editor.
        JCNinjaTrader Customer Service

        Comment


          #5
          JC,

          Thanks! Your the man.

          Now I can get back to my editing.

          Lee

          Comment


            #6
            Hi JC,

            Got the little problem with the script fixed based on your last reply. Thanks!

            So I tried adding a dataseries to the script, but still cant seem to get the condition. The variable "boxTop" has values linked to it.

            All I would like is to compare the current "boxTop" value to the last (one bar ago) "boxTop" value. So I used the example you provided to try and store the values so I can retrieve them. I should be getting a true condition, but don't get anything... (Line 87 - 90)

            I'm once again hoping you can help. The values are there for "boxTop", just cant seem to get the condition to do anything even when I know the current value is less than the previous days value.

            Thanks,

            Lee
            Attached Files

            Comment


              #7
              Hello Lee,
              The boxTop variable is used to set value to the Upper data series. Thus instead of using a new data series you can simply refer it as


              Code:
              Upper[0] < Upper[1]  //instead of using if (myDataSeries[0] < myDataSeries[1])
              {
              //do something
              }

              What the value will be depend on what you are trying to do.

              Unfortunately we do not debug custom codes, you can however refer to this post which further illustrates how to debug your code via NinjaTrader
              JoydeepNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by CortexZenUSA, Today, 12:53 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by CortexZenUSA, Today, 12:46 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by usazencortex, Today, 12:43 AM
              0 responses
              5 views
              0 likes
              Last Post usazencortex  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              168 responses
              2,266 views
              0 likes
              Last Post sidlercom80  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              13 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X