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

NinjaTrader.Gui.Tools.CollectionEditor -needs to replace values when aplying template

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

    NinjaTrader.Gui.Tools.CollectionEditor -needs to replace values when aplying template

    Collection editor, does work correctly after aplying strategy template:

    It happens, when this is used in GUI
    [PropertyEditor("NinjaTrader.Gui.Tools.CollectionEd itor")]

    Problem:
    when loading and aplying strategy template, it adds up items from template to existing values, which causes strange behavior, where count of values in collection doubles = there are the old values + new ones from template.

    • I am not sure, what technically happens inside.
    • I see, that initialy I have programatically set 2 values in collection (as initial state behind of the property), and after I load and apply strategy template, then I have 4 values in the collection = 2x the same values. I expect, that values coming from template were just added.
    • Count of values does even higher, to 8, or 12, depending on how many interactions there are while playing in GUI
    • I check the template XML - and there are only 2 values, not 4 = so template is OK.



    Correct behaviour should be:
    1. remove all existing from collection - so it is empty first
    2. add there new items, that are in the template


    NT8 version: 8.0.6.1

    To help to reproduce the problem, I can send you whole Custom folder,
    where it is reproducible each and every time.
    (I am sorry, I cannot prepare minimalistic demo example, because I am very busy these days..).

    See the pictures please - for demonstration:



    Attached Files
    Last edited by misova; 05-24-2017, 08:44 AM.

    #2
    Hello,

    Thank you for the post.

    I reviewed the information and would be interested in seeing a sample of how you have currently defined the property and how it is currently being used in a sample. Our support is also busy so we wouldn't be able to sort through a full custom folder or debug your script for you. As you are reporting this item, if you find some time to extract this logic and place it in a sample script using the NinjaScript editor, I would be happy to review that sample.

    In the case that this is not reproducible without your custom folder, this may be due to something that is imported currently. What I could suggest in that case would be for you to just try using a clean user folder and import that one specific item to see if that still happens. If you needed further assistance in setting up this kind of test, I could provide instructions for that.

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

    Comment


      #3
      Ok, I will try to prepare some simplistic example in a few days...

      Comment


        #4
        Hi, I prepared demo, where the bug happens every time.

        How to reproduce:
        1. Copy attached file into Strategy folder
        2. Check in GUI - property named Assets. It show 2 values initially - and this is correct. While there are no templates initially (after 1st compilation of any new strategy), it works fine = there is correct count of values in collection.


        Now let's see the bug:
        1. Create default template: templates -> save -> Default
        2. Load this template
        3. And see - there are 4 values now in the property Assets. (they double).


        If possible, please confirm you could reproduce this behavior.

        Best regards
        Misova
        Attached Files
        Last edited by misova; 05-27-2017, 03:29 AM.

        Comment


          #5
          When creating previous demo, I found completely different bug = Wrong names of strategies in strategy selector.

          I named new strategy SampleMACrossOver_Demo.

          But after compilation of the strategy, when I select the strategy,
          I see 2 strategies with same name.
          • SampleMACrossOver
          • SampleMACrossOver


          In reality, there are no 2 strategies with same name.
          In reality, one is: SampleMACrossOver and another is: SampleMACrossOver_Demo


          Expected behaviour is, I should see:
          • SampleMACrossOver
          • SampleMACrossOver_Demo


          See the screenshots:



          How it looks in Strategy Analyzer = BUG





          If possible, please confirm you could reproduce this another bug too..

          Best regards
          Misova
          Attached Files
          Last edited by misova; 05-27-2017, 04:00 AM.

          Comment


            #6
            Hello,

            Thank you for providing the sample, I will take a look into this and see what I can gather from the sample.

            Regarding the name of the script, you would need to change the Name property in SetDefaults as it is being set to a custom resource currently.

            Did you use the right click -> Save as to duplicate the script or had you manually duplicated the file and the manually renamed the class? The first case I would not expect the Name property to retain the resource, the second case I would.

            If you can provide the steps you used to duplicate the file to clarify that would be helpful.


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

            Comment


              #7
              Hi,

              here are steps I used to create the duplicate:
              • Start Visual Studio fro NT8 Editor
              • Open file: @SampleMACrossOver.cs
              • Refactor class name SampleMACrossOver -> to SampleMACrossOver_Demo using F2 shortcut = Rename refactoring
              • Change file name: SampleMACrossOver_Demo.cs (also removes initial @)
              • Compile and see in Backtest Analyzer

              Comment


                #8
                Hello,

                Thank you for the reply.

                Yes in that case because you are using an outside tool (visual studio) which is not aware that the Name property needs to reflect the Class name, then that would be expected.

                The internal indicators use resources for their strings so they can be localized, the NinjaScript editor has logic to account for these items where visual studio would not. I believe the refactor may work in visual studio where you already have the Name = "ClassName"; as it would see the same text in its search.

                Otherwise, the automatic rename of the Name property would only happen if you use the NinjaScript editor and do a Save As. Unfortunately, this would be a manual step in Visual Studio if you decide to duplicate the file there.

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

                Comment


                  #9
                  Thank you very much Jesse,
                  it is completely clear now.

                  Comment


                    #10
                    Hi Jesse,

                    Post #4 was somehow lost among other messages - but there is still the attached demo (in post #4) I prepared, that shows main issue of this thread.
                    Can you confirm, you were able to reproduce it ?

                    Comment


                      #11
                      Hello,

                      Thank you for the reply.

                      Post #4 was not lost, I am currently testing this item and will report back with further details once I have further tested and reviewed the sample.

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

                      Comment


                        #12
                        Hi Jesse,

                        can you confirm, you were able to reproduce the error using provided strategy
                        or can I help with reproducing it?

                        Comment


                          #13
                          Hello,

                          Currently, I would not need any further input on this item. I am reviewing what the suggested approach would be for creating these types of items in a strategy specifically. Once I have further details if this is the correct approach, I will reply back.

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

                          Comment


                            #14
                            Hello,

                            I just wanted to reply back on this item.

                            After further review, it seems that both Indicators and Strategies are having difficulties with the type converter pattern shown in your example along with the example here: http://ninjatrader.com/support/forum...ad.php?t=97919

                            You can track this item using the following id: 11863

                            While I was not able to see duplications using the pattern we provide, I was unable to see the indicator reloading the preset correctly.

                            Strategies specifically are throwing an exception after a recompile when using this pattern. Development is currently reviewing this.

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

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            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
                            3 views
                            0 likes
                            Last Post thread
                            by thread
                             
                            Started by jclose, Yesterday, 09:37 PM
                            0 responses
                            8 views
                            0 likes
                            Last Post jclose
                            by jclose
                             
                            Started by WeyldFalcon, 08-07-2020, 06:13 AM
                            10 responses
                            1,415 views
                            0 likes
                            Last Post Traderontheroad  
                            Working...
                            X