Announcement

Collapse
No announcement yet.

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.
    http://www.ninjatrader.com/support/f...ead.php?t=7299
    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
              http://www.ninjatrader.com/support/f...ead.php?t=3418
              JoydeepNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Nmnsirwse, Today, 07:35 PM
              0 responses
              3 views
              0 likes
              Last Post Nmnsirwse  
              Started by i2w8am9ii2, Today, 04:36 PM
              2 responses
              13 views
              0 likes
              Last Post i2w8am9ii2  
              Started by WeyldFalcon, Today, 02:07 PM
              2 responses
              14 views
              0 likes
              Last Post WeyldFalcon  
              Started by hfwiley, Today, 03:02 PM
              2 responses
              19 views
              0 likes
              Last Post hfwiley
              by hfwiley
               
              Started by pdennis, Today, 02:34 PM
              3 responses
              21 views
              0 likes
              Last Post NinjaTrader_ChrisL  
              Working...
              X