Strategy code assist needed for handling positions - futures io
futures io futures trading



Strategy code assist needed for handling positions


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one sburtt with 6 posts (0 thanks)
    2. looks_two baruchs with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 MWinfrey with 1 posts (0 thanks)
    1. trending_up 1,936 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 10 posts
    2. attach_file 1 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

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

 
Search this Thread
 

Strategy code assist needed for handling positions

(login for full post details)
  #1 (permalink)
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: EUR/USD
 
Posts: 58 since Jul 2012
Thanks: 3 given, 4 received

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

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Work with historical tcks data on MUltichart NET PowerLa …
MultiCharts
COTbase for quant trading?
Elite Algorithmic NinjaTrader Trading
Neurological explanations for trading Success
Psychology and Money Management
NT8 indicator to simulate a Funding Evaluation where to …
NinjaTrader
What blockvolume is visible? - order processing
NinjaTrader
 
 
(login for full post details)
  #3 (permalink)
Lubbock TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Stage 5 Trading
Trading: CL
 
MWinfrey's Avatar
 
Posts: 1,880 since Jul 2009
Thanks: 1,450 given, 3,325 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
 
(login for full post details)
  #4 (permalink)
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: 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,

Started this thread Reply With Quote
 
(login for full post details)
  #5 (permalink)
Bala, PA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus, IB
Trading: SPY, Oil, Euro
 
monpere's Avatar
 
Posts: 1,858 since Jul 2010
Thanks: 300 given, 3,338 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
 
(login for full post details)
  #6 (permalink)
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: EUR/USD
 
Posts: 58 since Jul 2012
Thanks: 3 given, 4 received

Here is attached an example of what I mean

Started this thread Reply With Quote
 
(login for full post details)
  #7 (permalink)
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: 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?

Started this thread Reply With Quote
 
(login for full post details)
  #8 (permalink)
Toledo, OH
 
 
Posts: 41 since Nov 2012
Thanks: 16 given, 46 received

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
 
(login for full post details)
  #9 (permalink)
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
 
Posts: 323 since Jun 2009
Thanks: 6 given, 207 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
 
(login for full post details)
  #10 (permalink)
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: 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

Started this thread Reply With Quote
 
(login for full post details)
  #11 (permalink)
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: EUR/USD
 
Posts: 58 since Jul 2012
Thanks: 3 given, 4 received


FalseProphets View Post
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.

Not totally true, considering i am talking about a 5 min strategy with approx 6 entries per day

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Strategy code assist needed for handling positions


Last Updated on November 13, 2012


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 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