Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Single-click order entry on chart

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

  • NinjaTrader_ChrisL
    replied
    Hi, thanks for posting your question. The indicator examples that we provide come "As Is" so we will not be able to add any extra features after uploading. You can use StartATMStrategy to add such functionality:



    Kind regards,
    -ChrisL

    Leave a comment:


  • oldporkchops
    replied
    Hi Chris,

    Thank you for sharing. This indicator could use a qualifier key so that not all mouse clicks on the chart are recorded as entries.

    Also, is there a newer version that allows any entries to take on the properties of the prevailing ATM strategy?

    Thanks again.


    Originally posted by NinjaTrader_ChrisL View Post
    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.

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello NTTrader33,

    That would depend on what your goals are, you would need to adjust it as needed to match your goals. The script uses the same price for the two orders that are submitted so if your goal is not specifically that then you would have to modify it to be how you wanted instead.

    That script is intended to demonstrate a few concepts such as finding an account using the addon framework, using order events, using mouse coordinates and converting mouse coordinates to a price. It does not do anything else like offset the orders or place them in a logical way that would be used for normal trading, its just meant to show off those programming concepts so that you can re use those concepts later in your own scripts.

    I would never suggest using a sample script from the forum or user app share to trade on a live account, I would only suggest to use scripts that you personally created and have fully tested to trade live so that you know exactly what is happening with the logic.

    Leave a comment:


  • NTTrader33
    replied
    Originally posted by NinjaTrader_Jesse View Post
    Hello NTTrader33,

    You can use the NinjaScript editor to edit the scripts that you import.

    A live trade would not get stuck like that, that only happens on the sim account. I would not suggest using the attached script on a live account as mentioned that is not intended for actual trading but is just an example of a programming concept.
    What would make a script based on that example any more appropriate for live trading than the attached one?

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello NTTrader33,

    You can use the NinjaScript editor to edit the scripts that you import.

    A live trade would not get stuck like that, that only happens on the sim account. I would not suggest using the attached script on a live account as mentioned that is not intended for actual trading but is just an example of a programming concept.

    Leave a comment:


  • NTTrader33
    replied
    Originally posted by NinjaTrader_Jesse View Post
    Hello NTTrader33,

    LeftMouseDown is part of the scripts code, if you want to find out why the script is pricing the orders as you described then you would have to look into the code being used in that script. The orders in that sample use the same price so if you wanted to offset them from each other you would have to edit the code so it uses different prices for each order.

    The files attached to forum posts are generally just samples of programming concepts, the sample that you are using wouldn't be intended for actual trading but just to show how to get a price using mouse coordinates and then use it. You would have to look at the code and learn the concepts that it shows if you wanted to make something similar of your own.


    For stuck orders you can reset the sim account to clear those. https://ninjatrader.com/support/help...01_account.htm




    How do I access the code in this script? What is the function of the offset setting in the indicator? If I had been trading live, would I potentially get the orange stuck orders? If so, how would I reset the live account?

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello NTTrader33,

    LeftMouseDown is part of the scripts code, if you want to find out why the script is pricing the orders as you described then you would have to look into the code being used in that script. The orders in that sample use the same price so if you wanted to offset them from each other you would have to edit the code so it uses different prices for each order.

    The files attached to forum posts are generally just samples of programming concepts, the sample that you are using wouldn't be intended for actual trading but just to show how to get a price using mouse coordinates and then use it. You would have to look at the code and learn the concepts that it shows if you wanted to make something similar of your own.


    For stuck orders you can reset the sim account to clear those. https://ninjatrader.com/support/help...01_account.htm





    Leave a comment:


  • NTTrader33
    replied
    Originally posted by NinjaTrader_Jesse View Post
    Hello NTTrader33,

    Can you post an image of what orange record you are referring to?

    If you are having trouble with the pricing you would need to print out the prices you are seeing in the scripts LeftMouseDown method to see what prices are generated. The script you are using has LeftMouseDown method which controls the order submission and gathering prices.
    What is LeftMouseDown, and how do I use it? Click image for larger version

Name:	image.png
Views:	217
Size:	30.0 KB
ID:	1223951

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello NTTrader33,

    Can you post an image of what orange record you are referring to?

    If you are having trouble with the pricing you would need to print out the prices you are seeing in the scripts LeftMouseDown method to see what prices are generated. The script you are using has LeftMouseDown method which controls the order submission and gathering prices.

    Leave a comment:


  • NTTrader33
    replied
    This morning I woke up and my sim account charts all have orange colored record of all the orders from last night when I was playing with this indicator. I can't delete them and they are cluttering my charts.

    Leave a comment:


  • NTTrader33
    replied
    Originally posted by NinjaTrader_ChrisL View Post
    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.
    I downloaded and installed this script. When I click above price, it sets a Buy Stop and Sell Limit order, but puts them both at the same price, so the position gets liquidated immediately. I tried various offset settings, and nothing changed. How can I change where the closing order is relative to the entry price?

    Leave a comment:


  • 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:

Latest Posts

Collapse

Topics Statistics Last Post
Started by TheWhiteDragon, 01-21-2019, 12:44 PM
5 responses
551 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by rtwave, 04-12-2024, 09:30 AM
5 responses
37 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by funk10101, Today, 12:02 AM
1 response
11 views
0 likes
Last Post NinjaTrader_LuisH  
Started by GLFX005, Today, 03:23 AM
1 response
6 views
0 likes
Last Post NinjaTrader_Erick  
Started by nandhumca, Yesterday, 03:41 PM
1 response
13 views
0 likes
Last Post NinjaTrader_Gaby  
Working...
X