![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#16 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
ch9090,
No problem. Are you attempting to only avoid a profit factor of 99? Do you want profit factors > 99? This is a massive profit factor, but I suppose it would be possible. Please let me know if I may assist further.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#17 |
|
Senior Member
Join Date: Aug 2011
Location: Belgium
Posts: 151
Thanks: 42
Thanked 3 times in 3 posts
|
I am really trying to avoid a PF of 99 which usually is associated with 1 or 2 trades only.
That is why a combination of PF < 99 and # of trades > 10 should produce more relevant optimized parameters for my simple strategy. chris |
|
|
|
|
|
#18 |
|
Senior Member
Join Date: Aug 2011
Location: Belgium
Posts: 151
Thanks: 42
Thanked 3 times in 3 posts
|
I've run some optimizations and it still returns a PF of 99 based on a few trades... Any additional ideas?
|
|
|
|
|
|
#19 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
ch9090,
Are you able to add the new optimization type in the Optimization properties > "Optimize on" field?
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#20 |
|
Senior Member
Join Date: Aug 2011
Location: Belgium
Posts: 151
Thanks: 42
Thanked 3 times in 3 posts
|
Hi Adam,
Absolutely and I've used your suggestion for the code i.e. if (systemPerformance.AllTrades.TradesPerformance.Pro fitFactor < 99 && systemPerformance.AllTrades.TradesCount < 10) return 0; else return (double) systemPerformance.AllTrades.TradesPerformance.Prof itFactor; |
|
|
|
|
|
#21 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
This might be the problem : systemPerformance.AllTrades.TradesPerformance.Pro fitFactor < 99
It can still return 99 since if ProfitFactor = 99, then this condition fails, and it can return the profit factor. I believe you want to use something like, if( ProfitFactor < 99 && NumberTrades>=10 ) { return ProfitFactor; } else { return 0; }
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#22 |
|
Senior Member
Join Date: Aug 2011
Location: Belgium
Posts: 151
Thanks: 42
Thanked 3 times in 3 posts
|
Hi Adam,
You were right, the logic was flawed! I hope I do understand the code correctly now: 1) the strategy PF factor will be optimized based on two conditions (PF<99 and # trades >=10). 2) the "else return 0" just means it will force the optimization? I am asking this because so far my tests are returning good results (# of trades >= 10 and PF < 99) but I am not sure how to interpret the "return 0" since we're using bolean operators here? Cheers, chris |
|
|
|
|
|
#23 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
CH9090
Essentially, there are still optimization runs that are returning profit factors greater than 99 but you are intercepting them and returning a profit factor of 0 instead of the real profit factor. You are only using the booleans as logical operators to do the interception, however you are still returning the actual calculated profit factor when its less than 99 and there were more than 10 trades.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_AdamP for this post: |
|
|
|
#24 |
|
Senior Member
Join Date: Aug 2011
Location: Belgium
Posts: 151
Thanks: 42
Thanked 3 times in 3 posts
|
Dear Adam,
Many thanks for the quick reply. I've been running a few dozens (if not hundreds) of optimization runs now and I never saw a PF > 99. If I am not mistaken it is defined as (gross profit/gross loss) and when "gross loss" is 0 it returns a PF of 99 (instead of infinite). In theory you could have a PF > 99, but again I never saw one. Have you? I optimize also on "aggregated results" and even if the optimization returns a few PF=99 for some individuals stocks, the PF of the "combined results" is always well below 99. I guess it means that your custom optimization works fine and I would even say that the results are more reliable compared to optimizing on the PF factor only. Cheers, Chris |
|
|
|
|
|
#25 | |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Quote:
What is probably happening is that NinjaTrader catches a profit factor of NaN, i.e. X / 0 and setting it to 99 or something since 99 is a ridiculously high profit factor. I've never seen any long term running strategy pull off that level let alone more. Anyway, I am glad its working out for you. Please let me know if I may assist further.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
The following user says thank you to NinjaTrader_AdamP for this post: |
|
|
|
#26 |
|
Senior Member
Join Date: Aug 2011
Location: Belgium
Posts: 151
Thanks: 42
Thanked 3 times in 3 posts
|
Thank you Adam, all clear now until my next post :-)
|
|
|
|
![]() |
| Tags |
| 1 trade only, high results, optimizer |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Fibbonacci Retracements on Bond Charts Display non-tick based results | ATX_tdr | Charting | 1 | 07-21-2011 01:43 AM |
| Looking for trade size based indicator | dbissett | Indicator Development | 1 | 07-18-2010 10:59 PM |
| Trade based on 2nd chart | shazzmoe | Automated Trading | 7 | 02-17-2010 11:57 AM |
| How to enter a trade based on time | KeelRisk | Strategy Development | 1 | 08-19-2009 06:12 AM |
| Stop Trading Based on Results | daven | Automated Trading | 1 | 06-24-2009 05:59 AM |