Entry orders can have an OCO ID and have an Atm Strategy attached.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Faster order entry on Chart Trader. Click Trader?
Collapse
X
-
.. come out of playback and it's leaving orange orders everywhere that I cannot cancel ..
Just curious myself with a few questions that might help Mindset.
In Sim mode hung orders are a sign its time to just execute the fast simple fix of resetting the sim account.
Q1: Is there a parallels need and opportunity when orders get hung when using the Playback account?
Q2: Is there a pragmatic auto-reset to the playback? Like does exiting and restarting NT8 auto-reset the Playback account?
Thanks.
Comment
-
Originally posted by emuns View Post
problems remain to be solved:
1) how to avoid an error when clicking the chart with the mouse without pressing the left shift key (see error in a Log:Would anyone know how to do that?Failed to submit orders: System.NullReferenceException: Object reference not set to an instance of an object. at NinjaTrader.Cbi.Account.Submit(IEnumerable`1 orders);
emuns
HedgePlay
Comment
-
Hi emuns,
I would love to see much faster cleaning in-chart intelligent order entry so I ask how is the project progressing?
Originally posted by emuns View Post
2) So far only a simple limit order can be placed, but I would like to place a limit input of an "ATM" Strategy (with predefined SL and PT in chart trader).
Would anyone know how to do that?
The third link Chelsea posted above has good clean code that directly answers this question.
One input for next step considerations conversations on integration of ATMs can be found in Bob's recent Large Trades Strategy posting. https://ninjatraderecosystem.com/use...gy-nt8-update/
Chelsea and others likely have good or better links as well.
In Bob's strategy read the words 'Boosting' as use of an ATM.
Bob has implemented IgnoreAllErrors and I not I am personally ready for to use that with just the error protections he has included but it certainly helps widen the conversation on how to further evolve ATM integration in strategies and indicators.
His ATM code is a little hard to find an first so I am include a snip (not ready to compile) to highlight that section of the strategy.
HedgePlay
Code:// Boosting via additon of ATM strategies private bool InPosition2 { get { return atmStrategyId2.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId2) != MarketPosition.Flat; } } /////////////////////////////////////////////////////////////////////////////// // Use an ATM for Boosting, add on additional trades private void LookForTrade2() { /// Make sure this strategy does not execute against historical data if(State == State.Historical) /// Halt further processing of our strategy return; /// bullish boost if (UseOrderflow == true && canTradeTime() && OrderFlowCumulativeDelta1.DeltaClose[0] > 1) // bar { if (orderId2.Length == 0 && atmStrategyId2.Length == 0) { isAtmStrategyCreated2 = false; // reset atm strategy created check to false atmStrategyId2 = GetAtmStrategyUniqueId(); Print("----atmStrategyID is : " +atmStrategyId2.ToString()); orderId2 = GetAtmStrategyUniqueId(); AtmStrategyCreate(OrderAction.Buy, OrderType.Market, Low[0], 0, TimeInForce.Day, orderId2, ATMName, atmStrategyId2, (atmCallbackErrorCode, atmCallBackId) => { //check that the atm strategy create did not result in error, and that the requested atm strategy matches the id in callback if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId2) isAtmStrategyCreated2 = true; }); } } /// bearish boost if (UseOrderflow == true && canTradeTime() && OrderFlowCumulativeDelta1.DeltaClose[0] < -1) // bar { if (orderId2.Length == 0 && atmStrategyId2.Length == 0) { isAtmStrategyCreated2 = false; // reset atm strategy created check to false atmStrategyId2 = GetAtmStrategyUniqueId(); Print("----atmStrategyID is : " +atmStrategyId2.ToString()); orderId2 = GetAtmStrategyUniqueId(); AtmStrategyCreate(OrderAction.Sell, OrderType.Market, High[0], 0, TimeInForce.Day, orderId2, ATMName, atmStrategyId2, (atmCallbackErrorCode, atmCallBackId) => { //check that the atm strategy create did not result in error, and that the requested atm strategy matches the id in callback if (atmCallbackErrorCode == ErrorCode.NoError && atmCallBackId == atmStrategyId2) isAtmStrategyCreated2 = true; }); } } // Check That atm strategy was created before checking other properties if (!isAtmStrategyCreated2) return; // Check for a pending entry order if (orderId2.Length > 0) { string[] status = GetAtmStrategyEntryOrderStatus(orderId2); // If the status call can't find the order specified, the return array length will be zero otherwise it will hold elements if (status.GetLength(0) > 0) { // Print out some information about the order to the output window Print("The entry order average fill price is: " + status[0]); Print("The entry order filled amount is: " + status[1]); Print("The entry order order state is: " + status[2]); // If the order state is terminal, reset the order id value if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected") orderId2 = string.Empty; } } // If the strategy has terminated reset the strategy id else if (atmStrategyId2.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId2) == Cbi.MarketPosition.Flat) atmStrategyId2 = string.Empty; if (atmStrategyId2.Length > 0) { } } // Flatten function private void FlattenPosition2() { if (InPosition2) { foreach (Order order in Account.Orders) //First foreach loop, to get working orders { if(order.OrderState == OrderState.Working || order.OrderState == OrderState.Accepted) //This will print all working orders on the account { if (order.Name == "Entry") //Checks if the order name is Stop1, and if so, assigns it to an order object. { var orders = Account.Orders.Where( x => x.Instrument == Instrument && !Order.IsTerminalState(x.OrderState)); if(orders.Count()!= 0) { Print( Name +"********"+ Instrument.FullName +", "+ BarsArray[0].BarsPeriod +": active orders detected to cancel: " + orders.Count().ToString()); } Account.Cancel(new[] { order }); // Cancel the Buy Stop / Sell Stop } } } Print("----Closing ATM for : " + atmStrategyId2.ToString()); AtmStrategyClose(atmStrategyId2); atmStrategyId2 = string.Empty;; } }/////////////////////////////////////////////////////////////////////////////// End Boosting via ATM
- Likes 1
Comment
-
Hello hedgeplay,
If you are using 8.0.23.0 and orders without OCO IDs are getting stuck in pending submit but the playback continues to advance, this should be investigated.
Are you able to reproduce this?
Where you have inquired:
" Is there a parallels need and opportunity when orders get hung when using the Playback account?"
I'm not certain what you asking. What does 'parallels need and opportunity' mean?
Where you have asked:
" Is there a pragmatic auto-reset to the playback? Like does exiting and restarting NT8 auto-reset the Playback account?"
If you change the Go To time this will reset the Playback101 account. If you disconnect from the Playback connection, this will reset the Playback101 account.
Chelsea B.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello hedgeplay,
If you change the Go To time this will reset the Playback101 account. If you disconnect from the Playback connection, this will reset the Playback101 account.
You have answered both questions with the statement above.
HedgePlay
Comment
-
Hello to all,
I´m sorry, but I was too busy. Maybe I will be able to look at it at the and of this week. I would love to have this indicator because the default way of entering limit orders in NT is very impractical. It´s just a question of whether I´m up to it...?
Thank you Chelsea for your help!
emuns
Comment
-
Hello Mindset,
Thank you for confirming this.
Are you using the latest release 8.0.23.0 and able to reproduce the behavior?
If so, may I test the script on my end to see if I am able to reproduce?
To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:- Click Tools -> Export -> NinjaScript...
- Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
- Click the 'Export' button
- Enter a unique name for the file in the value for 'File name:'
- Choose a save location -> click Save
- Click OK to clear the export location message
- (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
http://ninjatrader.com/support/helpG...-us/export.htmChelsea B.NinjaTrader Customer Service
Comment
-
Originally posted by Mindset View PostThe obj instance error is resolved by my version emuns.
thank you for your input and help. Yes, you solved problem one!
The problematic part of your script was probably typo and I suppose that you have already discovered that (row 142 is IsKeyDown instead of IsKeyUp).
I suppose that the string of "name" of myAccount.CreateOrder, when using with ATMstrategy, must be always "Entry" (not Entry1 and so on).
What is interesting that for the first time I also noticed a problem with pending order left in the market after the position was closed. But than I did not notice such behavior. So I´m a little worried about using this indicator for live trading...
I suppose that your last version is the ClickLimitMine you already posted above?
Thank you,
emuns
Comment
-
Ninjatrader really should find a way to implement one-click entry of at least limit orders similar to the DOM. Having to right click and find the right command and then click is simply not efficient in live trading a fast market. Yesterday, I actually went long by accident (filled on a buy limit which should have been a sell limit).
- Likes 2
Comment
-
My 2 cents. I have no idea why a faster order entry method isn't standard on the Ninjatrader chart; Sierra has the Chart DOM with single click entry and is fantastic.
Anyway, I have reviewed and tested the products below and compiling them here for future reference for others that want single click order entry submission from the chart itself:
1) https://www.volaty.com/products/indicators/clicker/ - This is the one I ultimately purchased. Why? Because it does the same thing as the others but is extremely cheap ($75 right now). I also like that it shows a preview of the order you are about to submit once you press the keyboard key (i.e. once I push Control or whatever key you assign, it will show the Ninja buy limit or buy stop order where the cursor is and then it will submit once I click). Foolproof, works great, and is cheap.
2) https://whitmarkdev.com/atm-one-click-trader/ - Second least expensive of the group with some other features / buttons, none of which I needed but someone might find useful.
3) https://www.ticktec.com/product/1clickchartdom - Super cool indicator that superimposes the entire DOM on the chart with a bunch of other features. I don't need depth nor any of the other features to be visibile so didn't need all this, but if you like seeing depth, this is awesome and is way more feature rich than the Sierra Chart DOM.
4) https://www.quicktradeninja.com/ - Most expensive of the group, but with some other features included, none of which I need.
- Likes 5
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by judysamnt7, 03-13-2023, 09:11 AM
|
4 responses
59 views
0 likes
|
Last Post
by DynamicTest
Today, 08:25 PM
|
||
Started by ScottWalsh, Today, 06:52 PM
|
4 responses
36 views
0 likes
|
Last Post
by ScottWalsh
Today, 07:40 PM
|
||
Started by olisav57, Today, 07:39 PM
|
0 responses
7 views
0 likes
|
Last Post
by olisav57
Today, 07:39 PM
|
||
Started by trilliantrader, Today, 03:01 PM
|
2 responses
21 views
0 likes
|
Last Post
by helpwanted
Today, 07:25 PM
|
||
Started by cre8able, Today, 07:24 PM
|
0 responses
10 views
0 likes
|
Last Post
by cre8able
Today, 07:24 PM
|
Comment