Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Creating a button to execute an ATM trade

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

    Creating a button to execute an ATM trade

    Hi,

    I have a basic question about creating a button in the toolbar to execute an ATMStrategy trade. The button examples I have seen are all of type indicator and inherit from the Indicator class, I understand these examples but I want the click event to trigger the ATMStrategy Methods (GetatmStrategyUniqueId and ATMStrategycreate methods), these methods don't seem to be able to be called from an indicator as they inherit from the strategy class. Can you advise the best approach?
    Should I have a button as an indicator and try and call a strategy which executes an ATM strategy? if so how best should I do that? or,
    Should I try and create a button in a strategy? if so are there any examples where that's been done?
    If I am missing something simple please advise.

    Thank you

    #2
    Hello, thanks for writing in. We have a collection of examples showing how to add custom WPF elements here:
    Hello All, Moving forward this will be maintained in the help guide reference samples and no longer maintained on the forum. Creating Chart WPF (UI) Modifications from an Indicator - https://ninjatrader.com/support/help...ui)-modifi.htm (https://ninjatrader.com/support/helpGuides/nt8/creating-chart-wpf-(ui)-modifi.htm) I've


    This code can be added to Indicator classes and Strategy classes, it does not matter the type of class it is implemented in. You can put the same code in a Strategy and call the ATM strategy methods within your button-click event to submit an order. With all this, please note that it does go outside of the scope of support we are able to provide as we must stay focused solely on the documented code in the NinjaScript library. Attempting to make this is done at your own risk and we will not be able to assist in debugging issues that may sprout from such code.

    Kind regards,

    -ChrisL

    Comment


      #3
      Hi,

      Thanks for your response but those examples don't work, whether they are run as indicator or strategy classes they do not work on the latest bar when the button is clicked. I have added a simple line to all examples for the button clicked function Print("Current Bar Time " + Time[0]) and in every example script you have given me the answer is the time stamp of the first bar of the loaded chart and it never updates with new data. This means I cannot perform calculations on the current dataseries or initiate orders as it always references the first bar on the chart when the button is clicked. Please advise how to address this big issue with all those examples. I need a button that when clicked acts on the dataseries, as usual, and not just the very first bar loaded.

      Thank you

      Comment


        #4
        Hello, thanks for the follow up. The button event is not data driven, so you would need to use DateTime.Now, or its possible that you could use TriggerCustomEvent to sync the data series in the button click, but this will need to be tested.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        86 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        151 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        79 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        52 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        59 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X