Calculating 'Perfect Profit' - NinjaTrader Programming | futures io social day trading
futures io futures trading


Calculating 'Perfect Profit'
Updated: Views / Replies:4,828 / 6
Created: by Jura Attachments:0

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

Calculating 'Perfect Profit'

  #1 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received

Calculating 'Perfect Profit'

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
 
  #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
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,597 received
Forum Reputation: Legendary


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
 
  #4 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,214 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

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #5 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 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
 
  #6 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,214 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

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #7 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 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

Reply



futures io > > > > > Calculating 'Perfect Profit'

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
If you built the perfect system, would you share it or horde it? bluemele Psychology and Money Management 53 July 27th, 2014 05:24 PM
Roubini Says ‘Perfect Storm’ May Threaten Global Economy kbit News and Current Events 1 June 13th, 2011 02:45 PM
Code snippet for calculating slope Saroj NinjaTrader Programming 2 April 6th, 2011 10:44 AM
What is the perfect set up? h4cked Reviews of Brokers and Data Feeds 8 December 11th, 2010 03:54 PM
Calculating the slope of _ADXVMA_Alertsv01_5_1 nanobiotech NinjaTrader Programming 3 April 6th, 2010 01:35 PM


All times are GMT -4. The time now is 06:02 AM.

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-11 in 0.13 seconds with 19 queries on phoenix via your IP 54.82.79.109