Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Single-click order entry on chart

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

  • NinjaTrader_Jim
    replied
    Hello darkbluedove,

    Thanks for your question.

    I am not aware of any supported way to scale into active Atm strategies using AddOn Framework code. I'll leave this thread open for any community members to share their insight if they have had success, but I do not have any documentation or example code to reference how an AtmStrategySelectionMode can be used with AddOn Framework code.

    Something to note as well, when we scale into an Atm strategy with Chart Trader or the SuperDOM, we see additional orders submitted with different OCO IDs (ref Orders tab.) Chart Trader/SuperDOM will consolidate these visually depending on the AtmStrategySelectionMode, but since we do not have control over order markers, I do not see a way forward to recreate this functionality with AddOn Framework code.

    Leave a comment:


  • darkbluedove
    replied
    Hi, NinjaTrader_Jim . Thanks for the info and your thoughts on how it could be achieved. I'll stick to ATM strategies with one leg.

    I've been testing out the single-click order entry code. One thing I've noticed is that even when an active ATM strategy is selected in ChartTrader, the subsequent orders entered by the code as they get filled are not updating/canceling the ATM strategy's target/stop orders. I have a key combo for AtmStrategy.StartAtmStrategy() and another one for Account.Submit(). If Account.Submit() is used, then the new order is completely separate from the active ATM strategy, which makes sense. If AtmStrategy.StartAtmStrategy() is used, then the new order starts an entirely new ATM strategy with its own target/stop orders as if an ATM strategy template had been selected. However, in my logs I verified that the name of ChartControl.OwnerChart.ChartTrader.AtmStrategy was the selected *active* ATM strategy, not its template.

    When trading manually, if an active ATM strategy is selected in ChartTrader or SuperDOM, then new orders placed manually participate in updating/canceling the quantities of the existing ATM target/stop orders. How can we get the programmatic orders to behave that way?

    Leave a comment:


  • NinjaTrader_Jim
    replied
    Hello darkbluedove,

    Thanks for your question.

    How an ATM strategy distributes each leg is configured in the ATM strategy template and could not be set programmatically. Let's consider if we create an ATM strategy template that protects 2 contracts and has 1 contract per leg. If we manually enter a position with a quantity of 4, the ATM strategy will enter with the first leg covering 3 contracts and the second leg covering 1 contract.

    If you want to have the order quantity split in half for separate legs, I would suggest creating 2 ATM strategies so each strategy has one target/stop and then you can submit 2 entry orders with a quantity of ChartControl.OwnerChart.ChartTrader.Quantity/2.

    Please let me know if you have any additional questions.

    Leave a comment:


  • darkbluedove
    replied
    Thanks, NinjaTrader_Jim !

    I've made a ton of progress putting together the various pieces from this thread and other documentation. It's starting to come together for what I need.

    One thing for which I could use your pointers:

    I'm trying to get documentation on class AtmStrategy. The short article in the guide isn't very helpful, and I also looked through IntelliSense. In particular, I want to change the quantities in the legs of the selected ATM strategy in ChartTrader: ChartControl.OwnerChart.ChartTrader.AtmStrategy. I need to update them to keep the same proportions (for example, half and half for 2 target legs) so that the current ATM strategy uses whatever is the current ChartTrader total quantity (which I'm successfully using for other purposes through ChartControl.OwnerChart.ChartTrader.Quantity).

    Can you please provide any insights/examples/links?
    Last edited by darkbluedove; 09-10-2020, 11:50 PM.

    Leave a comment:


  • NinjaTrader_Jim
    replied
    Hello darkbluedove,

    1) Is there a way so that during manual trading, the ATM strategy adjusts the target leg quantities automatically based on the proportions in the ATM template?
    When manual trading, if you change the ATM strategy template, the order submission Quantity Up/Down selector will adjust to the ATM strategy template's order quantity. If we adjust the order quantity after that the quantity will change the behavior of the ATM strategy so additional contracts and target levels are not used.

    2) When using StartAtmStrategy(), what is the recommended way to achieve this?

    a) It would be great if it's automatically adjusted when submitting the ATM template name and account order object. Is that possible?

    b) If not, here's some brainstorming: I've been manually adjusting the ATM target leg quantities in the temporary "Custom" ATM settings. If the script can somehow use the current ATM settings in Chart Trader, even if they are NOT saved to an ATM template, that would be ok.
    StartAtmStrategy would be used in place of Account.Submit(). Our documentation has some example code that demonstrates how it can be used, and you may reference our AddOn Framework example for a working implementation. StartAtmStrategy can be given an AtmStrategy or a string for an Atm Strategy Template.

    AddOn Framework example - https://ninjatrader.com/support/help...t_overview.htm

    If you use the quantity from ChartTrader's Quantity property, then your order submission should use what ChartTrader has, which would change when you change your ATM strategy.

    Please be sure to peek through ChartControl.OwnerChart.ChartTrader with intelliprompt/intellisense to see how you can use it for your needs.

    We look forward to assisting.

    Leave a comment:


  • darkbluedove
    replied
    Thanks, Jim! This is quite helpful!

    Regarding ATM, it sounds like it's made to be simple to kick off an entry order. One concern I'm wondering about based on recent testing using NinjaTrader manually:

    Will the quantities of the target orders automatically adjust based on the quantity of the entry order? [BTW, any insights would help with my manual trading, too!]

    For example, let's say I often adjust the entry quantity, and I always want 2 targets with half quantity each. If I manually adjust the entry quantity, the ATM target quantities don't seem to adjust to be half/half. Like if the ATM was set to entry quantity 10, with 2 target legs of 5 & 5, then when I change the Chart Trader entry quantity for the next trade to be 14, I'd want the ATM target legs to be 7 & 7.

    1) Is there a way so that during manual trading, the ATM strategy adjusts the target leg quantities automatically based on the proportions in the ATM template?

    2) When using StartAtmStrategy(), what is the recommended way to achieve this?

    a) It would be great if it's automatically adjusted when submitting the ATM template name and account order object. Is that possible?

    b) If not, here's some brainstorming: I've been manually adjusting the ATM target leg quantities in the temporary "Custom" ATM settings. If the script can somehow use the current ATM settings in Chart Trader, even if they are NOT saved to an ATM template, that would be ok.
    Last edited by darkbluedove; 09-02-2020, 09:20 PM.

    Leave a comment:


  • NinjaTrader_Jim
    replied
    Hello darkbluedove and welcome to the forums, davidhuels!

    Chris is out of the office at this time, but I wanted to share some more information that might be helpful.

    For submitting ATM strategies with AddOn Framework code, please see our documentation below. StartAtmStrategy would be used instead of Account.Submit().

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

    For accessing ChartTrader properties, you could try accessing ChartControl.OwnerChart.ChartTrader. This is not documented, but you can use intellisense/intelliprompt to look at the properties therein.

    https://ninjatrader.com/support/help...elliprompt.htm

    I have also attached an example that can demonstrate using ChartControl.PreviewKeyDown events to monitor key presses.

    We look forward to assisting.
    Attached Files

    Leave a comment:


  • darkbluedove
    replied
    Originally posted by davidhuels View Post
    Hi darkbluedove - this is exactly what I've been looking for as well (preferably with the ISKEYDOWN option). Did you have any success yet? Unfortunately I don't know how to code it myself. All the best, David
    Hi, davidhuels. I'm optimistic that I should be able to get it working, at least without the ATM strategy; it looks like that might add some complication, so I'll probably phase it to start with an order and right quantity, and add an option to do half size (like Ctrl-Shift-2). I'm juggling priorities while learning the system as I'm new to it, so hopefully in the next couple weeks I should have something.

    Leave a comment:


  • davidhuels
    replied
    Hi darkbluedove - this is exactly what I've been looking for as well (preferably with the ISKEYDOWN option). Did you have any success yet? Unfortunately I don't know how to code it myself. All the best, David

    Leave a comment:


  • darkbluedove
    replied
    Sweet; thanks, Chris! This is great. I went through the materials and got the example indicator working. I'll see how far I get with my custom indicator. It will be really helpful in trading!

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    Hello darkbluedove , thanks for your post.

    This is possible in NinjaScript. I attached an example indicator that will submit a limit order at the price when you click the mouse. To detect if a keyboard key is pressed you can use IsKeyDown.

    Edit: I noticed you have questions on the ChartTrader settings. You need to use the WPF Automation ID to get the correct object. There is an example of the idea here. The same concept applies for the other ChartTrader elements. You can look for the automation ID of a WPF object by using inspect.exe

    Please let me know if you have any questions on this material.
    Attached Files
    Last edited by NinjaTrader_ChrisL; 08-28-2020, 09:06 AM.

    Leave a comment:


  • darkbluedove
    started a topic Single-click order entry on chart

    Single-click order entry on chart

    Hello,

    I know ChartTrader supports right-click and selecting limit order on the menu. I'd like to be able to single-click on the chart and have a buy/sell limit order placed there based whether it's below/above the last price. It should use the current settings from ChartTrader, e.g. account, quantity, and ATM strategy. I'd probably want it to require also pressing Shift+Ctrl while clicking.

    a) Is that possible out-of-the-box with some configuration?

    b) If not, can you point me in the right direction for how to build it with NinjaScript? I've written a couple of custom indicators. Would this be an indicator, or something else like an add-on or strategy? How would it receive mouse/keyboard input to detect Shift-Ctrl-click? And how does it place an order based on current ChartTrader settings? (Any pointers to relevant manual sections, examples, or existing forum threads would be plenty.)

    Thanks!

Latest Posts

Collapse

Topics Statistics Last Post
Started by gbajaj, Today, 03:35 PM
2 responses
7 views
0 likes
Last Post gbajaj
by gbajaj
 
Started by space_trader, Today, 03:19 PM
2 responses
8 views
0 likes
Last Post space_trader  
Started by max1ci6, Today, 02:02 AM
4 responses
27 views
0 likes
Last Post joromero  
Started by Johnny, Today, 02:38 PM
1 response
8 views
0 likes
Last Post NinjaTrader_Tyler  
Started by M_ichel, Today, 02:26 PM
1 response
5 views
0 likes
Last Post NinjaTrader_Tyler  
Working...
X