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

Does anyone knows how to use export values from a third party indicator?

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

    Does anyone knows how to use export values from a third party indicator?

    Thank you in Advance. I got an indicator from Ninjacator called Golden Reversal Line, their documentation just says: "The indicator is NinjaScript and BloodHound Ready. The exposed values are: Signal[0] which is 1 on long reverse, -1 on short reversal."; I have being in communication with Ninjacator but apparently they don't know how to do it since they say they only sell the indicators and don't have knowledge of the coding side. All I want to be able to do is to do a simple buy or sell depending if it Signal[0]=1 or =-1. I though it was going to be simple like saying if(ncatGoldenReversalLine.Signal[0]==1){ buy}. However, this is not the case, does anyone has any experience doing this and recognized the type or return and exposed values in this indicator?

    I found the CS file and it has the below information:

    #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;

    #endregion



    #region NinjaScript generated code. Neither change nor remove.

    namespace NinjaTrader.NinjaScript.Indicators
    {
    public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
    {

    private ncatGoldenReversalLine[] cachencatGoldenReversalLine;


    public ncatGoldenReversalLine ncatGoldenReversalLine()
    {
    return ncatGoldenReversalLine(Input);
    }



    public ncatGoldenReversalLine ncatGoldenReversalLine(ISeries<double> input)
    {
    if (cachencatGoldenReversalLine != null)
    for (int idx = 0; idx < cachencatGoldenReversalLine.Length; idx++)
    if ( cachencatGoldenReversalLine[idx].EqualsInput(input))
    return cachencatGoldenReversalLine[idx];
    return CacheIndicator<ncatGoldenReversalLine>(new ncatGoldenReversalLine(), input, ref cachencatGoldenReversalLine);
    }

    }
    }

    namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
    {
    public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
    {

    public Indicators.ncatGoldenReversalLine ncatGoldenReversalLine()
    {
    return indicator.ncatGoldenReversalLine(Input);
    }



    public Indicators.ncatGoldenReversalLine ncatGoldenReversalLine(ISeries<double> input )
    {
    return indicator.ncatGoldenReversalLine(input);
    }

    }
    }

    namespace NinjaTrader.NinjaScript.Strategies
    {
    public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
    {

    public Indicators.ncatGoldenReversalLine ncatGoldenReversalLine()
    {
    return indicator.ncatGoldenReversalLine(Input);
    }



    public Indicators.ncatGoldenReversalLine ncatGoldenReversalLine(ISeries<double> input )
    {
    return indicator.ncatGoldenReversalLine(input);
    }

    }
    }

    #endregion

    #2
    However, this is not the case, ...
    What does that mean?
    Are there any error messages in the log?
    It sounds like you are talking about a Strategy. Are you? Have you enabled the Strategy? (Looks like a silly question, but it has caught me multiple times. Still sometimes does.)
    Have you checked if you ever do actually get a Signal value that you expect?

    Comment


      #3
      Hello zaro33,

      I recommend you add the indicator to the chart directly and check the plots section to see what plots are available.

      The Intelliprompt can be helpful to see what plots are available from the script.

      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Koganam, basically ncatGoldenReversalLine is a third party Indicator. I am able to put the indicator on a regular price chart and see the trend lines which is green for long and red for short. The way the indicator works is that it will create a dot when prices breaks the trend line which is what Signal[0]=1 and Signal[0]=-1 means, I would assume. I am trying to create a strategy where if I get a signal[0]=1 or -1 then I will buy or sell. I know very basic programming so am just asking to see if anyone knows how to implement it on my strategy.

        ChelseaB the method I get are #1 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine(ISeries<double> input) and #2 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine()

        So I decided to try and plot the indicator on my strategy first just to start with the basic to see if I can get it to plot. I am using the strategy analyzer to make sure it would show the indicator so I wrote the small program below:

        I first try using GRL = ncatGoldenReversalLine(); which it compiled but when I try running it on the Strategy Analyzer, ninjatrader crashes and it give me the error "Unhandled exception: Object reference not set to an instance of an object.";

        Then I try GRL = ncatGoldenReversalLine("111", 0, true, 5); but it gives me the error that states "No overload for method 'ncatGoldenReversalLine' takes 4 arguments". Now, the reason why I used the values of ("111",0,true,5) is because ninjacator finally send me a file called "SampleGoldenReversal.cs", but unfortunately it did not compile and it has alot of errors (I will put it below as well). The file "SampleGoldenReversal.cs" was supposed to be a sample code that they found that was supposed to help me how to use Signal[0]. From my understanding I can only guess a few of the values that they had on their sample code I assume "111" is for Orderid, 0 is for a parameter called shift and 5 is for a parameter called Strength, but not sure whats with the "true" as I don't see any other parameter or anything in the indicator window that has a a bool type of selection. Anyway, I have try other combination like GRL = ncatGoldenReversalLine("111", 0, 5) and still get similar error like "No overload for method 'ncatGoldenReversalLine' takes 3 arguments".

        ------------------->THIS IS MY CODE, WHERE I TRY TO PLOT ncatGoldenReversalLine indicator<------------------------------------------
        namespace NinjaTrader.NinjaScript.Strategies
        {
        public class zz : Strategy
        {
        public ncatGoldenReversalLine GRL;
        private double x;

        protected override void OnStateChange()
        {
        if (State == State.SetDefaults)
        {
        Description = @"Enter the description for your new custom Strategy here.";
        Name = "zz";
        Calculate = Calculate.OnBarClose;
        EntriesPerDirection = 1;
        EntryHandling = EntryHandling.AllEntries;
        IsExitOnSessionCloseStrategy = true;
        ExitOnSessionCloseSeconds = 30;
        IsFillLimitOnTouch = false;
        MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
        OrderFillResolution = OrderFillResolution.Standard;
        Slippage = 0;
        StartBehavior = StartBehavior.WaitUntilFlat;
        TimeInForce = TimeInForce.Gtc;
        TraceOrders = false;
        RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
        StopTargetHandling = StopTargetHandling.PerEntryExecution;
        BarsRequiredToTrade = 20;
        // Disable this property for performance gains in Strategy Analyzer optimizations
        // See the Help Guide for additional information
        IsInstantiatedOnEachOptimizationIteration = true;
        }
        else if (State == State.Configure)
        {
        }
        else if (State == State.DataLoaded)
        {
        GRL = ncatGoldenReversalLine("111", 0, true, 5);
        // GRL = ncatGoldenReversalLine();
        ​​​​ GRL.Plots[0].Brush = Brushes.Goldenrod;
        AddChartIndicator(GRL);

        }
        }

        protected override void OnBarUpdate()
        {
        if (BarsInProgress != 0)
        return;

        if (CurrentBars[0] < 1)
        return;

        }
        }
        }
        -----------------------------------------------------------------------------------------------------------------------------------------------------



        The attach sample code they send me to help me write my own code did not compile, it has many issues that states "The type or namspace name "Drawing2D" does not exist in the namespace "System.Drawing" (are you missing an assembly reference?) Which I read about it but could not really find how to fix that.

        Attached Files

        Comment


          #5
          Koganam, basically ncatGoldenReversalLine is a third party Indicator. I am able to put the indicator on a regular price chart and see the trend lines which is green for long and red for short. The way the indicator works is that it will create a dot when prices breaks the trend line which is what Signal[0]=1 and Signal[0]=-1 means, I would assume. I am trying to create a strategy where if I get a signal[0]=1 or -1 then I will buy or sell. I know very basic programming so am just asking to see if anyone knows how to implement it on my strategy.

          ChelseaB the method I get are #1 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine(ISeries&lt;double& gt; input) and #2 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine()

          So I decided to try and plot the indicator on my strategy first just to start with the basic to see if I can get it to plot. I am using the strategy analyzer to make sure it would show the indicator so I wrote the small program below:

          I first try using GRL = ncatGoldenReversalLine(); which it compiled but when I try running it on the Strategy Analyzer, ninjatrader crashes and it give me the error "Unhandled exception: Object reference not set to an instance of an object.";

          Then I try GRL = ncatGoldenReversalLine("111", 0, true, 5); but it gives me the error that states "No overload for method 'ncatGoldenReversalLine' takes 4 arguments". Now, the reason why I used the values of ("111",0,true,5) is because ninjacator finally send me a file called "SampleGoldenReversal.cs", but unfortunately it did not compile and it has alot of errors (I will attach it as a text file). The file "SampleGoldenReversal.cs" was supposed to be a sample code that they found that was supposed to help me how to use Signal[0]. From my understanding I can only guess a few of the values that they had on their sample code I assume "111" is for Orderid, 0 is for a parameter called shift and 5 is for a parameter called Strength, but not sure whats with the "true" as I don't see any other parameter or anything in the indicator window that has a a bool type of selection. Anyway, I have try other combination like GRL = ncatGoldenReversalLine("111", 0, 5) and still get similar error like "No overload for method 'ncatGoldenReversalLine' takes 3 arguments".

          -------------------&gt;THIS IS MY CODE, WHERE I TRY TO PLOT ncatGoldenReversalLine indicator&lt;------------------------------------------
          namespace NinjaTrader.NinjaScript.Strategies
          {
          public class zz : Strategy
          {
          public ncatGoldenReversalLine GRL;
          private double x;

          protected override void OnStateChange()
          {
          if (State == State.SetDefaults)
          {
          Description = @"Enter the description for your new custom Strategy here.";
          Name = "zz";
          Calculate = Calculate.OnBarClose;
          EntriesPerDirection = 1;
          EntryHandling = EntryHandling.AllEntries;
          IsExitOnSessionCloseStrategy = true;
          ExitOnSessionCloseSeconds = 30;
          IsFillLimitOnTouch = false;
          MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
          OrderFillResolution = OrderFillResolution.Standard;
          Slippage = 0;
          StartBehavior = StartBehavior.WaitUntilFlat;
          TimeInForce = TimeInForce.Gtc;
          TraceOrders = false;
          RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
          StopTargetHandling = StopTargetHandling.PerEntryExecution;
          BarsRequiredToTrade = 20;
          // Disable this property for performance gains in Strategy Analyzer optimizations
          // See the Help Guide for additional information
          IsInstantiatedOnEachOptimizationIteration = true;
          }
          else if (State == State.Configure)
          {
          }
          else if (State == State.DataLoaded)
          {
          GRL = ncatGoldenReversalLine("111", 0, true, 5);
          // GRL = ncatGoldenReversalLine();
          ​​​​ GRL.Plots[0].Brush = Brushes.Goldenrod;
          AddChartIndicator(GRL);

          }
          }

          protected override void OnBarUpdate()
          {
          if (BarsInProgress != 0)
          return;

          if (CurrentBars[0] &lt; 1)
          return;

          }
          }
          }
          -----------------------------------------------------------------------------------------------------------------------------------------------------




          This attached code is the sample code they send me to help me write my own code, but it did not compile, it has many issues that states "The type or namspace name "Drawing2D" does not exist in the namespace "System.Drawing" (are you missing an assembly reference?) Which I read about it but could not really find how to fix that.
          Attached Files

          Comment


            #6
            Koganam, basically ncatGoldenReversalLine is a third party Indicator. I am able to put the indicator on a regular price chart and see the trend lines which is green for long and red for short. The way the indicator works is that it will create a dot when prices breaks the trend line which is what Signal[0]=1 and Signal[0]=-1 means, I would assume. I am trying to create a strategy where if I get a signal[0]=1 or -1 then I will buy or sell. I know very basic programming so am just asking to see if anyone knows how to implement it on my strategy.

            ChelseaB the method I get are #1 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine(ISeries<double> input) and #2 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine()

            So I decided to try and plot the indicator on my strategy first just to start with the basic to see if I can get it to plot. I am using the strategy analyzer to make sure it would show the indicator so I wrote the small program below:

            I first try using GRL = ncatGoldenReversalLine(); which it compiled but when I try running it on the Strategy Analyzer, ninjatrader crashes and it give me the error "Unhandled exception: Object reference not set to an instance of an object.";

            Then I try GRL = ncatGoldenReversalLine("111", 0, true, 5); but it gives me the error that states "No overload for method 'ncatGoldenReversalLine' takes 4 arguments". Now, the reason why I used the values of ("111",0,true,5) is because ninjacator finally send me a file called "SampleGoldenReversal.cs", but unfortunately it did not compile and it has alot of errors (I will attach it). The file "SampleGoldenReversal.cs" was supposed to be a sample code that they found that was supposed to help me how to use Signal[0]. From my understanding I can only guess a few of the values that they had on their sample code I assume "111" is for Orderid, 0 is for a parameter called shift and 5 is for a parameter called Strength, but not sure whats with the "true" as I don't see any other parameter or anything in the indicator window that has a a bool type of selection. Anyway, I have try other combination like GRL = ncatGoldenReversalLine("111", 0, 5) and still get similar error like "No overload for method 'ncatGoldenReversalLine' takes 3 arguments".

            ------------------->THIS IS MY CODE, WHERE I TRY TO PLOT ncatGoldenReversalLine indicator<------------------------------------------
            namespace NinjaTrader.NinjaScript.Strategies
            {
            public class zz : Strategy
            {
            public ncatGoldenReversalLine GRL;
            private double x;

            protected override void OnStateChange()
            {
            if (State == State.SetDefaults)
            {
            Description = @"Enter the description for your new custom Strategy here.";
            Name = "zz";
            Calculate = Calculate.OnBarClose;
            EntriesPerDirection = 1;
            EntryHandling = EntryHandling.AllEntries;
            IsExitOnSessionCloseStrategy = true;
            ExitOnSessionCloseSeconds = 30;
            IsFillLimitOnTouch = false;
            MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
            OrderFillResolution = OrderFillResolution.Standard;
            Slippage = 0;
            StartBehavior = StartBehavior.WaitUntilFlat;
            TimeInForce = TimeInForce.Gtc;
            TraceOrders = false;
            RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
            StopTargetHandling = StopTargetHandling.PerEntryExecution;
            BarsRequiredToTrade = 20;
            // Disable this property for performance gains in Strategy Analyzer optimizations
            // See the Help Guide for additional information
            IsInstantiatedOnEachOptimizationIteration = true;
            }
            else if (State == State.Configure)
            {
            }
            else if (State == State.DataLoaded)
            {
            GRL = ncatGoldenReversalLine("111", 0, true, 5);
            // GRL = ncatGoldenReversalLine();
            ​​​​ GRL.Plots[0].Brush = Brushes.Goldenrod;
            AddChartIndicator(GRL);

            }
            }

            protected override void OnBarUpdate()
            {
            if (BarsInProgress != 0)
            return;

            if (CurrentBars[0] < 1)
            return;

            }
            }
            }
            -----------------------------------------------------------------------------------------------------------------------------------------------------




            This attached sample code they send me was to help me write my own code, but it did not compile, it has many issues that states "The type or namspace name "Drawing2D" does not exist in the namespace "System.Drawing" (are you missing an assembly reference?) Which I read about it but could not really find how to fix that.

            Comment


              #7
              Koganam, basically ncatGoldenReversalLine is a third party Indicator. I am able to put the indicator on a regular price chart and see the trend lines which is green for long and red for short. The way the indicator works is that it will create a dot when prices breaks the trend line which is what Signal[0]=1 and Signal[0]=-1 means, I would assume. I am trying to create a strategy where if I get a signal[0]=1 or -1 then I will buy or sell. I know very basic programming so am just asking to see if anyone knows how to implement it on my strategy.

              ChelseaB the method I get are #1 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine(ISeries<double> input) and #2 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine()

              So I decided to try and plot the indicator on my strategy first just to start with the basic to see if I can get it to plot. I am using the strategy analyzer to make sure it would show the indicator so I wrote the small program below:

              I first try using GRL = ncatGoldenReversalLine(); which it compiled but when I try running it on the Strategy Analyzer, ninjatrader crashes and it give me the error "Unhandled exception: Object reference not set to an instance of an object.";

              Then I try GRL = ncatGoldenReversalLine("111", 0, true, 5); but it gives me the error that states "No overload for method 'ncatGoldenReversalLine' takes 4 arguments". Now, the reason why I used the values of ("111",0,true,5) is because ninjacator finally send me a file called "SampleGoldenReversal.cs", but unfortunately it did not compile and it has alot of errors (I will attach it). The file "SampleGoldenReversal.cs" was supposed to be a sample code that they found that was supposed to help me how to use Signal[0]. From my understanding I can only guess a few of the values that they had on their sample code I assume "111" is for Orderid, 0 is for a parameter called shift and 5 is for a parameter called Strength, but not sure whats with the "true" as I don't see any other parameter or anything in the indicator window that has a a bool type of selection. Anyway, I have try other combination like GRL = ncatGoldenReversalLine("111", 0, 5) and still get similar error like "No overload for method 'ncatGoldenReversalLine' takes 3 arguments".

              ------------------->THIS IS MY CODE, WHERE I TRY TO PLOT ncatGoldenReversalLine indicator<------------------------------------------
              namespace NinjaTrader.NinjaScript.Strategies
              {
              public class zz : Strategy
              {
              public ncatGoldenReversalLine GRL;
              private double x;

              protected override void OnStateChange()
              {
              if (State == State.SetDefaults)
              {
              Description = @"Enter the description for your new custom Strategy here.";
              Name = "zz";
              Calculate = Calculate.OnBarClose;
              EntriesPerDirection = 1;
              EntryHandling = EntryHandling.AllEntries;
              IsExitOnSessionCloseStrategy = true;
              ExitOnSessionCloseSeconds = 30;
              IsFillLimitOnTouch = false;
              MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
              OrderFillResolution = OrderFillResolution.Standard;
              Slippage = 0;
              StartBehavior = StartBehavior.WaitUntilFlat;
              TimeInForce = TimeInForce.Gtc;
              TraceOrders = false;
              RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
              StopTargetHandling = StopTargetHandling.PerEntryExecution;
              BarsRequiredToTrade = 20;
              // Disable this property for performance gains in Strategy Analyzer optimizations
              // See the Help Guide for additional information
              IsInstantiatedOnEachOptimizationIteration = true;
              }
              else if (State == State.Configure)
              {
              }
              else if (State == State.DataLoaded)
              {
              GRL = ncatGoldenReversalLine("111", 0, true, 5);
              // GRL = ncatGoldenReversalLine();
              ​​​​ GRL.Plots[0].Brush = Brushes.Goldenrod;
              AddChartIndicator(GRL);

              }
              }

              protected override void OnBarUpdate()
              {
              if (BarsInProgress != 0)
              return;

              if (CurrentBars[0] < 1)
              return;

              }
              }
              }
              -----------------------------------------------------------------------------------------------------------------------------------------------------




              This attached sample code they send me was to help me write my own code, but it did not compile, it has many issues that states "The type or namspace name "Drawing2D" does not exist in the namespace "System.Drawing" (are you missing an assembly reference?) Which I read about it but could not really find how to fix that.

              Attached Files

              Comment


                #8
                Koganam, basically ncatGoldenReversalLine is a third party Indicator. I am able to put the indicator on a regular price chart and see the trend lines which is green for long and red for short. The way the indicator works is that it will create a dot when prices breaks the trend line which is what Signal[0]=1 and Signal[0]=-1 means, I would assume. I am trying to create a strategy where if I get a signal[0]=1 or -1 then I will buy or sell. I know very basic programming so am just asking to see if anyone knows how to implement it on my strategy.

                ChelseaB the method I get are #1 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine(ISeries<double> input) and #2 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine()

                So I decided to try and plot the indicator on my strategy first just to start with the basic to see if I can get it to plot. I am using the strategy analyzer to make sure it would show the indicator so I wrote the small program below:

                I first try using GRL = ncatGoldenReversalLine(); which it compiled but when I try running it on the Strategy Analyzer, ninjatrader crashes and it give me the error "Unhandled exception: Object reference not set to an instance of an object.";

                Then I try GRL = ncatGoldenReversalLine("111", 0, true, 5); but it gives me the error that states "No overload for method 'ncatGoldenReversalLine' takes 4 arguments". Now, the reason why I used the values of ("111",0,true,5) is because ninjacator finally send me a file called "SampleGoldenReversal.cs", but unfortunately it did not compile and it has alot of errors (I will attach it). The file "SampleGoldenReversal.cs" was supposed to be a sample code that they found that was supposed to help me how to use Signal[0]. From my understanding I can only guess a few of the values that they had on their sample code I assume "111" is for Orderid, 0 is for a parameter called shift and 5 is for a parameter called Strength, but not sure whats with the "true" as I don't see any other parameter or anything in the indicator window that has a a bool type of selection. Anyway, I have try other combination like GRL = ncatGoldenReversalLine("111", 0, 5) and still get similar error like "No overload for method 'ncatGoldenReversalLine' takes 3 arguments".

                ------------------->THIS IS MY CODE, WHERE I TRY TO PLOT ncatGoldenReversalLine indicator<------------------------------------------
                namespace NinjaTrader.NinjaScript.Strategies
                {
                public class zz : Strategy
                {
                public ncatGoldenReversalLine GRL;
                private double x;

                protected override void OnStateChange()
                {
                if (State == State.SetDefaults)
                {
                Description = @"Enter the description for your new custom Strategy here.";
                Name = "zz";
                Calculate = Calculate.OnBarClose;
                EntriesPerDirection = 1;
                EntryHandling = EntryHandling.AllEntries;
                IsExitOnSessionCloseStrategy = true;
                ExitOnSessionCloseSeconds = 30;
                IsFillLimitOnTouch = false;
                MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
                OrderFillResolution = OrderFillResolution.Standard;
                Slippage = 0;
                StartBehavior = StartBehavior.WaitUntilFlat;
                TimeInForce = TimeInForce.Gtc;
                TraceOrders = false;
                RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
                StopTargetHandling = StopTargetHandling.PerEntryExecution;
                BarsRequiredToTrade = 20;
                // Disable this property for performance gains in Strategy Analyzer optimizations
                // See the Help Guide for additional information
                IsInstantiatedOnEachOptimizationIteration = true;
                }
                else if (State == State.Configure)
                {
                }
                else if (State == State.DataLoaded)
                {
                GRL = ncatGoldenReversalLine("111", 0, true, 5);
                // GRL = ncatGoldenReversalLine();
                ​​​​ GRL.Plots[0].Brush = Brushes.Goldenrod;
                AddChartIndicator(GRL);

                }
                }

                protected override void OnBarUpdate()
                {
                if (BarsInProgress != 0)
                return;

                if (CurrentBars[0] < 1)
                return;

                }
                }
                }
                -----------------------------------------------------------------------------------------------------------------------------------------------------




                This attached sample code they send me was to help me write my own code, but it did not compile, it has many issues that states "The type or namspace name "Drawing2D" does not exist in the namespace "System.Drawing" (are you missing an assembly reference?) Which I read about it but could not really find how to fix that.

                Comment


                  #9
                  Originally posted by zaro33 View Post
                  Koganam, basically ncatGoldenReversalLine is a third party Indicator. I am able to put the indicator on a regular price chart and see the trend lines which is green for long and red for short. The way the indicator works is that it will create a dot when prices breaks the trend line which is what Signal[0]=1 and Signal[0]=-1 means, I would assume. I am trying to create a strategy where if I get a signal[0]=1 or -1 then I will buy or sell. I know very basic programming so am just asking to see if anyone knows how to implement it on my strategy.

                  ChelseaB the method I get are #1 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine(ISeries<double> input) and #2 ncatGoldenReversalLine Strategy.ncatGoldenReversalLine()

                  So I decided to try and plot the indicator on my strategy first just to start with the basic to see if I can get it to plot. I am using the strategy analyzer to make sure it would show the indicator so I wrote the small program below:

                  I first try using GRL = ncatGoldenReversalLine(); which it compiled but when I try running it on the Strategy Analyzer, ninjatrader crashes and it give me the error "Unhandled exception: Object reference not set to an instance of an object.";

                  Then I try GRL = ncatGoldenReversalLine("111", 0, true, 5); but it gives me the error that states "No overload for method 'ncatGoldenReversalLine' takes 4 arguments". Now, the reason why I used the values of ("111",0,true,5) is because ninjacator finally send me a file called "SampleGoldenReversal.cs", but unfortunately it did not compile and it has alot of errors (I will put it below as well). The file "SampleGoldenReversal.cs" was supposed to be a sample code that they found that was supposed to help me how to use Signal[0]. From my understanding I can only guess a few of the values that they had on their sample code I assume "111" is for Orderid, 0 is for a parameter called shift and 5 is for a parameter called Strength, but not sure whats with the "true" as I don't see any other parameter or anything in the indicator window that has a a bool type of selection. Anyway, I have try other combination like GRL = ncatGoldenReversalLine("111", 0, 5) and still get similar error like "No overload for method 'ncatGoldenReversalLine' takes 3 arguments".

                  ------------------->THIS IS MY CODE, WHERE I TRY TO PLOT ncatGoldenReversalLine indicator<------------------------------------------
                  namespace NinjaTrader.NinjaScript.Strategies
                  {
                  public class zz : Strategy
                  {
                  public ncatGoldenReversalLine GRL;
                  private double x;

                  protected override void OnStateChange()
                  {
                  if (State == State.SetDefaults)
                  {
                  Description = @"Enter the description for your new custom Strategy here.";
                  Name = "zz";
                  Calculate = Calculate.OnBarClose;
                  EntriesPerDirection = 1;
                  EntryHandling = EntryHandling.AllEntries;
                  IsExitOnSessionCloseStrategy = true;
                  ExitOnSessionCloseSeconds = 30;
                  IsFillLimitOnTouch = false;
                  MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
                  OrderFillResolution = OrderFillResolution.Standard;
                  Slippage = 0;
                  StartBehavior = StartBehavior.WaitUntilFlat;
                  TimeInForce = TimeInForce.Gtc;
                  TraceOrders = false;
                  RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
                  StopTargetHandling = StopTargetHandling.PerEntryExecution;
                  BarsRequiredToTrade = 20;
                  // Disable this property for performance gains in Strategy Analyzer optimizations
                  // See the Help Guide for additional information
                  IsInstantiatedOnEachOptimizationIteration = true;
                  }
                  else if (State == State.Configure)
                  {
                  }
                  else if (State == State.DataLoaded)
                  {
                  GRL = ncatGoldenReversalLine("111", 0, true, 5);
                  // GRL = ncatGoldenReversalLine();
                  ​​​​ GRL.Plots[0].Brush = Brushes.Goldenrod;
                  AddChartIndicator(GRL);

                  }
                  }

                  protected override void OnBarUpdate()
                  {
                  if (BarsInProgress != 0)
                  return;

                  if (CurrentBars[0] < 1)
                  return;

                  }
                  }
                  }
                  -----------------------------------------------------------------------------------------------------------------------------------------------------



                  The attach sample code they send me to help me write my own code did not compile, it has many issues that states "The type or namspace name "Drawing2D" does not exist in the namespace "System.Drawing" (are you missing an assembly reference?) Which I read about it but could not really find how to fix that.
                  The code that you posted is for NT7. Your code is for NT8. NT7 code will not run on NT8.

                  However, the code shows you what to do. First declare and initialize an object called ncatGoldenReversalLine with the appropriate parameters. You may need to ask for what parameters are required. At this time, the signature that you have in the SampleGoldenReversal.txt file does not match what you have in the cs file in your original post. Your SampleGoldenReversal.txt has a class that is initialized with 4 parameters, whereas your original post has the class initialized with no parameters.

                  Comment


                    #10
                    The file that you attached, SampleGoldenReversal.txt is NT7 code. It will not work in NT8. Further, the class signature in SampleGoldenReversal.txt has 4 parameters for initializing it, whereas in your original post, the cs file shows that that class should be initialized with no parameters.

                    They may have changed the code as they went from NT7 to NT8. You may have to ask them to clarify how to initialize the object, and what parameters are exposed for public access.

                    Comment


                      #11
                      Hello zaro33,

                      When calling ncatGoldenReversalLine(), is GRL null?
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_ChelseaB View Post
                        Hello zaro33,

                        When calling ncatGoldenReversalLine(), is GRL null?
                        When I try to plot using GRL = ncatGoldenReversalLine(); the code compiles, but when I try to do a strategy analyzer, ninjatrader crashes and a window shows up stating "Unhandled exception: Object reference not set to an instance of an object". Not sure how I can check if GRL will be null since I don't have Visual Studio to check GRL in debugging mode.
                        Also, if I try GRL=ncatGoldenReversalLine("111",0,true,5); which was used I the NT7 code, then my code does not compile. I try changing different number of parameter with the same issue, it does not compile.
                        Last edited by zaro33; 10-03-2019, 08:34 PM.

                        Comment


                          #13
                          Originally posted by koganam View Post
                          The file that you attached, SampleGoldenReversal.txt is NT7 code. It will not work in NT8. Further, the class signature in SampleGoldenReversal.txt has 4 parameters for initializing it, whereas in your original post, the cs file shows that that class should be initialized with no parameters.

                          They may have changed the code as they went from NT7 to NT8. You may have to ask them to clarify how to initialize the object, and what parameters are exposed for public access.
                          I was out of country in vacation and did not had time to look at this. Unfortunately, I send them email before I left in Sept to see if anyone knew anything but nobody got to me from ninjacator. I send them an email today to see if they know how to initialized the object in NT8. BTW, thanks for the information that the code is on NT7 and not NT8, that is very useful to know.

                          Comment


                            #14
                            Hello zaro33,

                            To answer the question presented in post #12, you can check if the object is null with the following condition.

                            if (ncatGoldenReversalLine("111", 0, true, 5) == null) Print("ncatGoldenReversalLine("111", 0, true, 5) is null.");

                            if (ncatGoldenReversalLine() == null) Print("ncatGoldenReversalLine() is null.");

                            I would agree with koganam's advise that since the code here is created by another party, that party should be consulted to ask for proper syntax and usability.

                            We look forward top being of further assistance.
                            JimNinjaTrader Customer Service

                            Comment


                              #15
                              Originally posted by NinjaTrader_Jim View Post
                              Hello zaro33,

                              To answer the question presented in post #12, you can check if the object is null with the following condition.

                              if (ncatGoldenReversalLine("111", 0, true, 5) == null) Print("ncatGoldenReversalLine("111", 0, true, 5) is null.");

                              if (ncatGoldenReversalLine() == null) Print("ncatGoldenReversalLine() is null.");

                              I would agree with koganam's advise that since the code here is created by another party, that party should be consulted to ask for proper syntax and usability.

                              We look forward top being of further assistance.
                              1-So when I try ncatGoldenReversalLine("111",0,true,5) it does not compile, since it says "No overload for method "ncatGoldenReversalLine" takes 4 arguments". Just like Koganam stated this comes from the only file they provided me which was from NT7 so they must have change the code for NT8, which unfortunately there is no phone number to ninjacator. I try using different arguments but it give me same compile issue.
                              2-If I have ncatGoldenReversalLine() the file does compile, but it always crashes if I try to run the strategy. Therefore, even when I put "if (ncatGoldenReversalLine() == null) Print("ncatGoldenReversalLine() is null.");", as suggested the program just crashes. I even try to do a try and catch and the program still crash stating the same thing "Unhandled exception: Object reference not set to an instance of an object".

                              I guess I will just have to try and keep sending E-mails to ninjacator to see if they reply to me, with any information that will help.

                              namespace NinjaTrader.NinjaScript.Strategies
                              {
                              public class zz : Strategy
                              {
                              public ncatGoldenReversalLine GRL;
                              private double x;

                              protected override void OnStateChange()
                              {
                              if (State == State.SetDefaults)
                              {
                              Description = @"Enter the description for your new custom Strategy here.";
                              Name = "zz";
                              Calculate = Calculate.OnBarClose;
                              EntriesPerDirection = 1;
                              EntryHandling = EntryHandling.AllEntries;
                              IsExitOnSessionCloseStrategy = true;
                              ExitOnSessionCloseSeconds = 30;
                              IsFillLimitOnTouch = false;
                              MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
                              OrderFillResolution = OrderFillResolution.Standard;
                              Slippage = 0;
                              StartBehavior = StartBehavior.WaitUntilFlat;
                              TimeInForce = TimeInForce.Gtc;
                              TraceOrders = false;
                              RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
                              StopTargetHandling = StopTargetHandling.PerEntryExecution;
                              BarsRequiredToTrade = 20;
                              // Disable this property for performance gains in Strategy Analyzer optimizations
                              // See the Help Guide for additional information
                              IsInstantiatedOnEachOptimizationIteration = true;
                              }
                              else if (State == State.Configure)
                              {
                              }
                              else if (State == State.DataLoaded)
                              {

                              try{
                              if (ncatGoldenReversalLine()==null) {Print("null");
                              }
                              catch (Exception ex) {Print (ex.ToString());}
                              }
                              }

                              protected override void OnBarUpdate()
                              {
                              if (BarsInProgress != 0)
                              return;

                              if (CurrentBars[0] < 1)
                              return;

                              }
                              }
                              }

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by thanajo, 05-04-2021, 02:11 AM
                              3 responses
                              465 views
                              0 likes
                              Last Post tradingnasdaqprueba  
                              Started by Christopher_R, Today, 12:29 AM
                              0 responses
                              10 views
                              0 likes
                              Last Post Christopher_R  
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              166 responses
                              2,235 views
                              0 likes
                              Last Post sidlercom80  
                              Started by thread, Yesterday, 11:58 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post thread
                              by thread
                               
                              Started by jclose, Yesterday, 09:37 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post jclose
                              by jclose
                               
                              Working...
                              X