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

resurrecting a old indictor...

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

    resurrecting a old indictor...

    Hey Forum experts,

    Getting a few errors, looking for insight on addressing them. Thanks for any direction.

    When compile is complete errors are of this type:

    Indicator\@CandleStickPattern.cs,The name 'MIN' does not exist in the current context,CS0103 - click for info,

    Indicator\@DonchianChannel.cs, The name 'MAX' does not exist in the current context,CS0103 - click for info

    I am thinking that it is having problems with declared variables that are inside an other indicator. @MIN,@MAX,@SUM of different indicators should be able to be read if they are still available.
    Attached Files

    #2
    Hello Brian63SPR, and thank you for your question. It is likely that this script wasn't installed to your (My) Documents\NinjaTrader 7\bin\Custom\Indicators directory. When it is installed into this directory, the attached compile messages are attached to this reply. Please let us know if there are any other ways we can help.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      DrawText line

      @NinjaTrader_JessicaP,

      Thanks for the insight, and the attached compiled messages.

      My file seems to being point 7 remaining error that are all the same. "No overload for method 'DrawText' takes '11' arguments" CS1501, on 7 different lines.


      Line 166 DrawText(string.Format("hi{0}",Time[hiPeaks[index].BarsBack].TimeOfDay),true,string.Format("{0}",index+1), hiPeaks[index].BarsBack, y, Color.White, myFont,StringAlignment.Center,Color.Red,Color.Red, 60 );

      Line 177
      DrawText(string.Format("lo{0}",Time[loPeaks[index].BarsBack].TimeOfDay),true,string.Format("{0}",index+1),loPe aks[index].BarsBack, y, Color.White, myFont,StringAlignment.Center,Color.Green,Color.Gr een,60 );

      The way I understand an overload error is that one of my parameter has more arguments than needed. But looking at the DrawText:

      DrawText(string tag, bool autoScale, string text, DateTime time, double y, int yPixelOffset, Color textColor, Font font, StringAlignment alignment, Color outlineColor, Color areaColor, int areaOpacity)

      I think I have covered correctly, but I must not being seeing it... Any direction that might help push me to solving this. Thoughts? Tks. Brian

      Comment


        #4
        Thank you for this additional information. The way I like to debug these kinds of things is to first start with the overload we would like to try to use :

        Code:
        DrawText(string tag, bool autoScale, string text, DateTime time, double y, int yPixelOffset, Color textColor, Font font, StringAlignment alignment, Color outlineColor, Color areaColor, int areaOpacity)
        Let's explode that out into variables and turn this into code we can execute :

        Code:
        string tag = 
        bool autoScale = 
        string text = 
        DateTime time = 
        double y = 
        int yPixelOffset = 
        Color textColor = 
        Font font = 
        StringAlignment alignment = 
        Color outlineColor = 
        Color areaColor = 
        int areaOpacity = 
        DrawText(tag, autoScale, text, time, y, yPixelOffset, textColor, font, alignment, outlineColor, areaColor, areaOpacity);
        Now let's try to fill out those variables from your code :

        Code:
        // DrawText(string.Format("hi{0}",Time[hiPeaks[index].BarsBack].TimeOfDay),true,string.Format("{0}",index+1), hiPeaks[index].BarsBack, y, Color.White, myFont,StringAlignment.Center,Color.Red,Color.Red, 60 );
        
        string tag = string.Format("hi{0}",Time[hiPeaks[index].BarsBack].TimeOfDay);
        bool autoScale = true;
        string text = string.Format("{0}",index+1);
        DateTime time = hiPeaks[index].BarsBack;
        double y = y;
        
        int yPixelOffset = 
        
        Color textColor = Color.White;
        Font font = myFont;
        StringAlignment alignment = StringAlignment.Center;
        Color outlineColor = Color.Red;
        Color areaColor = Color.Red;
        int areaOpacity = 60;
        DrawText(tag, autoScale, text, time, y, yPixelOffset, textColor, font, alignment, outlineColor, areaColor, areaOpacity);
        From this we can see that you will need to specify a yPixelOffset. Please let us know if there are any other ways we can help.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Error CS0101 - click for info

          After clearing my last errors (Tks going out to NinjaTrader_JessicaP...u rock in teaching. I cleared all 7 DrawText line errors) , it seems that I step thru the indicator program to now find my next challenge.

          Error CS0101 - click for info..
          Unfortunately we do not have NinjaScript context based Help information on this specific error code.

          Indicator\MyCustomIndicator1.cs The namespace 'NinjaTrader.Indicator' already contains a definition for 'peakDetail' CS0101 - click for info 400 15

          Any thoughts, direction? Thanks

          Brian
          Attached Files

          Comment


            #6
            This indicates that you have more than one C# file which contains the word peakDetail in a shared namespace. To find out which one please follow these instructions.

            • Hold down the windows key (to the left of the space bar) and press the letter r
            • Type "powershell" in the window that comes up
            • Enter this command into the powershell window

              cd "$env:UserProfile\Documents\NinjaTrader 7\bin\Custom"

              and press enter
            • Enter this command into the powershell window

              ls * -r | sls 'peakDetail' | select -u -exp path | sls '\.cs$'

              and press enter

            Once you know which files have this symbol, remove any duplicate files. If you have to pick between a file in e.g. bin\Custom and bin\Custom\Indicator or bin\Custom\Strategy, keep the file in bin\Custom\Indicator or bin\Custom\Strategy. Once you have removed any duplicate files, run that command again, and edit any remaining files, making decisions about which ones need this symbol and which ones don't, until you only have one file with this symbol.
            Last edited by NinjaTrader_JessicaP; 01-26-2017, 02:59 PM.
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Question on editors, and new coding error

              Hey NinjaTrader_JessicaP, That was great, found a second file I was using to save my place if I had screwup in the file editor. Thanks for teaching. I am loving my growth, thank you.

              After deleting the second file that had contain the word peakDetail in a shared namespace, I resave current, than compiled but almost came up with even more and new errors that just don't make sense. The errors seam to be pointing to other indicators again. Like the time before, but when I asked for help, you pointed me to the 7 DrawText lines. Which was a great help, but it seems this editor that I am using within NinjaTrader has its short comings/ miss leading/ ...etc...

              Can you direct me on these new errors and maybe point to an editor outside of ninjatrader?

              Brian

              Indicator\@CandleStickPattern.cs The name 'MIN' does not exist in the current context CS0103 - click for info 400 25
              Indicator\@DonchianChannel.cs The name 'MAX' does not exist in the current context CS0103 - click for info 48 14
              Indicator\@ChaikinMoneyFlow.cs 'NinjaTrader.Indicator.SUM' is a 'type' but is used like a 'variable' CS0118 - click for info 47 20
              Attached Files

              Comment


                #8
                I am glad we are making progress. Since these are built-in indicators, this means that the cause of this is likely due to your installation being in an inconsistent state. Please follow this procedure to repair your installation. Please let us know if this does not succeed, we may need to attempt to connect with you directly. If we do we can always be reached at platformsupport[at]ninjatrader[dot]com and you can reach me directly with Attn:NinjaTrader_JessicaP and 1649202 in the subject line.
                Please follow these steps to completely uninstall and reinstall NinjaTrader 7 on your system.


                • Download a fresh copy of NinjaTrader 7 from ninjatrader.com
                • Close NinjaTrader 7
                  • To ensure NinjaTrader is closed completely, please press the windows key (to the left of the space bar) and the letter r at the same time, and type in
                    taskkill /f /im NinjaTrader.exe
                    and press enter
                • Rename your (My) Documents\NinjaTrader 7\db\NinjaTrader.sdf file to something unique. I prefer names that include today's date
                • Rename your (My) Documents\NinjaTrader 7 folder to something else that is unique. I prefer names that include today's date.
                • Use the installer you downloaded to uninstall, and then reinstall, NinjaTrader 7
                • Copy these files and folders from your old, renamed (My) Documents\NinjaTrader 7 folder to your new folder. If asked to replace files, always select "yes"
                  • Config.xml
                  • UI.xml
                  • workspaces
                  • templates
                  • all .dll files in bin\Custom except these :
                    • NinjaTrader.Custom.dll
                    • NinjaTrader.Vendor.dll
                  • all .cs files in bin\Custom except these :
                    • NinjaTrader.Custom.cs
                    • NinjaTrader.Vendor.cs
                    • AssemblyInfo.cs
                  • any subfolder of bin\Custom that has a .cs file that does not start with an @ sign
                • Start NinjaTrader 7. You will receive some dialogs about Ninja being unable to start because it needed to recompile some dlls. OK out of these dialogs
                • Start NinjaTrader 7 once more

                Jessica P.NinjaTrader Customer Service

                Comment


                  #9
                  excellent service Jessica!

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by PaulMohn, Today, 05:00 AM
                  0 responses
                  8 views
                  0 likes
                  Last Post PaulMohn  
                  Started by ZenCortexAuCost, Today, 04:24 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post ZenCortexAuCost  
                  Started by ZenCortexAuCost, Today, 04:22 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post ZenCortexAuCost  
                  Started by SantoshXX, Today, 03:09 AM
                  0 responses
                  16 views
                  0 likes
                  Last Post SantoshXX  
                  Started by DanielTynera, Today, 01:14 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post DanielTynera  
                  Working...
                  X