NexusFi: Find Your Edge


Home Menu

 





Am I the only one who noticed this bug on NT 7.0.1?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one mborin with 5 posts (4 thanks)
    2. looks_two mattz with 4 posts (0 thanks)
    3. looks_3 traderwerks with 1 posts (0 thanks)
    4. looks_4 Fat Tails with 1 posts (4 thanks)
    1. trending_up 4,322 views
    2. thumb_up 8 thanks given
    3. group 3 followers
    1. forum 11 posts
    2. attach_file 0 attachments




 
Search this Thread

Am I the only one who noticed this bug on NT 7.0.1?

  #1 (permalink)
 mborin 
san antonio tx/usa
 
Experience: Advanced
Platform: NinjaTrader
Trading: Stocks
Posts: 13 since Jun 2012
Thanks Given: 2
Thanks Received: 5

I think there's a bug in the way NT determines average price when using LIFO method. If I hold multiple positions and the last one becomes profitable I sell it and my average price improves. But the logic does not take in to consideration that the position I just exited for a profit is no longer a part of my multiple positions.

So when I bought this position to scale in to my trade my average price improved but when I closed this position for a small profit my overall average price of my open positions improved even further according to NT. This is incorrect because that closed position is not part of my overall position anymore. So the average price should have been decreased to what it was before I scaled in to my overall position and then the small profit of that position should be factored into the overall average price to figure out what the new average price is now.

Is this confusing yet?

So if I am holding several positions and exit my last entree at a profit then Average Position Price (APP) needs to go back to what it was before that position was added to all my other open positions. After that the profit that was made from that exit needs to be added to the remaining open positions to calculate the APP.

Does anyone notice this?

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Diary of a simple price action trader
26 thanks
Just another trading journal: PA, Wyckoff & Trends
21 thanks
My NQ Trading Journal
19 thanks
Tao te Trade: way of the WLD
16 thanks
HumbleTraders next chapter
9 thanks
  #3 (permalink)
 
mattz's Avatar
 mattz   is a Vendor
 
Posts: 2,493 since Sep 2010
Thanks Given: 2,441
Thanks Received: 3,791



mborin View Post
I think there's a bug in the way NT determines average price when using LIFO method. If I hold multiple positions and the last one becomes profitable I sell it and my average price improves. But the logic does not take in to consideration that the position I just exited for a profit is no longer a part of my multiple positions.

So when I bought this position to scale in to my trade my average price improved but when I closed this position for a small profit my overall average price of my open positions improved even further according to NT. This is incorrect because that closed position is not part of my overall position anymore. So the average price should have been decreased to what it was before I scaled in to my overall position and then the small profit of that position should be factored into the overall average price to figure out what the new average price is now.

Is this confusing yet?

So if I am holding several positions and exit my last entree at a profit then Average Position Price (APP) needs to go back to what it was before that position was added to all my other open positions. After that the profit that was made from that exit needs to be added to the remaining open positions to calculate the APP.

Does anyone notice this?

2 questions:
1) Do you add money to wining or losing positions?
2) When you say "my average trade improves", you mean it is it goes up or down?

Trading futures and options involves substantial risk of loss and is not suitable for all investors. Past performance is not necessarily indicative of future results. You may lose more than your initial investment. All posts are opinions and do not claim to be facts. Please conduct your own due diligence. Use only Risk capital when trading Futures.
1 800 771 6748 local 561 367 8686 email [email protected]
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 mborin 
san antonio tx/usa
 
Experience: Advanced
Platform: NinjaTrader
Trading: Stocks
Posts: 13 since Jun 2012
Thanks Given: 2
Thanks Received: 5


mattz View Post
2 questions:
1) Do you add money to wining or losing positions?
2) When you say "my average trade improves", you mean it is it goes up or down?

Please note that I am not outlining a particular strategy. I simply want to bring attention to how Avg. Price is calculated when using LIFO method for position entrees. NT algorithm is incorrect in this situation.

But to answer your question:
1. Positions are added when a buy signal is reached.
2. I meant that the Unrealized PnL is being averaged in incorrectly.

Started this thread Reply With Quote
Thanked by:
  #5 (permalink)
 
mattz's Avatar
 mattz   is a Vendor
 
Posts: 2,493 since Sep 2010
Thanks Given: 2,441
Thanks Received: 3,791


mborin View Post
Please note that I am not outlining a particular strategy. I simply want to bring attention to how Avg. Price is calculated when using LIFO method for position entrees. NT algorithm is incorrect in this situation.

But to answer your question:
1. Positions are added when a buy signal is reached.
2. I meant that the Unrealized PnL is being averaged in incorrectly.

I played around with some LIFO with either add $ to losing and wining positions, various exits, etc
So I have an idea how it should be.
If you give us a few examples how it is calculated and how you think it should would be helpful to assess if the calculations are wrong. Without that we can know whether it is right or wrong.

Trading futures and options involves substantial risk of loss and is not suitable for all investors. Past performance is not necessarily indicative of future results. You may lose more than your initial investment. All posts are opinions and do not claim to be facts. Please conduct your own due diligence. Use only Risk capital when trading Futures.
1 800 771 6748 local 561 367 8686 email [email protected]
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
 mborin 
san antonio tx/usa
 
Experience: Advanced
Platform: NinjaTrader
Trading: Stocks
Posts: 13 since Jun 2012
Thanks Given: 2
Thanks Received: 5


mattz View Post
I played around with some LIFO with either add $ to losing and wining positions, various exits, etc
So I have an idea how it should be.
If you give us a few examples how it is calculated and how you think it should would be helpful to assess if the calculations are wrong. Without that we can know whether it is right or wrong.

Say I'm going Long. If I am holding 10 positions and then I exit my last entree at a profit the Unrealized PnL needs to decrease back to what it was when I had 9 positions. Then the profit that was made from that last exit needs to be added to the remaining open positions to calculate the new Unrealized PnL. Currently NT does not do this.

Started this thread Reply With Quote
Thanked by:
  #7 (permalink)
 
mattz's Avatar
 mattz   is a Vendor
 
Posts: 2,493 since Sep 2010
Thanks Given: 2,441
Thanks Received: 3,791


mborin View Post
Say I'm going Long. If I am holding 10 positions and then I exit my last entree at a profit the Unrealized PnL needs to decrease back to what it was when I had 9 positions. Then the profit that was made from that last exit needs to be added to the remaining open positions to calculate the new Unrealized PnL. Currently NT does not do this.

I understand. If you are convinced it is wrong, ok.
But if you show your specific entries and point out the specific averages it shows, we all could be more helpful.
G'nite.

Trading futures and options involves substantial risk of loss and is not suitable for all investors. Past performance is not necessarily indicative of future results. You may lose more than your initial investment. All posts are opinions and do not claim to be facts. Please conduct your own due diligence. Use only Risk capital when trading Futures.
1 800 771 6748 local 561 367 8686 email [email protected]
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #8 (permalink)
 traderwerks   is a Vendor
 
Posts: 692 since Jun 2009
Thanks Given: 436
Thanks Received: 465


mborin View Post
Then the profit that was made from that last exit needs to be added to the remaining open positions to calculate the new Unrealized PnL. Currently NT does not do this.

The profit that was made would be realized profit and would no longer be included in Unrealized PnL, so according to your description, NT is correct.

Math. A gateway drug to reality.
Reply With Quote
  #9 (permalink)
 mborin 
san antonio tx/usa
 
Experience: Advanced
Platform: NinjaTrader
Trading: Stocks
Posts: 13 since Jun 2012
Thanks Given: 2
Thanks Received: 5


traderwerks View Post
The profit that was made would be realized profit and would no longer be included in Unrealized PnL, so according to your description, NT is correct.

This bug can easily be duplicated by using chart trader on replay mode. Just pick a time frame that you are familiar with and make a few entrees then exit the last one with a limit order. You will see that the Avg. Position price stays the same.

Started this thread Reply With Quote
Thanked by:
  #10 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


If you enter several positions and close some of them, there are basically three ways to account for PNL

- FIFO
- average price
- LIFO

NinjaTrader simply does not offer LIFO. You can only select between average price (default) and FIFO (can be activated under Options -> General).

There have been multiple requests by NinjaTrader users for this feature, also see the following links:

'Use [AUTOLINK]FIFO[/AUTOLINK] for position avg. price calculations' setting is not working - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum
LIFO for Matching Entries & Exits - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum
Last in First out [AUTOLINK]contract[/AUTOLINK] PnL - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum

In some case - this depends on the broker API - NinjaTrader will show PNL as calculated by your broker.

Reply With Quote
Thanked by:




Last Updated on December 1, 2013


© 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