i have already looked around in the forum and hasnt found a solution yet.
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!
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
NinjaTrader
Chart trader customization
Collapse
X
-
Chart trader customization
Is it possible to intercept a buy/sell order click on chart trader and then do some validation on account before letting it place order. The intent is to ensure that over trading is not allowed and once account crosses n position or loss , no further order entry is allowed.
i have already looked around in the forum and hasnt found a solution yet.Tags: None
-
Hello [email protected],
Manual trades will affect the account.
Using the Addon approach, you can add a method handler to the <account>.ExecutionUpdate method.
Below is a link to the help guide.
https://ninjatrader.com/support/help...tionupdate.htm
However, you would not be able to prevent the order from being placed.
Instead, you can write the addon to have a button that when clicked will decide to place the order if conditions are correct.
Below is a link to an example addon that places orders.
Chelsea B.NinjaTrader Customer Service
-
thanks Chelsea, this has been helpful, i actuall used the "Add on Framework" example to build my own chart trader.. was able to incorporate validation before placing orders. Two new things i am now stuck at:
1. Attaching to the chart window; a individual chart can have its own TradeManager add on just like default ChartTrader. Need to be able to attach to the chart it should be on top of chart or side by side to the chart(ust like default chart trader is positioned).
2. Need some guidance on placing limit order ; need some help on how to get last bid or last ask price. not sure how to access last bid/ask in the order place scenario from add on.
entryOrder = accountSelector.SelectedAccount.CreateOrder(Instru ment, OrderAction.Buy, OrderType.Limit, tifSelector.SelectedTif, qudSelector.Value, <GetLastBid>, 0, string.Empty, "Manish-CT-"+btnBuyMarket.Content.ToString(), null);1 Photo
- Likes 1
Comment
-
Hello [email protected],
Please take a look at the ChartCustomSidePanelExample_NT8 linked below.
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
As well as an example that places orders through the Addon approach.
Chelsea B.NinjaTrader Customer Service
- Likes 1
Comment
-
Thank you Chelsea for that snippet, is there any way to add account selector ( below the button 2) in the ChartCustomSidePanelExample_NT8 script. I tried getting a reference from account selector from charttrade and tried adding that as in the next row but nothing appeared
NinjaTrader.Gui.Tools.AccountSelector accountSelector = Window.GetWindow(ChartControl.Parent).FindFirst("C hartTraderControlAccountSelector") as NinjaTrader.Gui.Tools.AccountSelector;
System.Windows.Controls.Grid.SetRow(accountSelecto r, 2);
System.Windows.Controls.Grid.SetColumn(accountSele ctor, 0);
buttonGrid.Children.Add(accountSelector);
Comment
-
i think i might have figured it out.. am using xmal to define my structure and then loading it at run time. appreciate your help in this.
Comment
-
Hi manishzain,
"I actuall used the "Add on Framework" example to build my own chart trader.. was able to incorporate validation before placing orders."
This is pretty amazing actually! I have been struggling with this for a long timer. This will help a lot of people with discipline issues. One can build various checks.. say for example.. if 3 losers in a row, then no more trading in that day OR if Daily Loss Limit reached OR maybe a timeout from placing new orders of 1 hour. Calculate overall risk(sometime one loses perspective) etc etc
If you can Please share in the sharing section.. if not possible a code snippet would be helpful too. Thanks
Comment
-
Hello [email protected],
Yes, an account selector can be added.
Below is a link to an example.
I don't have examples of the custom logic you are wanting for order placement and you will need to create this custom logic.
I do have an example of a daily loss limit strategy you may find helpful.
Hello, I've updated the DailyLossLimit and DailyLosLimitMultiTrade examples that were posted on the forum for NinjaTrader 7 for NinjaTrader 8. These are often requested and I felt they are good examples to have for NT8. DailyLossLimitExample_NT7 - http://ninjatrader.com/support/forum...241#post451241 (http://ninjatraderChelsea B.NinjaTrader Customer Service
Comment
-
thanks Chelses, i used a different way to get Account selector, i will review the example you quoted; This is how it looks as of now with live trading, was able to incorporate validation framework before submitting the order; also creating an add on to help track & handle any manual orders.
One more thing i'm struggling with is how do i make this new chart trader window stick to other open "chart tab/window" for the same instrument?
The other challenge i have is to find out orders with OCO (strategy) and cancel those when one of the order is canceled/filled. (i think . i will figure that out, just need some research)
learned so much for your help on this, learnt a lot about ninjascript in last one week; This add on is something i wanted from a long time.1 Photo
Comment
-
Originally posted by SuperDriveGuy View PostHi manishzain,
"I actuall used the "Add on Framework" example to build my own chart trader.. was able to incorporate validation before placing orders."
This is pretty amazing actually! I have been struggling with this for a long timer. This will help a lot of people with discipline issues. One can build various checks.. say for example.. if 3 losers in a row, then no more trading in that day OR if Daily Loss Limit reached OR maybe a timeout from placing new orders of 1 hour. Calculate overall risk(sometime one loses perspective) etc etc
If you can Please share in the sharing section.. if not possible a code snippet would be helpful too. Thanks
https://ninjatraderecosystem.com/user-app-share/
Comment
-
Hello [email protected],
I am not aware of any way to stick one window to another.
Instead, you can modify the chart itself. Any selectors and objects like buttons can be added to a chart by modifying the charts WPF.
OCO is a string that is a parameter with the order method. If the OCO strings are the same, the two orders are grouped.
The ProfitChaseStopTrailAddonExample I have provided a link to uses OCO strings.Chelsea B.NinjaTrader Customer Service
Comment
-
thanks Chelsea, if there any way to enable Chart trader by script and then hide it immediately. i realized that for my trades to be shown on chart i need to have chart trader enabled ? thanks,
- Likes 1
Comment
-
Hello [email protected],
I've not tried this but maybe you can set this from ChartControl.ChartTraderVisibility.
From the help guide:
"ChartTraderVisibility An enum indicating the visibility status of Chart Trader. Possible values are Collapsed, Visible, and VisibleCollapsed"
https://ninjatrader.com/support/help...properties.htm
But also:
"Warning: These are UI properties which are designed to be set by a user. Attempting to modify these values through a custom script is NOT guaranteed to take effect."
If you find it doesn't work, let me know and I'll put in a feature request for you for the development to put under consideration.Chelsea B.NinjaTrader Customer Service
Comment
-
Manishzain [email protected] Were you able to get your orders shown on the chart? I have built a similar custom side panel to yours using Chelsea's "CustomChartSidePanelExample" as a guide, so it's an indicator, not an AddOn. My chart is showing me the trade markers, but it won't show me the location of any orders placed by my ATM strategy. (ie The target and stop loss orders aren't displayed on the screen).
Comment
-
Somehow I was I setting the account property of the chart trader at the wrong time... idk. This is what worked for me in the end:
protected void CreateWPFControls()
{chartWindow = System.Windows.Window.GetWindow(ChartControl.Paren t) as Chart;
chartGrid = chartWindow.MainTabControl.Parent as System.Windows.Controls.Grid;
chartTrader = chartWindow.FindFirst("ChartWindowChartTraderContr ol") as Gui.Chart.ChartTrader;
...
...
build out buttons/account selctor/etc
...
// When the account selector's selection changes, call a custom function
accountSelector.SelectionChanged += (o, args) => { updateNickAccount(o, args); };
// I could set the visibility here but couldn't set the account. Maybe the selector had no value yet.
chartWindow.ChartTrader.ChartTraderVisibility = ChartTraderVisibility.VisibleCollapsed;
}
private void updateNickAccount(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{...
// when I set it here, it worked
chartWindow.ChartTrader.Account = accountSelector.SelectedAccount;
...
}
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
6 responses
28 views
0 likes
|
Last Post Today, 08:55 AM | ||
Started by gbourque, Today, 06:39 AM
|
2 responses
14 views
0 likes
|
Last Post
by gbourque
Today, 07:05 AM
|
||
Started by rexsole, Today, 08:39 AM
|
0 responses
4 views
0 likes
|
Last Post
by rexsole
Today, 08:39 AM
|
||
Started by trilliantrader, Yesterday, 03:01 PM
|
3 responses
31 views
0 likes
|
Last Post Today, 08:28 AM | ||
Started by Brevo, Today, 01:45 AM
|
1 response
14 views
0 likes
|
Last Post Today, 08:14 AM |
Comment