Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on restoring from backup file

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

    Error on restoring from backup file

    Hello,
    I am moving my NT8 to a VPS. During restoring my settings from the PC via backup file I received a series of errors. The errors I later found out to be related to an simple ATT stop indicator (copied below).
    The error message is:
    "Error compiling export assembly: c:\Users\Felhasználó\Documents\NinjaTrader 8\bin\Custom\Indicators\Stop_Indicators\ATRTrailin gStop.cs(62,18) : error CS0103: „ATR” not present in this context"
    The error code says that a variable is missing, however I had no errors with this indicator, and I use it in several strategies.
    I highlighted the row of the error with bold.
    My programming skills are very basic, so I don't have a clue what NT wants from me here.
    Can someone please help?

    Thanks;
    B.

    #region Using declarations
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Gui;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Gui.SuperDom;
    using NinjaTrader.Gui.Tools;
    using NinjaTrader.Data;
    using NinjaTrader.NinjaScript;
    using NinjaTrader.Core.FloatingPoint;
    using NinjaTrader.NinjaScript.DrawingTools;
    #endregion

    //This namespace holds Indicators in this folder and is required. Do not change it.
    namespace NinjaTrader.NinjaScript.Indicators.Stop_Indicators
    {
    public class ATRTrailingStop : Indicator
    {

    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Indicator as described in Sylvain Vervoort's 'Average True Range Trailing Stops' June 2009 S&C article.";
    Name = "ATRTrailingStop";
    Calculate = Calculate.OnBarClose;
    IsOverlay = true;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    Period = 5;
    Multi = 3.5;
    AddPlot(Brushes.Blue, "TrailingStop");
    }
    else if (State == State.Configure)
    {
    }
    else if (State == State.DataLoaded)
    {

    }
    }
    protected override void OnBarUpdate()
    {
    if (CurrentBar < 1)
    return;


    // Trailing stop
    double trail;
    double loss = ATR(Input, Period)[0] * Multi;

    if (Close[0] > Value[1] && Close[1] > Value[1])
    trail = Math.Max(Value[1], Close[0] - loss);

    else if (Close[0] < Value[1] && Close[1] < Value[1])
    trail = Math.Min(Value[1], Close[0] + loss);

    else if (Close[0] > Value[1])
    {
    trail = Close[0] - loss;

    }

    else
    {
    trail = Close[0] + loss;

    }

    Value[0] = trail;
    }

    #region Properties
    [NinjaScriptProperty]
    [Range(1, int.MaxValue)]
    [Display(Name="Period", Description="ATR period", Order=1, GroupName="Parameters")]
    public int Period
    { get; set; }

    [NinjaScriptProperty]
    [Range(1, double.MaxValue)]
    [Display(Name="Multi", Description="ATR multiplication", Order=2, GroupName="Parameters")]
    public double Multi
    { get; set; }

    [Browsable(false)]
    [XmlIgnore]
    public Series<double> TrailingStop
    {
    get { return Values[0]; }
    }
    #endregion

    }
    }

    #region NinjaScript generated code. Neither change nor remove.

    namespace NinjaTrader.NinjaScript.Indicators
    {
    public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
    {
    private Stop_Indicators.ATRTrailingStop[] cacheATRTrailingStop;
    public Stop_Indicators.ATRTrailingStop ATRTrailingStop(int period, double multi)
    {
    return ATRTrailingStop(Input, period, multi);
    }

    public Stop_Indicators.ATRTrailingStop ATRTrailingStop(ISeries<double> input, int period, double multi)
    {
    if (cacheATRTrailingStop != null)
    for (int idx = 0; idx < cacheATRTrailingStop.Length; idx++)
    if (cacheATRTrailingStop[idx] != null && cacheATRTrailingStop[idx].Period == period && cacheATRTrailingStop[idx].Multi == multi && cacheATRTrailingStop[idx].EqualsInput(input))
    return cacheATRTrailingStop[idx];
    return CacheIndicator<Stop_Indicators.ATRTrailingStop>(ne w Stop_Indicators.ATRTrailingStop(){ Period = period, Multi = multi }, input, ref cacheATRTrailingStop);
    }
    }
    }

    namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
    {
    public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
    {
    public Indicators.Stop_Indicators.ATRTrailingStop ATRTrailingStop(int period, double multi)
    {
    return indicator.ATRTrailingStop(Input, period, multi);
    }

    public Indicators.Stop_Indicators.ATRTrailingStop ATRTrailingStop(ISeries<double> input , int period, double multi)
    {
    return indicator.ATRTrailingStop(input, period, multi);
    }
    }
    }

    namespace NinjaTrader.NinjaScript.Strategies
    {
    public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
    {
    public Indicators.Stop_Indicators.ATRTrailingStop ATRTrailingStop(int period, double multi)
    {
    return indicator.ATRTrailingStop(Input, period, multi);
    }

    public Indicators.Stop_Indicators.ATRTrailingStop ATRTrailingStop(ISeries<double> input , int period, double multi)
    {
    return indicator.ATRTrailingStop(input, period, multi);
    }
    }
    }

    #endregion



    #2
    Forgot to add that error codes CS0234, CS0236 also come up.

    Comment


      #3
      Hello Balage0922,

      May I confirm you are doing a backup and restore?

      Tools > Export / Import > Backup File?




      As a tip, to export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
      1. Click Tools -> Export -> NinjaScript...
      2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
      3. Click the 'Export' button
      4. Enter a unique name for the file in the value for 'File name:'
      5. Choose a save location -> click Save
      6. Click OK to clear the export location message
      By default your exported file will be in the following location:
      • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
      Below is a link to the help guide on Exporting NinjaScripts.
      http://ninjatrader.com/support/helpG...-us/export.htm


      May we have a screenshot of the compile errors with the Error column fully expanded so we can read the full error message?
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Hi Chelsea,
        Yes, I exported a backup file from my PC and tried to import that one on the VPS, but an error message popped up that the backup file contains programming errors and the restore process cannot proceed, then NT exited/crashed. I tried to export some ninjascripts, and that is when the errors came up, pointing to the ATR stop indicator. these are the ones:
        ###### Default Error compiling export assembly: c:\Users\Felhasználó\Documents\NinjaTrader 8\bin\Custom\Strategies\ESdtr.cs(31,62) : error CS0234: The type or namespace name „ATRTrailingStop” does not exist in the namespace „NinjaTrader.NinjaScript.Indicators.Stop_Indicator s” ((are you missing an assembly reference?)
        ###### Default Error compiling export assembly: c:\Users\Felhasználó\Documents\NinjaTrader 8\bin\Custom\Indicators\Stop_Indicators\ATRTrailin gStop.cs(62,18) : error CS0103: „ATR”not present in this context"

        Comment


          #5
          Hello Balage0922,

          Is there an indicator with the name ATRTrailingStop that is in a custom namespace named Stop_Indicators

          Please follow the instructions below to see where the errors are coming from after compiling an indicator in NinjaTrader 8. This will allow you to debug the indicator/strategy or remove it from your PC. If you are wondering why you receive an error when compiling only one indicator, it is because NinjaTrader always compiles all indicators and strategies - not just one. This is done to give you the highest runtime performance possible.
          • Open NinjaTrader
          • From the Control Center click the New menu -> select NinjaScript Editor
          • On the right open a script such the Indicators -> ADL script
          • Right click in the window and select Compile to compile all scripts
          • At the bottom of the window a new section will appear where you can find the error locations.
          • From there you have the option to comment out offending code sections, correct references, remove the complete indicator, or debug it to be able to compile again.


          If you are unsure as to what the error is indicating, please send me a screenshot of the error with the error column fully expanded so that I may read the entire error message.

          (Click and drag on the small faint separator between column heads to expand that column)

          To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.
          Click here for instructions

          Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
          Click here for detailed instruction
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Hi Chelsea,
            Yes there is such an indicator but I never had any issues with it, nor have I altered anything in it. It compiles fine as it is (its the one I sent the code in the first post).
            It is this one: https://ninjatraderecosystem.com/use...trailing-stop/
            So strangely the only time I received errors indicating issues was when I tried to import my backup file. Then I tried to export only some strategies and this indicator, and the error messages appeared and exporting was not done.

            Comment


              #7
              Hello Balage0922,

              NinjaTrader doesn't agree.

              Did you compile?

              Were there no errors?

              If there were errors do you want to share them?
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                No, there are no errors, It compiles. I only receive errors in the log when I'm trying to export the ninjascripts.

                Comment


                  #9
                  I attached the Ninjascript Editor, there are no errors on the bottom of the window. Also I attached the list of errors I see in the log.
                  Attached Files

                  Comment


                    #10
                    Hi Balage0922,

                    I'm having a hard time translating the error message.

                    Can I have the text from this? (So the accent marks remain)

                    Just click the row then hit Ctrl + c on the keyboard to copy and then paste into your reply.

                    It might be that you need to add a reference or indicator to the export.

                    I was not able to confirm, did you compile?

                    Were there no errors?
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Yes I was able to compile, no errors come up. The error messages point to missing type or namesapace.
                      2019. 06. 23. 8:09:57 Default Error compiling export assembly: c:\Users\Felhasználó\Documents\NinjaTrader 8\bin\Custom\Indicators\Stop_Indicators\ATRTrailin gStop.cs(29,11) : error CS0246: A következő típus- vagy névtérnév nem található: „ATR” (esetleg hiányzik egy „using” direktíva vagy egy szerelvényre mutató hivatkozás).
                      2019. 06. 23. 8:08:41 Default Error compiling export assembly: c:\Users\Felhasználó\Documents\NinjaTrader 8\bin\Custom\Strategies\ESfrog.cs(33,62) : error CS0234: A(z) „ATRTrailingStop” típus- vagy névtérnév nem szerepel a(z) „NinjaTrader.NinjaScript.Indicators.Stop_Indicator s” névtérben (esetleg hiányzik egy szerelvényre mutató hivatkozás).

                      Comment


                        #12
                        Hello,

                        I've translated this as:
                        Error compiling export assembly: c: Users User Documents NinjaTrader 8 bin Custom Indicators Stop_IndicatorsTRTrailin gStop.cs (29.11): error CS0246: The following type or namespace name was not found: "ATR" (there may be a "using" directive or a link to an assembly).

                        Was the ATR indicator deleted on accident?

                        Can you apply the ATR indicator to a chart by itself?
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Yes the indicator is in the library and also running:
                          Attached Files

                          Comment


                            #14
                            Hello Balage0922,

                            This is Jim, responding on behalf of Chelsea who is out of the office at this time.

                            It sounds like the ATRTrailingStop indicator is looking for the ATR indicator in a different namespace. The original conversion that NinjaTrader_Jesse posted does not place any code in custom namespaces.

                            I suggest removing the current ATRTrailingStop indicator that is on your system and to re-import the AddOn from the User App Share. You can do this by navigating to the Documents\NinjaTrader 8\bin\Custom\Indicators\Stop_Indicators\ folder and to remove the indicator from those folder.

                            Once it is removed, please recompile NinjaScripts in the NinjaScript Editor.

                            Once the system compiles without errors, please reimport the ATRTrailingStop indicator from the User App Share.

                            Please let us know the results of these steps.
                            JimNinjaTrader Customer Service

                            Comment


                              #15
                              Hi Jim,
                              sorry but Im not totaly sure what you mean by "does not place any code in custom namespaces". IS the problem that I moved the indicator to a custom folder? If it is in the main indicator folder, it should work?
                              Thanks

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by ghoul, Today, 06:02 PM
                              3 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              44 views
                              0 likes
                              Last Post jeronymite  
                              Started by Barry Milan, Yesterday, 10:35 PM
                              7 responses
                              20 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by AttiM, 02-14-2024, 05:20 PM
                              10 responses
                              180 views
                              0 likes
                              Last Post jeronymite  
                              Started by DanielSanMartin, Yesterday, 02:37 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post DanielSanMartin  
                              Working...
                              X