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

Help with Indicator Development

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

    #16
    Unprotected code

    Sorry, please find attached un protected file
    Attached Files

    Comment


      #17
      Hello sandeshrai,

      Thank you for your response.

      Please remove the following lines from the Initilize() method and place them in the OnBarUpdate() method at the beginning:
      Code:
      protected override void OnBarUpdate()
              {
      			if (CurrentBar < 200)
              return;
      			
      			indSMAFast = SMA(this.iSMAFast);
      			indSMAFast.Plots[0].Pen.Color = Color.Purple;
      			
      			indSMAMedium = SMA(this.iSMAMedium);
      			indSMAMedium.Plots[0].Pen.Color = Color.DarkBlue;
      			
      			indSMASlow = SMA(this.iSMASlow);
      			indSMASlow.Plots[0].Pen.Color = Color.ForestGreen;
      			
      			indSMAVSlow = SMA(this.iSMAVSlow);
      			indSMAVSlow.Plots[0].Pen.Color = Color.Red;
      Please let me know if I may be of further assistance.

      Comment


        #18
        Originally posted by sandeshrai View Post
        Hi Patrick,

        I added the Print statements, but that doesn ot print either. Additionally, I tried to have the SMA to be visible on the chart by adding the line :Add (indSMAFast);. I get the error messages

        The best overloaded method match for 'NinjaTrader.Indicator.IndicatorBase.Add(NinjaTrad er.Gui.Chart.Line)' has some invalid arguments

        and

        Argument '1': cannot convert from 'NinjaTrader.Indicator.SMA' to 'NinjaTrader.Gui.Chart.Line'

        I have attached a text file with the entire code
        Your conditions are never being met, because you have only created your SMA's wiithout ever synchronizing them to any object or barSeries.

        Move the code that you use to assign the named instances of SMA to their objects into OnStartUp().
        Last edited by koganam; 01-25-2014, 01:46 PM.

        Comment


          #19
          Updated code as per your suggestion

          I updated the code as suggested by you. It still does not do what it is supposed to do.



          Originally posted by NinjaTrader_PatrickH View Post
          Hello sandeshrai,

          Thank you for your response.

          Please remove the following lines from the Initilize() method and place them in the OnBarUpdate() method at the beginning:
          Code:
          protected override void OnBarUpdate()
                  {
                      if (CurrentBar < 200)
                  return;
           
                      indSMAFast = SMA(this.iSMAFast);
                      indSMAFast.Plots[0].Pen.Color = Color.Purple;
           
                      indSMAMedium = SMA(this.iSMAMedium);
                      indSMAMedium.Plots[0].Pen.Color = Color.DarkBlue;
           
                      indSMASlow = SMA(this.iSMASlow);
                      indSMASlow.Plots[0].Pen.Color = Color.ForestGreen;
           
                      indSMAVSlow = SMA(this.iSMAVSlow);
                      indSMAVSlow.Plots[0].Pen.Color = Color.Red;
          Please let me know if I may be of further assistance.

          Comment


            #20
            Originally posted by sandeshrai View Post
            I updated the code as suggested by you. It still does not do what it is supposed to do.
            That cannot possibly work. You are instantiating the named instances of the indicators on every tick, so they are always in a virgin state.

            Comment


              #21
              Hello sandeshrai,

              Thank you for your response.

              The indicator is working on my end, please forward me once again the indicator code you are now using after the updates.

              I look forward to your response.

              Comment


                #22
                Updated code attached

                Here is the updated code attached
                Attached Files

                Comment


                  #23
                  Hello sandeshrai,

                  Thank you for your response.

                  Please try the attached file on your end and advise if it works properly.
                  Attached Files

                  Comment


                    #24
                    It works now. Thank you very much for your help

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by mattbsea, Today, 05:44 PM
                    0 responses
                    4 views
                    0 likes
                    Last Post mattbsea  
                    Started by RideMe, 04-07-2024, 04:54 PM
                    6 responses
                    31 views
                    0 likes
                    Last Post RideMe
                    by RideMe
                     
                    Started by tkaboris, Today, 05:13 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post tkaboris  
                    Started by GussJ, 03-04-2020, 03:11 PM
                    16 responses
                    3,282 views
                    0 likes
                    Last Post Leafcutter  
                    Started by WHICKED, Today, 12:45 PM
                    2 responses
                    20 views
                    0 likes
                    Last Post WHICKED
                    by WHICKED
                     
                    Working...
                    X