Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Is it possible to enter a position using an indicator and NOT a strategy?
Collapse
X
-
Hello Community,
Attached is an example of using the automation id to get the account selected in Chart Trader for a chart.
As well as a link to a code tidbit of getting the chart trader quantity.
https://ninjatrader.com/support/foru...365#post736365Last edited by NinjaTrader_ChelseaB; 01-12-2023, 04:06 PM.
- Likes 1
-
With regard to my colleague Jesse's advice earlier, I have prepared an add-on which exposes several ChartTrader fields as static members of an add-on that are refreshed to the active ChartTrader window.
This script was prepared for educational purposes and will not be maintained. In future versions of NinjaTrader, should a code change break this script, your first debugging step should be to follow Jesse's advice regarding the Inspect tool.Attached Files
Leave a comment:
-
Hello,
I reviewed the prior items we have with your username on the forum and it appears we had tried to follow up by email regarding the chart pausing but did not get a response back. Potentially there was a missed message somewhere.
Could you send an email to platform support [at] ninjatrader [dot] com and we can resend the prior information to that email. Please include ticket number 1559448
I look forward to being of further assistance.
Leave a comment:
-
I think this should work - I'll let you know if I have any hiccups, but this should get everything done I need.
On an unrelated note Jesse, my chart is still pausing... any progress with that on your end now that I've provided every file I have? I upgraded to .13 today. Same issue.
Leave a comment:
-
Hello,
Thank you for the reply.
Querying the current selector would likely prove to be difficult, I am unsure of a existing example of this.
You can likely use the Addon sample to review the syntax used for creating an ATM selector. Using the knowledge from this example in contrast to the Indicator example, you may be able to work out a solution for this.
Likely you would need to utilize the same approach as shown for finding the ChartTrader control by its automation id.
Code:chartTrader = Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowChartTraderControl") as ChartTrader;
Inspect: https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx
The found ID for the selector was:ChartTraderControlATMStrategySelector
Code:NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrategySelector selector = chartTrader.FindFirst("ChartTraderControlATMStrategySelector") as NinjaTrader.Gui.NinjaScript.AtmStrategy.AtmStrategySelector; NinjaTrader.NinjaScript.AtmStrategy.StartAtmStrategy(selector.SelectedAtmStrategy, entryOrder);
Regarding changing the stop and limit, these can only be controlled by the ATM its self meaning whatever is set in the ATM's template. Unfortunately there is no way to modify these outside of this.
To change these, you would likely need an array of templates to choose from based on logic, or if you are instead looking to do stop and target modifications by code, you may not want to utilize an ATM and instead create your own logic/user interface controls to accomplish that specifically.
I look forward to being of further assistance.
Leave a comment:
-
Jesse,
This is great. I have everything I need to do exactly what I want, but I need two last pieces...
1. How would I query the elements in the Chart Trader section to get the currently selected account and ATM strategy?
2. How would I change the stop and limit prices of an ATM strategy either before they are placed or just after they are executed (i.e. after the stop trigger is activated)?
The idea is that I can click my order button and have it execute my ATM strategy as soon as a particular bar closes but ONLY after I have armed the appropriate button.
Adam
Leave a comment:
-
Hello,
You could do that as well, in this case you could use either an indicator or an addon depending on the use case.
Consider if the result should be only on 1 chart where the indciator is applied, or on all charts even where there are no indicators applied (like a native tool).
A indicator would work best to modify a single chart, an addon would work best to modify the entire platform or all windows of a type.
There is already an example of adding a button to the chart trader from an indicator here: http://ninjatrader.com/support/forum...7&postcount=23
This sample is old, so you would need to change the line:
Code:this.Dispatcher.Invoke(() =>
Code:this.Dispatcher.InvokeAsync(() =>
The same concept would apply in an addon. The Window instance that is retrieved on line 80 would be replaced with the addons window that is passed in from the override.
I look forward to being of further assistance.
Leave a comment:
-
Thank you Jesse... would it also be possible to add a button to the Chart Trader window to execute those custom orders?
I already have the logic developed and it works with a strategy, the problem comes when using the other buttons to scale in or out of a position. The close button is currently set to disable strategies.
I would like to just use regular orders and not strategies to fix this problem as well as to co-locate buttons in 1 place.
Leave a comment:
-
Hello,
In NT8 this would be possible using the Addon base methods.
For a syntax example you can see this document: http://ninjatrader.com/support/helpG...tmstrategy.htm
A strategy simplifies repetitive orders by allowing the logic to be executed after enabling and also has properties for specific account related items. In regard to doing this type of logic outside of a strategy, you are going to be doing a lot more of your own logic because you take the Strategy out of the mix.
The addon sample provided about also entails you know how to get the Account object to place an order etc. I just wanted to mention this as Sledge had said there is a reason for separation and in the case you do not need extra work, a strategy is always the more simple way to go.
I look forward to being of further assistance.
Leave a comment:
-
Why would you not want to use a strategy anyways?
What would you gain?
There is a reason for the separation.
Leave a comment:
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Padan, Today, 02:02 AM
|
9 responses
21 views
0 likes
|
Last Post Today, 03:27 PM | ||
Started by spottysallrite, Today, 11:31 AM
|
7 responses
21 views
0 likes
|
Last Post Today, 03:26 PM | ||
Started by nandhumca, Today, 03:15 PM
|
1 response
2 views
0 likes
|
Last Post Today, 03:23 PM | ||
Started by PopovDS, 03-11-2024, 12:49 PM
|
3 responses
17 views
0 likes
|
Last Post
by PopovDS
Today, 03:16 PM
|
||
Started by Lele2k24, Yesterday, 11:24 AM
|
12 responses
37 views
0 likes
|
Last Post Today, 03:07 PM |
Leave a comment: