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

NT8 sample ToolbarButtons

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

    NT8 sample ToolbarButtons

    Hello,

    I´m using the Sample "LongShortToolbarButtons" from NinjaTrader Zachary https://ninjatraderecosystem.com/use...bar-buttons-2/
    This is a great tool and I have modified already how I want it for moving targets, stops...

    But the question is WHEN the reaction after the click on the button occurs. When having in a script eg 3 dataseries is there something to add so that it works correctly and immediately?
    Now sometimes immediately after button-click the target moves 1*TickSize (as it should from codinig), but sometimes it does not react and when clicking again and again few seconds later it jumps eg 3*TickSize when having clicked the button 3 times before.

    What dataseries is it tied to? How to make it working to set the action immediately after click?

    Thank you!
    Tony

    #2
    Hello tonynt,

    That is due to how this is programmed, you would need to review the script to understand how it should react when used.

    If you would rather an instant order submission, you would need to call the order method from the buttons event instead of OnBarUpdate.

    Please let me know if I may be of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello,

      thank you for your reply! I do not have it in onbarupdate.

      protected override void OnBarUpdate()
      {}
      it is below OnBarUpdate {} as it is in the sample

      private void OnButtonClick(object sender, RoutedEventArgs rea)
      {
      System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
      .....
      .....
      }

      What I was testing now is in a "single-instrument-script" and in a "multi-instrument-script". It is working in the single instrument script with dataseries 0, 1 and 2 in ES.

      It seems that this strange behavior occurs in the "mulit-instrument-script" where I run the script in MES (because of my small account in the meantime) but I´m using ES in dataseries1 and 2 because of higher volume and better analysis. Could it be that there has to be modified something for having it working here also ok?

      Thank you!
      Tony
      Last edited by tonynt; 08-17-2019, 03:17 AM. Reason: add info after more testing

      Comment


        #4
        Hello tonynt,

        If you made changes to the sample, you would need to provide a sample of what you are now using. My prior answer is for the linked sample because that is what you said you are using.

        Are you using the correct BarsInProgress and correct order entry method overloads that accept a BarsInProgress? When using multi series it is assumed you will also change to using the correct overloads for order methods, or using BarsInProgress to delegate logic. If you are not using the specific code from sample you linked, I really don't know what you programmed at this point to advise anything specific.

        I could suggest reviewing the multi series help documents which shows how to submit orders using multiple series, you could compare that against what you are doing to see if you made a mistake:


        You can also see each of the manage approach pages for the specific overloads that include BarsInProgress:


        Code:
        EnterLong(int barsInProgressIndex, int quantity, string signalName)
        Please let me know if I may be of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Hello,

          thank you for your reply. Sorry, this is causing confusion now. You wrote that handling of buttons with buttons event and not onbarupdate. I replied you then that I do not in onbarupdate and I showed you the snippet

          but you reply in #4 referring to onbarupdate. The question is not about entries or onbarupdate handling (there is everything working ok, even with multi dataseries and multi instruments) the question is about buttons handling (outside onbarupdate).

          But as you invite me to onbarupdate discussion I want to ask now if it will work ok to have in a script-strategy if(BarsInProgress==2 || if(BarsInProgress==3) {then do} to reduce the lines in the code and inside the {then do} to work with eg Highs[2][0]?......
          (Why? Because it occurs that a minute bar (BIP3) is closed earlier than even a small RangeBar in slow markets. //This question has nothing to do with the Buttons topic!)

          Thank you!
          Tony
          Last edited by tonynt; 08-19-2019, 07:32 AM. Reason: correction because wrong translation

          Comment


            #6
            Hello tonynt,

            I don't believe it would be best to get off topic with other questions if they are not related.

            If you have created something custom that is not working, please provide a sample of what you created.

            The sample you first linked is what I based my reply on because that is what you said you used. That sample does use OnBarUpdate which is why I had replied the way I did. If you changed to not using OnBarUpdate that is different than the linked sample so I would need to see what code you actually used.


            Please let me know if I may be of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Hello,

              OK, but where is the confusion now with the onbarupdate.

              I wrote #3 that the button handling is not in onbarupdate. And you reply #4 to onbarupdate.

              ??

              Thank you!
              Tony

              Comment


                #8
                Hello tonynt,

                I am not certain what you are referring to, post #4 does not mention OnBarUpdate. What part of post 4 are you having difficulty with?




                Please let me know if I may be of further assistance.

                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Hello,

                  thank you for your reply. Sorry then for causing misunderstanding from my side, as you replied with BarsInProgress I was referring this to onbarupdate.

                  So, the private void OnButtonClick(object sender, RoutedEventArgs rea)
                  {
                  System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
                  .....
                  .....
                  }

                  is outside onbarupdate (referring to your reply #2)

                  Thank you!
                  Tony

                  Comment


                    #10
                    Hello tonynt,

                    I understand that code is outside OnBarUpdate, it is also outside OnBarUpdate in the sample you linked. The sample in post 1 also uses OnBarUpdate to submit orders which does not match what you are actually doing.

                    What you keep providing does not have any information about what code you use. This is not helpful in answering the question, this only helps to confirm you are not using the same code as the sample you linked.

                    At this point we can completely ignore the sample you linked and post 2, now we know that doesn't match what you are actually doing. What syntax have you actually used in your script? Please provide the actual syntax you have used.



                    Please let me know if I may be of further assistance.


                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      Hello,

                      thank you for your reply. I dont want to continue this topic before its getting bothering, anyhow I´ll need to refund the account as it makes no sense trading the small instruments. And as it works perfectly using one instrument it makes no sense to continue. (I just wanted to know what might be the reason for this strange behavior).
                      Thank you for your support!
                      Tony

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by bortz, 11-06-2023, 08:04 AM
                      47 responses
                      1,605 views
                      0 likes
                      Last Post aligator  
                      Started by jaybedreamin, Today, 05:56 PM
                      0 responses
                      8 views
                      0 likes
                      Last Post jaybedreamin  
                      Started by DJ888, 04-16-2024, 06:09 PM
                      6 responses
                      18 views
                      0 likes
                      Last Post DJ888
                      by DJ888
                       
                      Started by Jon17, Today, 04:33 PM
                      0 responses
                      4 views
                      0 likes
                      Last Post Jon17
                      by Jon17
                       
                      Started by Javierw.ok, Today, 04:12 PM
                      0 responses
                      13 views
                      0 likes
                      Last Post Javierw.ok  
                      Working...
                      X