Tricky NinjaScript coding {questions} . . . - NinjaTrader Programming | futures io social day trading
futures io futures trading


Tricky NinjaScript coding {questions} . . .
Updated: Views / Replies:2,373 / 10
Created: by jmejedi Attachments:2

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 2  
 
Thread Tools Search this Thread
 

Tricky NinjaScript coding {questions} . . .

  #1 (permalink)
Elite Member
Lilburn, GA
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: VelocityFutures/TT
Favorite Futures: ES
 
jmejedi's Avatar
 
Posts: 62 since Jan 2011
Thanks: 13 given, 3 received

Tricky NinjaScript coding {questions} . . .

Fellow brothers & sisters traders,

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

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
 Vendor: www.coroin.com 
Galveston ,TX
 
Futures Experience: Intermediate
Platform: NT7
Broker/Data: Zaner
Favorite Futures: Futures
 
Posts: 386 since Mar 2010
Thanks: 364 given, 433 received


here are a few links back to the official NT7 help guide that should get you pointed in the right direction:


jmejedi View Post
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 ,,,,,,,,,,,,,, ?

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


jmejedi View Post
2. After performing the above , could someone please show me how I would check and see if these limit orders got filled ,,,,,,,,,,,,,,,,,,,,,,,, ??

Advanced Order Handling
click to expand the second section that discusses IOrder class and OnOrderUpdate()


jmejedi View Post
3. And now, could someone please show me how I would go about cancelling these limit orders ,,,,,,,,,,,,,,,,,,,,,,,,,,, ???

CancelOrder()

cheers,
-e

Reply With Quote
 
  #4 (permalink)
Elite Member
Lilburn, GA
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: VelocityFutures/TT
Favorite Futures: ES
 
jmejedi's Avatar
 
Posts: 62 since Jan 2011
Thanks: 13 given, 3 received

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 ???

Thanks in advance,
Jimmy M. Espana

Attached Thumbnails
Tricky NinjaScript coding {questions} . . .-keepingtrackofpositioninline.jpg  
Reply With Quote
 
  #5 (permalink)
 Vendor: www.coroin.com 
Galveston ,TX
 
Futures Experience: Intermediate
Platform: NT7
Broker/Data: Zaner
Favorite Futures: Futures
 
Posts: 386 since Mar 2010
Thanks: 364 given, 433 received

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.

cheers,
-e

Reply With Quote
 
  #6 (permalink)
Elite Member
Lilburn, GA
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: VelocityFutures/TT
Favorite Futures: ES
 
jmejedi's Avatar
 
Posts: 62 since Jan 2011
Thanks: 13 given, 3 received

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 !

- Jimmy M. Espana

Reply With Quote
 
  #7 (permalink)
 Vendor: www.coroin.com 
Galveston ,TX
 
Futures Experience: Intermediate
Platform: NT7
Broker/Data: Zaner
Favorite Futures: Futures
 
Posts: 386 since Mar 2010
Thanks: 364 given, 433 received

maybe i misunderstood what you're asking here ... you can get the current ask/bid and volume by using GetCurrentAsk(), GetCurrentAskVolume(), GetCurrentBid(), and GetCurrentBidVolume()

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.

Reply With Quote
 
  #8 (permalink)
 Vendor: www.traderwerks.com 
Taipei Taiwan
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Optimus
Favorite Futures: TW
 
Posts: 693 since Jun 2009
Thanks: 440 given, 440 received

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.

Have fun

Math. A gateway drug to reality.

Last edited by traderwerks; May 12th, 2011 at 02:01 PM. Reason: typo
Reply With Quote
The following user says Thank You to traderwerks for this post:
 
  #9 (permalink)
Market Wizard
Houston, TX
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Optimus Futures
Favorite Futures: 6E
 
TheWizard's Avatar
 
Posts: 1,711 since Jun 2009
Thanks: 509 given, 4,072 received

Need help with an automated strategy

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!
Reply With Quote
 
  #10 (permalink)
Market Wizard
virginia
 
Futures Experience: Intermediate
Platform: ninja
Favorite Futures: ES
 
cory's Avatar
 
Posts: 5,218 since Jun 2009
Thanks: 628 given, 6,315 received
Forum Reputation: Legendary



TheWizard View Post
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!

common sense says you can only enter after signal bar.

Reply With Quote

Reply



futures io > > > > > Tricky NinjaScript coding {questions} . . .

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Some Basic NinjaTrader Coding Questions -- IDataSeries Crow NinjaTrader Programming 7 October 15th, 2017 04:49 AM
NinjaScript Coding crazyhorse2393 NinjaTrader Programming 19 August 3rd, 2014 09:11 PM
Webinar: Basic NinjaScript coding, May 25th @ 4:30PM Eastern, 22:30 Berlin/Paris sam028 The Elite Circle 33 August 11th, 2011 11:37 AM
Learning NinjaScript - Various questions Jura The Elite Circle 3 March 2nd, 2011 11:25 AM
Ninjascript How TO spinnybobo NinjaTrader Programming 2 October 29th, 2009 11:34 AM


All times are GMT -4. The time now is 08:59 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-13 in 0.14 seconds with 20 queries on phoenix via your IP 54.160.245.121