Strategy code assist needed for handling positions - NinjaTrader Programming | futures io social day trading
futures io futures trading


Strategy code assist needed for handling positions
Updated: Views / Replies:1,338 / 10
Created: by sburtt Attachments:1

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
 1  
 
Thread Tools Search this Thread
 

Strategy code assist needed for handling positions

  #1 (permalink)
Elite Member
London, UK
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
Posts: 58 since Jul 2012
Thanks: 3 given, 4 received

Strategy code assist needed for handling positions

Hi Guys,

I am new to NT, I am sure this is likely easy ... just cant yet get my head around it.

If my market position is long and my strategy generates a short signal, how can tell NT to go short twice the default size, and even more important how can I explain NT that at this point my net short position is 1 time the default size, hence stop loss should apply to that size and not the 2 * default size?

Please let me know if my query is clear, thanks for your help

John

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)
Elite Member
Lubbock TX
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Stage 5 Trading
Favorite Futures: CL
 
MWinfrey's Avatar
 
Posts: 1,879 since Jul 2009
Thanks: 1,449 given, 3,306 received



sburtt View Post
Hi Guys,

I am new to NT, I am sure this is likely easy ... just cant yet get my head around it.

If my market position is long and my strategy generates a short signal, how can tell NT to go short twice the default size, and even more important how can I explain NT that at this point my net short position is 1 time the default size, hence stop loss should apply to that size and not the 2 * default size?

Please let me know if my query is clear, thanks for your help

John

If I understand your situation correctly that's just a stop and reverse. You don't have to keep track of the number of contracts.

go to this link and look at the sample code in the attachment Strategy: Trading crossovers - NinjaTrader Support Forum

That should get you started.

Reply With Quote
 
  #4 (permalink)
Elite Member
London, UK
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
Posts: 58 since Jul 2012
Thanks: 3 given, 4 received


MWinfrey View Post
If I understand your situation correctly that's just a stop and reverse. You don't have to keep track of the number of contracts.

go to this link and look at the sample code in the attachment Strategy: Trading crossovers - NinjaTrader Support Forum

That should get you started.

not really. What I mean is assume I am long 50k EURUSD, when I get a short signal what NT does is cover 50k EURUSD long and short 50k EURUSD, basically it sells 100k EURUSD, but instead of doing this with 1 trade it does 2 trades, hence I pay twice commissions.

IF I set my short order to:

EnterShort(DefaultQuantity*2,"");

I avoid this problem, HOWEVER, at this point it doesn't accept/identify the correct quantity to buy on my StopLoss, what NT does is set the StopLoss quantity to 100k, rather than my current position of 50k.

My question is what should I use in the Quatity field of my order:

ExitShort();

?

Thanks,

Reply With Quote
 
  #5 (permalink)
Elite Member
Bala, PA, USA
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Mirus, IB
Favorite Futures: SPY, Oil, Euro
 
monpere's Avatar
 
Posts: 1,858 since Jul 2010
Thanks: 300 given, 3,276 received


sburtt View Post
not really. What I mean is assume I am long 50k EURUSD, when I get a short signal what NT does is cover 50k EURUSD long and short 50k EURUSD, basically it sells 100k EURUSD, but instead of doing this with 1 trade it does 2 trades, hence I pay twice commissions.

IF I set my short order to:

EnterShort(DefaultQuantity*2,"");

I avoid this problem, HOWEVER, at this point it doesn't accept/identify the correct quantity to buy on my StopLoss, what NT does is set the StopLoss quantity to 100k, rather than my current position of 50k.

My question is what should I use in the Quatity field of my order:

ExitShort();

?

Thanks,

Use 'Unmanaged' orders. But, that does require some additional (advanced) coding.

Reply With Quote
 
  #6 (permalink)
Elite Member
London, UK
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
Posts: 58 since Jul 2012
Thanks: 3 given, 4 received

Here is attached an example of what I mean
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
 
  #7 (permalink)
Elite Member
London, UK
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
Posts: 58 since Jul 2012
Thanks: 3 given, 4 received

are you sure there is no way to sort this issue out under the managed order protocol?

Reply With Quote
 
  #8 (permalink)
Trading Apprentice
Toledo, OH
 
Futures Experience: Advanced
Platform: NinjaTrader, proprietary API for TWS
Favorite Futures: NQ, YM, ES, FOREX
 
Posts: 41 since Nov 2012
Thanks: 16 given, 44 received

Unmanaged orders

Hi,
You have to go the route of unmanaged orders to circumvent the Ninja failsafe of having two trades in two directions simultaneously. One question I always ask, is saving on the commission that important that you want to open yourself to the world of unmanaged orders?
Again, it can be done but not recommended. Time better spent on extending profitability of current methods than squeezing money out of the commissions bucket, IMHO.

Reply With Quote
 
  #9 (permalink)
Elite Member
Israel
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: pfg
Favorite Futures: eminis
 
Posts: 323 since Jun 2009
Thanks: 6 given, 206 received


Quoting 
What I mean is assume I am long 50k EURUSD, when I get a short signal what NT does is cover 50k EURUSD long and short 50k EURUSD, basically it sells 100k EURUSD, but instead of doing this with 1 trade it does 2 trades, hence I pay twice commissions.

You pay commition for 100K! It doesn't metter if you make 1,2 or 100 trades.

Reply With Quote
 
  #10 (permalink)
Elite Member
London, UK
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
Posts: 58 since Jul 2012
Thanks: 3 given, 4 received



baruchs View Post
You pay commition for 100K! It doesn't metter if you make 1,2 or 100 trades.

Not true if you have a fixed commission up to 100k

Reply With Quote

Reply



futures io > > > > > Strategy code assist needed for handling positions

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
Code example needed mborin NinjaTrader Programming 1 November 11th, 2012 10:27 PM
Ninjatrader simple code to exit all L and S positions at a particular time. birdoggg NinjaTrader 2 October 16th, 2012 02:06 AM
Multicharts/TWS duplicating stops & strategy/broker positions getting out of sync. Splint MultiCharts 1 July 24th, 2012 09:18 AM
Multicharts code of scale in several positions Masse EasyLanguage Programming 2 August 25th, 2011 10:30 AM
Just a little code assist needed for entry filter Trader.Jon NinjaTrader Programming 2 October 27th, 2010 02:25 PM


All times are GMT -4. The time now is 09:21 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-17 in 0.12 seconds with 20 queries on phoenix via your IP 54.226.34.209