Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Expectancy custom fitness
Updated September 30, 2010
Top Posters
looks_one
Big Mike
with 7 posts (0 thanks)
looks_two
sam028
with 4 posts (4 thanks)
looks_3
Quick Summary
with 1 posts (0 thanks)
looks_4
aslan
with 1 posts (0 thanks)
trending_up
8,763 views
thumb_up
6 thanks given
group
4 followers
forum
13 posts
attach_file
1 attachments
Expectancy custom fitness
March 29th, 2010, 01:58 PM
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
A custom criteria for MC optimization, the expectancy :
Code
if ( StrategyPerformance . TotalTrades . Count == 0 || StrategyPerformance . LosingTrades . Count == 0 ) {
return 0 ;
}
return ( StrategyPerformance . PercentProfitable * StrategyPerformance . AvgWinningTrade - StrategyPerformance . WinningTrades * StrategyPerformance . AvgLosingTrade );
It might be good to be able to optimize a strategy parameters with a Sharpe ratio, as this ratio is already known by MC, but I haven't already found if it's possible or not...
Success requires no deodorant! (Sun Tzu)
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
March 29th, 2010, 02:22 PM
Madison, WI
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127
I have not done any custom criteria, would you mind explaining how to use that in MC?
March 29th, 2010, 03:50 PM
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
Check screenshot below.
There is 18 standard criterias (Net profit, %Profitable, ...), but you can also define yours.
Success requires no deodorant! (Sun Tzu)
March 29th, 2010, 05:53 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,489 since Jun 2009
Thanks Given: 33,256
Thanks Received: 101,698
Awesome, thx Sam - I needed this
Mike
March 29th, 2010, 07:04 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,489 since Jun 2009
Thanks Given: 33,256
Thanks Received: 101,698
Hmm, Sam I had problems with your code.
I define expectancy like this:
((avgWinningDollar * pctWinners) - (avgLosingDollar * pctLosers)) / avgLosingDollar
[img]https://nexusfi.com/v/cuhyfh.png[/img]
A real world example:
avgWinningDollar = 405.88
pctWinners = 43.59%
avgLosingDollar = 209.39
pctLosers = 56.41%
The result should be:
(405.88 * 0.4359) - (209.39 * 0.5641) / 209.39
Which gives us:
0.28, a very low and poor expectancy (1.0 or above is desired).
Since my code is dramatically different than yours, I'm including it here. Thanks for forcing me to take the time to do it - needed to be done!
Code
// Expectancy if ( StrategyPerformance . TotalTrades . Count == 0 || StrategyPerformance . LosingTrades . Count == 0 ) { return 0 ; } // (avgWinDollar * pctWin + avgLoseDollar * pctLose) / Abs(avgLoseDollar) return (( StrategyPerformance . AvgWinningTrade * ( StrategyPerformance . PercentProfitable / 100 )) + ( StrategyPerformance . AvgLosingTrade * ( 1 - ( StrategyPerformance . PercentProfitable / 100 )))) / - StrategyPerformance . AvgLosingTrade ;;
Mike
March 29th, 2010, 07:25 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,489 since Jun 2009
Thanks Given: 33,256
Thanks Received: 101,698
Hmm, here is another update. Seems I needed to check for some more division by zero.
Code
// Expectancy if ( StrategyPerformance . TotalTrades . Count == 0 || StrategyPerformance . LosingTrades . Count == 0 || StrategyPerformance . PercentProfitable == 0 || StrategyPerformance . PercentProfitable == 100 || StrategyPerformance . AvgWinningTrade == 0 || StrategyPerformance . AvgLosingTrade == 0 ) { return 0 ; } // ((avgWinDollar * pctWin) + (avgLoseDollar * pctLose) / Abs(avgLoseDollar) return (( StrategyPerformance . AvgWinningTrade * ( StrategyPerformance . PercentProfitable / 100 )) + ( StrategyPerformance . AvgLosingTrade * ( 1 - ( StrategyPerformance . PercentProfitable / 100 )))) / - StrategyPerformance . AvgLosingTrade ;
Mike
March 29th, 2010, 07:27 PM
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
Hmm, for me it's:
Expectancy = (Probability of Win * Average Win) - (Probability of Loss * Average Loss)
, and the higher the better.
But I'll check this, I'm maybe wrong.
There is a post on this here .
Success requires no deodorant! (Sun Tzu)
March 29th, 2010, 07:32 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,489 since Jun 2009
Thanks Given: 33,256
Thanks Received: 101,698
sam028
Hmm, for me it's:
Expectancy = (Probability of Win * Average Win) - (Probability of Loss * Average Loss)
, and the higher the better.
But I'll check this, I'm maybe wrong.
There is a post on this
here .
Hi Sam,
That post says:
Quoting
Expectancy is your profit percentage per win multiplied by your
win rate minus your loss percentage per loss multiplied by your loss rate.
Hmm. I got mine from Elliott Wave's version in NinjaTrader .
We do agree, higher the better. An expectancy of less than 1.0 means you can expect it to lose money
I wonder how it will compare to each other in actual optimization testing?
Mike
March 29th, 2010, 07:34 PM
Manta, Ecuador
Site Administrator Developer Swing Trader
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,489 since Jun 2009
Thanks Given: 33,256
Thanks Received: 101,698
Last Updated on September 29, 2010