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

Hosted indicators identity

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

    Hosted indicators identity

    Here is example of code and result on screenshot in attachment:


    PHP Code:
            SMA Sma_1Sma_2;
            
            protected 
    override void OnStateChange()
            {
                if (
    State == State.SetDefaults)
                {
                    
    Calculate                                    Calculate.OnBarClose;
                }
                else if (
    State == State.DataLoaded)
                {
                    
    Sma_1 SMA10 );
                    
    Sma_2 SMA10 );
                    
                    
    AddChartIndicatorSma_1 );
                    
                    Print( 
    "Sma_1 == Sma_1 = "+ (Sma_1 == Sma_1).ToString() );                
                }
            }

            protected 
    override void OnBarUpdate()
            {            
                
    Sma_2.PlotBrushes[0][0] = Brushes.Blue;
            } 


    If to use different periods, for example
    PHP Code:
                    Sma_1 SMA10 );
                    
    Sma_2 SMA11 ); 
    Sma_1 == Sma_1 is still true, but Sma_1 color on chart stay native orange.

    Is it expected?
    Can I let strategy to create different instances of hosted indicator with same parameters?
    Attached Files
    Last edited by fx.practic; 11-20-2017, 10:21 AM.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Hello,

    Thank you for the post.

    I wanted to clarify what your sample is demonstrating.

    I see that you have two variables for SMA objects and are comparing if they are the same object in your print. You are setting the second instance of the SMA's Brush, but you have not added this instance. Are you seeing that setting the second instance has any effect on the first that was added? While testing what you have provided I do not see there was any change to the added indicator.

    Are you expecting that changing your second variable should also affect the first? In this case, I would not expect that setting the second instance of the SMA will affect the first. Can you provide more detail on your test and what you had for the outcome?


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Sma_1 was added on chart.
      Sma_2 PlotBrushes were set.
      But, Sma_1 colors were changed on chart.

      Strategy in attachment.
      Attached Files
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment


        #4
        Hello,

        Thank you for providing the sample.

        Yes, this is the same test as I had completed but I am not seeing the color of the plot change at all.

        Can you tell me what version of the platform are you currently using? You can find this in the Help -> About menu. Also, have you tried closing the strategy analyzer and reopening it, is the result the same? Is the result the same from a chart for you as well?

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          8.0.9.0 64-bit (Multi-Broker)

          Here is short video: https://www.screencast.com/t/D2TP37BG
          fx.practic
          NinjaTrader Ecosystem Vendor - fx.practic

          Comment


            #6
            I've just installed 8.0.10.0 64-bit (Multi-Broker) - same result. Like on video above.
            fx.practic
            NinjaTrader Ecosystem Vendor - fx.practic

            Comment


              #7
              Hello,

              Thank you for the reply.

              I see you have updated to the current version, I am not seeing anything in the video that would be relevant to cause this. I wanted to check, had you tried doing a clean user folder as a test at this point? I can provide instructions to do this if needed.


              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                Give me instructions.
                fx.practic
                NinjaTrader Ecosystem Vendor - fx.practic

                Comment


                  #9
                  Hello,

                  To test the platform with a clean user folder, please do the following:
                  1. Exit NinjaTrader
                  2. Open the Documents folder
                  3. Locate the NinjaTrader 8 folder and Rename it to NinjaTrader 8 Current
                  4. Locate the installer you had downloaded and re-run it to reinstall NinjaTrader.
                  5. A new user folder will be generated in place of the one you had renamed.
                  6. Start NinjaTrader and import the test script you had uploaded to the forum and retest.


                  Please let me know the results of the test then we can continue from there.

                  To restore your existing installation after this test, use the following steps:
                  1. Exit NinjaTrader
                  2. Open the Documents folder
                  3. Locate the NinjaTrader 8 folder and remove it
                  4. Locate the NinaTrader 8 Current folder and rename it to NinjaTrader 8.

                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    Don't see any difference in behaviour.

                    Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


                    Can I return my old NT8 folder back?
                    fx.practic
                    NinjaTrader Ecosystem Vendor - fx.practic

                    Comment


                      #11
                      Hello,

                      Thank you for testing that.

                      You can return to using your original user folder.

                      After further review I am now able to see this, I am unsure why I was not able to originally but now I can.

                      It looks like this would be expected in this case as the cache is returning the same instance in the case where the same exact settings are used for both SMA's. Both variables should then point to the cached indicator. To create two different instances using the same parameters/logic, you would likely need to use a second indicator that contains the same logic but is named differently. The indicator instance returned is controlled by the autogenerated code in the bottom of the indicator file.



                      I look forward to being of further assistance.
                      JesseNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by sidlercom80, 10-28-2023, 08:49 AM
                      167 responses
                      2,260 views
                      0 likes
                      Last Post jeronymite  
                      Started by warreng86, 11-10-2020, 02:04 PM
                      7 responses
                      1,361 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by Perr0Grande, Today, 08:16 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post Perr0Grande  
                      Started by elderan, Today, 08:03 PM
                      0 responses
                      9 views
                      0 likes
                      Last Post elderan
                      by elderan
                       
                      Started by algospoke, Today, 06:40 PM
                      0 responses
                      10 views
                      0 likes
                      Last Post algospoke  
                      Working...
                      X