Calculating 'Perfect Profit' - futures io
futures io futures trading



Calculating 'Perfect Profit'


Discussion in NinjaTrader

Updated by Jura
      Top Posters
    1. looks_one Jura with 3 posts (0 thanks)
    2. looks_two Big Mike with 2 posts (1 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Fat Tails with 1 posts (0 thanks)
    1. trending_up 6,307 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 6 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,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
 

Calculating 'Perfect Profit'

(login for full post details)
  #1 (permalink)
The Netherlands
 
Experience: None
Platform: MultiCharts, TradingView
Trading: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 685 received

Hi there,

Recently I came across the term 'perfect profit' in Robert Pardo's book The Evaluation and Optimization of Trading Strategies. (Great book btw ). In it, he states:

Quoting 
Perfect profit is a theoretical measure of market potential. It is the total profit produced by buying at every valley and selling at every top that occurs during a historical period of market history. This is obviously impossible in practice, therefore the name perfect profit. Because of the method of calculation, perfect profit will constantly grow from the beginning of the historical test period to its end. (p. 204)

This sounds to me like a good way to provide a benchmark to which a trading strategy can be compared. However, the author doesn't provide the code for such a calculation.

I tried to create a NinjaTrader indicator with this, but I had great problems with 'every valley and every top'. I've used the Swing indicator, Zigzag, and the standard functions as MAX and Highs.

Could someone suggest me a way to create such an indicator? I think it will be quite valuable to give another perspective on the results of a backtest.

I think a strategy with 'perfect profit' isn't possible because the entry and exit prices can't be edited in NinjaTrader. (i.e. you can't sell with hindsight after the top, which offcourse is a nice 'protection' to coding errors).

In the same book the author discusses the use of the 'perfect profit' in correlation with the result of a backtest to get an idea how good the strategy is. Do you guys think such a think can be custom added to NinjaTrader? (such as the Optimizer on this forum)

In my research to create such a indicator I found the following (C++) code in Modeling Maximum Trading Profits with C++ from Valerie Salov:
 
Code
#include "Prices.h"
using namespace PPBOOK;
namespace PPBOOK {
inline double
pardo_potential_profit (const Prices& prices)
{
 double ppp = 0.0
 for(size_t j = 1 ; j < prices.size(); j++)
  ppp += fabs(prices[j] - prices[j-1]);
 return ppp * prices.tickValue() / prices.tick();
}
} // PPBOOK
Perhaps this gives some better insight in how such an 'perfect profit' can be calculated.

On internet I found an old newletter ("Better optimization in TradeStation, part 2: Breakout Bulletin - June 2005 ) which creates a sort of perfect profit indicator (see the code in that article).


Any thoughts are very highly appreciated,

Regards,

Reply With Quote

Can you help answer these questions
from other members on futures io?
help to convert from thinkscript to ninjascript
NinjaTrader
EQIX - Digital REITs - any experiences?
Stocks and ETFs
Price Down, Volume Up, Open Interest Down
Traders Hideout
Times and Sales more data to be displayed
TradeStation
Looking freelancer for MT4 Indicator
Platforms and Indicators
 
 
(login for full post details)
  #3 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,839 since Mar 2010
Thanks: 4,238 given, 26,582 received


I have not read the book, so I only can suggest how to proceed:

The perfect profit would assume a minimum target (to overcome transaction costs), which I would translate into a minimum deviation for the zigzag indicator. First step would be to apply that indicator to a chart. The system would then sell every top (deducting spread and slippage) and buy every bottom (adding spread and slippage).

The problem is, that this can only be done with hindsight, so I would not know how to define a strategy, as the information required to sell the top or buy the bottom will only be available later.

What you could do is just store the swing highs and lows in a dataseries and calculate the potential profits and display them abóve or below each swing (it is basically the vertical dimension of the swing). THan add those profits up and display them somewhere.

You could also try to export the hypothetical profits to an excel file.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Site Administrator
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,037 since Jun 2009
Thanks: 31,652 given, 94,891 received

I wrote an indicator that showed the MFE and MAE of each trade using another indicator as a base line. It was last year, but the basic principle was take something like SuperTrend and look for the above/below crossovers. Start counting the MAE and MFE from bar 1, and each new bar adjust it accordingly. When a new crossover occurs, draw a trendline from bar 1 to the last bar, and then drawtext to show the MAE and MFE.

The MAE and the MFE would be calculated by just recording the entry price from bar 1 and then look at the low of each bar (for MAE, on longs) and the high of each bar (for MFE, for longs). If the low or high (in ticks, away from entry price) for the new bar is higher than the previously stored value, store the new value.

It's not perfect but it was simple, a dozen or two lines of code, and it helped with a spreadsheet that I was doing at the time which was for me to record the MAE and MFE for each move based on a mechanical entry set of conditions, then I would compare what I actually got on the trade to the theoretical best.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my Facebook Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #5 (permalink)
The Netherlands
 
Experience: None
Platform: MultiCharts, TradingView
Trading: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 685 received


Fat Tails View Post
I have not read the book, so I only can suggest how to proceed:

The perfect profit would assume a minimum target (to overcome transaction costs), which I would translate into a minimum deviation for the zigzag indicator. First step would be to apply that indicator to a chart. The system would then sell every top (deducting spread and slippage) and buy every bottom (adding spread and slippage).

The problem is, that this can only be done with hindsight, so I would not know how to define a strategy, as the information required to sell the top or buy the bottom will only be available later.

What you could do is just store the swing highs and lows in a dataseries and calculate the potential profits and display them abóve or below each swing (it is basically the vertical dimension of the swing). THan add those profits up and display them somewhere.

You could also try to export the hypothetical profits to an excel file.

Thanks for your reply Fat Tails. I'll look into the ZigZag indicator again, it looks to be the best indicator for such an idea.
Your DataSeries idea is an interesting one, thanks! (sound also complex ). Will look into it when the idea that I'm now using (with MAX and MIN values over an period) doesn't work out.


Big Mike View Post
I wrote an indicator that showed the MFE and MAE of each trade using another indicator as a base line. It was last year, but the basic principle was take something like SuperTrend and look for the above/below crossovers. Start counting the MAE and MFE from bar 1, and each new bar adjust it accordingly. When a new crossover occurs, draw a trendline from bar 1 to the last bar, and then drawtext to show the MAE and MFE.

The MAE and the MFE would be calculated by just recording the entry price from bar 1 and then look at the low of each bar (for MAE, on longs) and the high of each bar (for MFE, for longs). If the low or high (in ticks, away from entry price) for the new bar is higher than the previously stored value, store the new value.

It's not perfect but it was simple, a dozen or two lines of code, and it helped with a spreadsheet that I was doing at the time which was for me to record the MAE and MFE for each move based on a mechanical entry set of conditions, then I would compare what I actually got on the trade to the theoretical best.

Mike

Great idea Mike, perhaps that can be quite a good substitute for 'perfect profit'. Such an indicator can even be used in realtime to watch the performance of a strategy (how great would that be!). However, my programming skills are not even close to your skills. Can you give some suggestions or tips?

Thanks for your posts Fat Tails and Mike, it gave me some fresh insight into this problem.

Regards,

Reply With Quote
 
(login for full post details)
  #6 (permalink)
Site Administrator
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,037 since Jun 2009
Thanks: 31,652 given, 94,891 received

Sorry, but I am no longer doing any NT programming. I'm sure you can hire it done or if you make a case you might get another person to do it free, specifically posting in the want your indicator created for free thread.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my Facebook Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #7 (permalink)
The Netherlands
 
Experience: None
Platform: MultiCharts, TradingView
Trading: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 685 received


Big Mike View Post
Sorry, but I am no longer doing any NT programming. I'm sure you can hire it done or if you make a case you might get another person to do it free, specifically posting in the want your indicator created for free thread.

Mike

That's okay Mike, thanks nonetheless.

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Calculating 'Perfect Profit'


July 15, 2010


Upcoming Webinars and Events
 

Getting Comfortable with Price Action Patterns w/Earn2Trade

Aug 4
 

Live Video Panel: Ask Me Anything w/Ironbeam Brokerage

Aug 6
     



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