Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I have the following tricky NinjaScript coding {questions} . . . which I am hoping you guys may help me with .............. I know I would arrive at these answers, eventually, but I would greatly appreciate if you guys could give me a head start:
1. Could someone please show me how I would submit 2 limit orders, one at the best bid & one at the best ask, that is, Buy-limit at the best bid & Sell-limit at the best ask ,,,,,,,,,,,,,, ?
2. After performing the above , could someone please show me how I would check and see if these limit orders got filled ,,,,,,,,,,,,,,,,,,,,,,,, ??
3. And now, could someone please show me how I would go about cancelling these limit orders ,,,,,,,,,,,,,,,,,,,,,,,,,,, ???
Thanks in advance for any help you may provide , Would be greatly appreciated !!
Thanks again,
Jimmy M. Espana
Can you help answer these questions from other members on NexusFi?
here are a few links back to the official NT7 help guide that should get you pointed in the right direction:
EnterLongLimit() EnterShortLimit()
keep in mind that you may not be able to straddle the market due to the Frank-Dodd stuff unless you are using two separate accounts
Advanced Order Handling
click to expand the second section that discusses IOrder class and OnOrderUpdate()
thanks "eman" for the quick response . . . . . . . . . . . . I'll check those out ............................................. "eman" or anybody else . . . please see attachment attached ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, in addition to my above questions.... I want / need help with how to keep track of position in line . . . . for example, after submitting those said two limit orders........................ looking at this attachment,,, here's my explanation for the #s seen in this attachment:
What is highlighted in blue area is one scenario , the part above it is another scenario . . . each of these portions, can be considered 3-parts/3-levels ,,,,,,, the first part/first level, let's take for example the blue highlighted region, where there is a "7" and a "10", think of this as the two queues for best bid & best ask.... this is before we enter the two limit orders..... once our two limit orders are put into the queue...... now note the 2 part / 2 level ...... each queue is now +1 ...... b/c we just entered the best bid & best ask queues ......... doing so,, places us in place "8" & in place "11" , in the best bid & best ask queues , respectively ............. Now after having entered the lines..... some people/contracts ahead in those lines are satisfied (and leave the queue) & also some people/contracts come in line behind us ........ {{ I hope I'm making sense , you should be following my logic , at least I hope so , lol }} ................ after this activity/movement, we are no longer in the same place in line as we were when we first entered the line ....... the math being shown, should make sense . . . . . . . .
Alright,,,,, I hope you're following me ................................................ okay ...... back to where I want to go with this,,,, namely.... "how to keep track of position in line" .................... more specifically:
How (using NinjaScript) do I accomplish the goal of knowing where exactly am I in the line at any point in time ?
I know I need to GET the volume of the best bid & best ask . . . . I know I must know how much people/contracts ahead of me in line have left . . . . I know I must know how much people/contracts just got behind in line . . . . . . Okay/alright/fine....... Could someone please help me with how I would do this in NinjaScript . . . provide me with an example...... or could answer these questions for me, please ???
two clarifications:
1. using limit orders allows you to specify a price; once submitted your limit price wouldn't change with the market;
2. until your order is filled, you may update your limit order as the Bid/Ask changes on a tick-by-tick basis.
i haven't tried (and am not sure if it's possible) to monitor my position in the queue. perhaps others have done some work in this area.
thanks "eman" for your input ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ladies & gentlemen . . . anyone else can help (please) ????
I have an idea regarding this . . . . . How could I (via NinjaScript) be able to find-out and/or know how much people/contracts just got traded on the most recent "last trade" ?
[[[ that is,, how to determine the 'volume' of the 'last trade' ?? ]]]
( furthermore,,,, & whether this 'last trade' occurred on the best bid side or the best ask side ,,,,,,,,,,, ??? )
to help out ,,,,, let's take the SuperDOM ........... the 'last trade' is highlighted in yellow..... & throughout each tick (aka trade)...... this yellow highlight switches between the best bid & best ask price levels ................. moreover... when this happens...... there's always # in parentheses . . . which I understand to be . . the last traded volume , , , , , , , , , , , , , , , , , , ,
Alright,,,, looking forward to some replies . . . . . Thanks in advance !
i thought you were asking how to read the current order book at the exchange to determine what sequence/position your order is, etc.
cheers,
-e
edit: as far as volume of the last trade, if you have a 1-tick data series, then each "bar" in OnBarUpdate() would contain the price and volume of the last trade. you can also access this info via OnMarketData(), which is an advanced topic.
What you are looking for is EPIQ (Estimated Position In Queue) feature of X_Trader, which ninja trader does not have.
You can write one for Ninja , but it is only an estimate, because you are only estimating the cancels that occur in front of you in the queue in addition to trades.
I need help with some coding.. It's done for the most part, but I'm trying to do something I don't know how to code.
When the signal is given for a long, I want to enter at the HIGH of the bar prior to the signal bar.
Or (option #2) Enter at the High + 1 tick of the bar prior to the signal bar.
When the signal is given for a short, I want to enter at the LOW of the bar prior to the signal bar.
Or (option #2) Enter at the Low -1 tick of the bar prior to the signal bar.
I don't know how to code that and the Strategy creation wizard isn't much help. Can anyone help? Something like this:
ex: If long condition met:
EnterLong High[1]; (enter long at the high of the previous bar)
or EnterLong High[1]+1 tick; (or enter long at the high + 1 tick, of the previous bar)
ex: If short condition met:
EnterShort Low[1]; (enter short at the low of the previous bar)
EnterShort Low[1] -1 tick: (or enter short at the low -1 tick, of the previous bar)
Thank you for your consideration and time.
I'll be happy to share the strategy, once I get it working!
After all, it's what you learn AFTER you know it all, that counts!