NinjaTrader 7 Miscellaneous - Expectancy Score Optimization Type
futures io

Categories Help    

NinjaTrader 7 Miscellaneous
Downloads in this section are for NinjaTrader 7 and include files that don't fit into any other category (ie: Market Replay Data, Custom Bar Types)

Expectancy Score Optimization Type 5 *
Here is my rendition of the Expectancy Score from Trade Your Way to Financial Freedom by Van K. Tharp. The basis of this optimization is found in this link:

which states in part:

Expectancy is how much you expect to earn from each trade for every dollar you risk. Opportunity is how often your strategy trades. You want to maximize the product of both.
Expectancy = (AW PW + AL PL) ⁄ |AL| (expected profit per dollar risked)
Expectancy score = Expectancy Opportunity
where AW = average winning trade (excluding maximum win) PW = probability of winning (PW = <wins> ⁄ NST

where <wins> is total wins excluding maximum win) AL = average losing trade (negative, excluding scratch losses) |AL| = absolute value of AL PL = probability of losing (PL = <non-scratch losses> ⁄ NST) Opportunity = NST 365 ⁄ studydays (opportunities to trade in a year) where
  • NST = <total trades> − <scratch trades> − 1
    In other words, NST = non-scratch trades during the period under test (a scratch trade loses commission+slippage or less) minus 1 (to exclude the maximum win).
  • studydays = calendar days of history being tested
This code atttempts to duplicate this algebraic information in NT7 eese.


Version 2 cleaned up a few coding errors.

I also added a new optimizer type which is just called expectancy. It does not include opportunity. Take a look. Join us on this link for a discussion on expectancy.


Category NinjaTrader 7 Miscellaneous 
Suggest other entries I might like
Details: Expectancy Score Optimization Type
Category: NinjaTrader 7 Miscellaneous 

April 29th, 2011
Size: 2.22 KB
Downloaded: 395 times


Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, 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.