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

Simple Modification to Buy/Sell Buttons

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

    Simple Modification to Buy/Sell Buttons

    Hello community,

    I am looking for a simple way to modify the existing chart trader buy/sell buttons such that when a button click is registered, rather than immediately submitting, the order will delay until the close of the candle.

    Generally, how can I add logic to the click of these particular buttons. Just to catch any prospective help up on where I am so far, I have downloaded NT_Chelsea's wonderful indicators that allow one to modify the existing chart trader buttons (in the form of an indicator) but I was unable through searching to determine how to actually change the logic of a button click and send an order (especially in the context of the original indicator)...

    I am also aware of a strategy which adds buy/sell buttons to the rendered chart directly. This approach turns out to be problematic for me due to the way the strategy interacts with manually closing/opening positions.

    TL;DR How can I add custom logic to the existing chart trader buttons such that the submission of orders can be modified? Syntax for order submission within this context? ATM approach? managed? unmanaged? account.submit?

    Thank you!

    #2
    Hello lunardiplomacy,

    Thanks for your post.

    I would suggest using Chelsea's scripts to get started, and then I would consider hiding those buttons and adding your own in their place.

    For example, you could do the following to hide a button and then add a button on top of those buttons in that button's place.

    Code:
    if (buyMarketButton != null)
        buyMarketButton.Visibility = Visibility.Hidden;
    I would then suggest using AddOn framework code to submit orders directly from the account. Account.Submit can be used to submit orders and StartAtmStrategy can be used to submit orders with an ATM strategy.

    The script I have attached can be used to demonstrate order submissions with AddOn Framework code once the indicator holding the AddOn Framework code is added to the chart.

    Please see the Account class for further details on Account.Submit and and StartAtmStrategy.

    Account Class - https://ninjatrader.com/support/help...ount_class.htm

    StartAtmStrategy - https://ninjatrader.com/support/help...tmstrategy.htm

    For the thread's reference, NinjaTrader_Chelsea's Chart Trader modification examples can be found here - https://ninjatrader.com/support/foru...considerations

    We look forward to assisting.
    Attached Files
    JimNinjaTrader Customer Service

    Comment


      #3
      Hey Jim, thanks for getting back to me.

      I have the code up for the indicator you sent me and it's already useful inasmuch as linking an account is concerned, however I would appreciate clarification on two things...

      I am running a playback connection with your indicator. What exactly am I supposed to be seeing? I am trying to read quickly because I know you guys are probably calling it quits for the day soon, but my understanding is that you can click on the price scale to set a limit order after comparing the price clicked with the current close or something? Just asking for an overview of this indicator so I know what everything is doing and then I can start working to modify it.

      Secondly, you suggested that I hide chelsea's buttons in the (i assume we're talking about the same indicator, that would be ChartTraderModifyExistingButtons) indicator, and I'm sure that is a worthwhile suggestion, but can you clarify why that would be necessary? why can't I just alter chelsea's buttons?

      Thanks again for getting back to me. Sorry if I missed anything obvious, like I said, reading quickly.

      Comment


        #4
        Just for the sake of paring down.. since I was in playback I needed to change the account name. Jim this functionality should just be the vanilla method for placing limit orders, it's great.

        I would still like to understand your first suggestion about hiding and overlapping buttons, but based upon this indicator I think I know what I need to do now.

        Thank you.

        Comment


          #5
          Hello lunardiplomacy,

          My example indicator shows orders submissions with AddOn Framework code when you click on a chart.

          I would suggest hiding the buttons and then re-adding your own, because it would be easier to create a new button who's Click event does not have an event handler subscribed than to attempt to unsubscribe an event handler that is internal and not publicly known. Once you create your own button, you can assign your own event handlers. Chelsea's ChartTraderModifyExistingButtonsExample example adds an event handler to display text on the chart, but the original event handlers for order submissions are still subscribed to the existing buttons.

          Let us know if you have any additional questions.
          JimNinjaTrader Customer Service

          Comment


            #6
            I know that is an old thread but my q's directly related to the thread.

            Does anyone have an example of replacing the current chart trader buttons, I am attempting to improve event handling through button presses and am running the unsubscribe that is handled clunky and can be done better though I am unsure how to place the buttons where there are already buttons, I have placed new buttons below these but unsure what placement can replace the existing buttons array.

            Also, I use hotkeys, and notice the button press on these AutomationIDs in the current button event does not call through the the hotkey event just an actual mouse down event on the button, is there a secondary hotkey method while executing the button click to be sure external connected events are also called.

            Comment


              #7
              Hello LoganJKTrader,

              I cannot provide you with an example that replaces or removes ChartTrader buttons. NinjaTrader explicitly does not support removing any original intended functionality. Removing a button is not supported.

              I can provide a link to the reference sample that shows how to add extra buttons to chart trader, but does not remove any buttons and replace them.


              Hotkeys built into NinjaTrader are not interacting with buttons. These are triggering commands directly.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Perr0Grande, Today, 08:16 PM
              0 responses
              2 views
              0 likes
              Last Post Perr0Grande  
              Started by elderan, Today, 08:03 PM
              0 responses
              3 views
              0 likes
              Last Post elderan
              by elderan
               
              Started by algospoke, Today, 06:40 PM
              0 responses
              10 views
              0 likes
              Last Post algospoke  
              Started by maybeimnotrader, Today, 05:46 PM
              0 responses
              9 views
              0 likes
              Last Post maybeimnotrader  
              Started by quantismo, Today, 05:13 PM
              0 responses
              7 views
              0 likes
              Last Post quantismo  
              Working...
              X