Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Convert Strategy to Indicator

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

    Convert Strategy to Indicator

    Hello,

    I would like to use the "SampleMACrossOver" as a clean start for an indicator. I can find a strategy version, but not an indicator version. Anyway to convert a strategy to an indicator?

    Thanks.

    #2
    Hello rcmcd,
    Thanks for your post.

    What specifically are you trying to accomplish by doing this?

    You wouldn't be able to place orders from an indicator like you can in a strategy. Do you simply want the two SMA plots from the 'SampleMACrossOver' in your indicator?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      That is correct.

      Comment


        #4
        I have attached a sample script for what I believe to be the equivalent indicator. I simply added the plots and then assigned the primary values of the indicators to the plots.

        Put the .cs file in your \Documents\NinjaTrader 8\bin\Custom\Indicator\ folder and then compile before trying to use it.

        Help Guide - AddPlot()
        Help Guide - Values

        Let me know if you have any questions.
        Attached Files
        Last edited by NinjaTrader_JoshG; 09-07-2018, 07:28 AM.
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Thanks Ninja.

          can we have code of Harmonic trading indicator in Ninja 8.

          Comment


            #6
            Hello Nupur Gupta,

            Unfortunately, we do not do custom indicator development like that here at NinjaTrader as it would limit our Support capabilities. You can contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services.

            Please let me know if you would like our business development team to follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
            Josh G.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_JoshG View Post
              I have attached a sample script for what I believe to be the equivalent indicator. I simply added the plots and then assigned the primary values of the indicators to the plots.

              Put the .cs file in your \Documents\NinjaTrader 8\bin\Custom\Indicator\ folder and then compile before trying to use it.

              Help Guide - AddPlot()
              Help Guide - Values

              Let me know if you have any questions.
              I modified your indicator to plot a 5-minute sma fast and slow lines, but nothing plots. Do you know why?
              Attached Files

              Comment


                #8
                Hello bobperez,

                Thanks for your post.

                When enabling the script you shared I am seeing an error message appear in the Log tab of the Control Center. The error message states that you are accessing an index with a value that is invalid since it is out of range.

                This error message indicates that you are trying to access a BarsAgo value that is not valid. A more simple example using one series would be on bar 5 you check for 6 BarsAgo. There are not yet 6 bars so the CurrentBar minus 6 would be a negative number or a non-existent bar.

                A CurrentBars check could be used in your indicator's logic to ensure that a certain number of bars have processed for all the series being accessed in the script before the indicator begins calculation.

                ​See the help guide documentation below for more information.

                CurrentBars - https://ninjatrader.com/support/help...urrentbars.htm
                Make sure you have enough bars - https://ninjatrader.com/support/help...nough_bars.htm
                <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

                Comment


                  #9
                  Originally posted by NinjaTrader_BrandonH View Post
                  Hello bobperez,

                  Thanks for your post.

                  When enabling the script you shared I am seeing an error message appear in the Log tab of the Control Center. The error message states that you are accessing an index with a value that is invalid since it is out of range.

                  This error message indicates that you are trying to access a BarsAgo value that is not valid. A more simple example using one series would be on bar 5 you check for 6 BarsAgo. There are not yet 6 bars so the CurrentBar minus 6 would be a negative number or a non-existent bar.

                  A CurrentBars check could be used in your indicator's logic to ensure that a certain number of bars have processed for all the series being accessed in the script before the indicator begins calculation.

                  ​See the help guide documentation below for more information.

                  CurrentBars - https://ninjatrader.com/support/help...urrentbars.htm
                  Make sure you have enough bars - https://ninjatrader.com/support/help...nough_bars.htm
                  Thank you Brandon

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  648 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  369 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  108 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  572 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  574 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X