NexusFi: Find Your Edge


Home Menu

 





Need help with this situation


Discussion in NinjaTrader

Updated
    1. trending_up 1,465 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 4 posts
    2. attach_file 1 attachments




 
Search this Thread

Need help with this situation

  #1 (permalink)
 
richw's Avatar
 richw 
Salt Lake City, UT
 
Experience: Advanced
Platform: NinjaTrader
Broker: NinjaTrader Brokerage
Trading: CL, ES, NQ, YM
Posts: 1,809 since May 2010
Thanks Given: 2,246
Thanks Received: 1,541

I have order 1 (entryOrderLong1) and order 2 (entryOrderLong2) in one strategy. Each one seems to need its own profit target and stop. Unless I am doing something wrong, this seems to result in Position.AvgPrice just returning the average price for entryOrderLong1 and a different average price for entryOrderLong2. So when I try to set the profit targets, I can set them each correctly based on its own price average, but it is not correct for the entire strategy.

Example, entryOrderLong1 is filled for 2 contracts at 90.85 and entryOrderLong2 gets filled for 4 contracts at 90.75. 90.85 is the Position.AvgPrice for entryOrderLong1 and 90.75 is the Position.AvgPrice for entryOrderLong2. The real average for the 6 contracts is 90.78. I want my profit target to be 10 ticks above 90.78 for all contracts. Now, if the strategy averages down again at 90.65 for 4 more contracts, the Position.AvgPrice for entryOrderLong3 is 90.65, but now my price average for all open contracts is 90.73. I would now want my profit target for all open contracts in the 3 orders to be 90.83 (10 ticks above 90.73).

How would I handle this? If there some kind of variable like Position.AvgPrice that applies to all open contracts, then it should be fairly simple.

Is there one Position.AvgPrice that applies to all open contracts in the strategy?

NinjaTrader is aware of this value which means it exists somewhere, but I can't locate it. See attached image.

Attached Thumbnails
Click image for larger version

Name:	entire-position-avg-price-ex1.png
Views:	127
Size:	35.2 KB
ID:	31733  
Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Request for MACD with option to use different MAs for fa …
NinjaTrader
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
58 thanks
Battlestations: Show us your trading desks!
50 thanks
NexusFi site changelog and issues/problem reporting
47 thanks
GFIs1 1 DAX trade per day journal
32 thanks
What percentage per day is possible? [Poll]
31 thanks

  #3 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709


Can you post your strategy code so we can examine and modify it?

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
richw's Avatar
 richw 
Salt Lake City, UT
 
Experience: Advanced
Platform: NinjaTrader
Broker: NinjaTrader Brokerage
Trading: CL, ES, NQ, YM
Posts: 1,809 since May 2010
Thanks Given: 2,246
Thanks Received: 1,541

Thanks for responding. I realized in doing some more investigation that it isn't the average price I am having trouble with and need solving. The real issue is how to modify the target orders later so that they continue to be 10 ticks away from the position average as more contracts are purchased and the position average changes. Since it is based on some code I found in the Elite section, I would have to post the code somewhere over there. Actually, the code is pretty much this:



I have just made very slight changes for entry signal and entry price, but those changes have not affected the structure of the code. So apparently, what I am ending up with currently is multiple profit target orders each placed x number of ticks from the Position.AvgPrice at the time the order was filled.

Can you provide an example of how to move my target orders to be x number of ticks away from Position.AvgPrice as it changes?

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
richw's Avatar
 richw 
Salt Lake City, UT
 
Experience: Advanced
Platform: NinjaTrader
Broker: NinjaTrader Brokerage
Trading: CL, ES, NQ, YM
Posts: 1,809 since May 2010
Thanks Given: 2,246
Thanks Received: 1,541

I removed the parts that would make it both a long and short strategy. I am just focused on making a strategy for a long position at this time.

Visit my NexusFi Trade Journal Started this thread Reply With Quote





Last Updated on February 24, 2011


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts