# Backtest : Risk Reward & Expectancy Calculation?

I’m manually backtesting a strategy based on moving average with max SL(25pts) and fixed Targets(30pts) and its profitable [Total 750 trades].

No.of Profit Trades = 45% , No.of Loss Trades = 55% with Risk/Reward [30/25pts] =1.2

But there are trades where the SL varies as 10,20pts but target is same 30pts and so for those trades R:R changes.

Now,Should I consider R/R as 1.2 while calculating Expectancy ? [Or] Average R/R of all my trades which is around 1.5 ? If I take 1.2 as R:R then my expectancy is negative but if its 1.5(R:R), expectancy is Positive.

Is 750 trades enough for backtesting in 5mins timeframe ?
Which is the ideal method to consider and calculate expectancy ? If I should take 1.2 then I wont implement this strategy.

You are checking Risk reward and calculating expectancy, according to me, accuracy is better choice, check your code for maximum profitable trades, and Risk can be managed with maintaining strict stop loss

ok I will do that, but what about no.of trades to be tested ? any ideas…

You can test based on historical data like 3 to 6 months

Friends,

I copy pasted EMA3-15 code back test result of JPAss-EQ

11/27/2017 9:15:59 AM to 1/25/2018 3:15:59 PM
Average number of trades per month: 17
Total profit: 12.1000
Total loss: -4.5500
Percent profit: 62.397%
Largest profit: 6.7000
Largest loss: -0.8000
Maximum Drawdown: 0.0000
Maximum Drawdown (Monte Carlo): 0.0000
Compound Monthly ROR: 3.8239
Standard deviation: 6.97585120
Annualized standard deviation: 9.86534338
Downside deviation (MAR = 10%): 0.00000000
Value Added Monthly Index (VAMI): 1.00004298
Sharpe ratio (RFR = 5%): 1.07513761
Annualized Sharpe ratio (RFR = 5%): 1.52047419
Sortino ratio (MAR = 5%): 0.00000000
Annualized Sortino ratio (MAR = 5%): 0.00000000
Sterling ratio (MAR = 5%): 0.00000000
Calmar ratio: 0.00000000

“Risk to reward ratio: -0.188

11/29/2017 11:30:59 AM,LONG,18.7500
11/29/2017 11:45:00 AM,EXIT LONG,18.6500 Loss -0.1
11/30/2017 2:15:00 PM,LONG,18.3000
11/30/2017 3:00:00 PM,EXIT LONG,18.0500 Loss -0.25
12/1/2017 9:15:59 AM,LONG,18.3500
12/1/2017 11:15:00 AM,EXIT LONG,18.2500 Loss -0.1
12/5/2017 2:00:00 PM,LONG,17.1000
12/6/2017 9:15:59 AM,EXIT LONG,16.9500 Loss -0.15
12/7/2017 9:30:00 AM,LONG,16.7500
12/7/2017 12:30:00 PM,EXIT LONG,16.7500 Profit = 0
12/7/2017 12:45:00 PM,LONG,16.8500
12/7/2017 12:59:59 PM,EXIT LONG,16.7500 Loss = -0.1
12/7/2017 1:15:00 PM,LONG,16.8000
12/7/2017 1:45:59 PM,EXIT LONG,16.7500 Loss =-0.05
12/7/2017 2:45:00 PM,LONG,16.9000
12/11/2017 9:30:00 AM,EXIT LONG,17.7500 Profit =0.85
12/11/2017 2:15:00 PM,LONG,17.7500
12/11/2017 3:00:00 PM,EXIT LONG,17.6000 Loss =-0.15
12/12/2017 10:45:59 AM,LONG,17.6500
12/12/2017 11:30:59 AM,EXIT LONG,17.6000 Loss =-0.05
12/12/2017 11:45:00 AM,LONG,17.6500
12/13/2017 9:59:59 AM,EXIT LONG,17.8000 Profit =0.15
12/13/2017 10:30:00 AM,LONG,18.0000
12/13/2017 1:45:59 PM,EXIT LONG,18.1000 Profit =0.1
12/13/2017 3:15:59 PM,LONG,18.2500
12/14/2017 9:30:00 AM,EXIT LONG,17.9500 Loss =-0.3
12/14/2017 2:00:00 PM,LONG,17.9000
12/14/2017 2:45:00 PM,EXIT LONG,17.7500 Loss= -0.15
12/15/2017 9:30:00 AM,LONG,17.9000
12/15/2017 9:45:00 AM,EXIT LONG,17.7500 Loss= -0.15
12/19/2017 3:00:00 PM,LONG,17.1000
12/20/2017 9:15:59 AM,EXIT LONG,16.8500 Loss = -0.25
12/20/2017 11:30:59 AM,LONG,17.0000
12/21/2017 3:15:59 PM,EXIT LONG,18.4500 Profit =1.45
12/22/2017 9:15:59 AM,LONG,18.6500
12/22/2017 11:30:59 AM,EXIT LONG,18.5000 Loss =-0.15
12/26/2017 9:15:59 AM,LONG,18.6500
1/1/2018 9:15:59 AM,EXIT LONG,25.3500 Profit =6.7
1/1/2018 12:00:00 PM,LONG,26.2000
1/1/2018 2:45:00 PM,EXIT LONG,25.4000 Loss =-0.8
1/2/2018 1:30:00 PM,LONG,24.5000
1/2/2018 1:45:59 PM,EXIT LONG,24.0500 Loss =-0.45
1/3/2018 9:15:59 AM,LONG,24.8000
1/3/2018 12:59:59 PM,EXIT LONG,24.6500 Loss =-0.15
1/4/2018 9:15:59 AM,LONG,24.7000
1/4/2018 12:45:00 PM,EXIT LONG,24.6500 Loss =-0.05
1/5/2018 9:15:59 AM,LONG,24.7000
1/5/2018 11:15:00 AM,EXIT LONG,24.3500 Loss =-0.35
1/5/2018 1:30:00 PM,LONG,25.5000
1/8/2018 2:45:00 PM,EXIT LONG,25.4000 Loss =-0.1
1/10/2018 9:45:00 AM,LONG,23.9500
1/10/2018 2:45:00 PM,EXIT LONG,24.1000 Profit =0.15
1/11/2018 12:30:00 PM,LONG,23.9500
1/11/2018 12:45:00 PM,EXIT LONG,23.8500 Loss =-0.1
1/12/2018 9:59:59 AM,LONG,23.8500
1/12/2018 10:30:00 AM,EXIT LONG,23.6500 Loss =-0.2
1/15/2018 9:59:59 AM,LONG,23.3500
1/15/2018 1:30:00 PM,EXIT LONG,23.2000 Loss =-0.15
1/17/2018 11:30:59 AM,LONG,21.6500
1/18/2018 12:30:00 PM,EXIT LONG,22.8500 Profit =1.2
1/19/2018 2:00:00 PM,LONG,21.1000
1/22/2018 12:45:00 PM,EXIT LONG,22.5500 Profit =1.45
1/23/2018 10:15:00 AM,LONG,22.2500
1/23/2018 12:45:00 PM,EXIT LONG,22.1000 Loss =-0.15
1/25/2018 9:15:59 AM,LONG,21.8500
1/25/2018 1:15:00 PM,EXIT LONG,21.7500 Loss =-0.1
1/25/2018 2:30:59 PM,LONG,22.0000 Profit =0

HENCE, TOTAL LOSS = Rs. -4.55

``````TOTAL PROFIT = Rs. 12.05

Net Profit= Rs.7.5

Profit Percentage = 62.397%
``````

FURTHER, I HAVE CALCULATED & PASTED PROFIT & LOSS OF EACH TRANSACTIONS ABOVE FOR YOUR REFERENCE.

In above case, Risk to Reward Ratio = 7.5 / (-4.55) = 1.648 OR 62.397% / (-4.55) = 0.137; Whereas back test gives -0.188

I am very confused in UNDERSTANDING RISK TO REWARD RATIO GIVEN IN PI BACK TEST REPORT, PL guide me how it is being calculated step by step in detail… I discussed with few traders, nobody has answer… And How Negative values arrives… My understanding if I keep 1 risk to 3 profit, i.e, 1:3 = 1/3= 0.333 OR 3 Profit to 1 Risk, i.e, 3:1 = 3/1 = 3 vice-versa.
Which is correct? how zerodha pi calculates?

Can anyone answer for below trailing query? Or PL illustrate how to calculate Reward to Risk Ratio step by step with few examples?

Which is exactly correct - Reward to Risk or Risk to reward, The ratio which is shown in Zerodha pi is REWARD /(i.e, divided by) RISK or RISK/ REWARD?

What indicates if the Ratio is less than 1 and if negative value?

Someone PL help me to get me out from this confusion ASAP?

2 YEARS LATER

ZF8925
11d
Friends,

I copy pasted EMA3-15 code back test result of JPAss-EQ

11/27/2017 9:15:59 AM to 1/25/2018 3:15:59 PM
Average number of trades per month: 17
Total profit: 12.1000
Total loss: -4.5500
Percent profit: 62.397%
Largest profit: 6.7000
Largest loss: -0.8000
Maximum Drawdown: 0.0000
Maximum Drawdown (Monte Carlo): 0.0000
Compound Monthly ROR: 3.8239
Standard deviation: 6.97585120
Annualized standard deviation: 9.86534338
Downside deviation (MAR = 10%): 0.00000000
Value Added Monthly Index (VAMI): 1.00004298
Sharpe ratio (RFR = 5%): 1.07513761
Annualized Sharpe ratio (RFR = 5%): 1.52047419
Sortino ratio (MAR = 5%): 0.00000000
Annualized Sortino ratio (MAR = 5%): 0.00000000
Sterling ratio (MAR = 5%): 0.00000000
Calmar ratio: 0.00000000

“Risk to reward ratio: -0.188

11/29/2017 11:30:59 AM,LONG,18.7500
11/29/2017 11:45:00 AM,EXIT LONG,18.6500 Loss -0.1
11/30/2017 2:15:00 PM,LONG,18.3000
11/30/2017 3:00:00 PM,EXIT LONG,18.0500 Loss -0.25
12/1/2017 9:15:59 AM,LONG,18.3500
12/1/2017 11:15:00 AM,EXIT LONG,18.2500 Loss -0.1
12/5/2017 2:00:00 PM,LONG,17.1000
12/6/2017 9:15:59 AM,EXIT LONG,16.9500 Loss -0.15
12/7/2017 9:30:00 AM,LONG,16.7500
12/7/2017 12:30:00 PM,EXIT LONG,16.7500 Profit = 0
12/7/2017 12:45:00 PM,LONG,16.8500
12/7/2017 12:59:59 PM,EXIT LONG,16.7500 Loss = -0.1
12/7/2017 1:15:00 PM,LONG,16.8000
12/7/2017 1:45:59 PM,EXIT LONG,16.7500 Loss =-0.05
12/7/2017 2:45:00 PM,LONG,16.9000
12/11/2017 9:30:00 AM,EXIT LONG,17.7500 Profit =0.85
12/11/2017 2:15:00 PM,LONG,17.7500
12/11/2017 3:00:00 PM,EXIT LONG,17.6000 Loss =-0.15
12/12/2017 10:45:59 AM,LONG,17.6500
12/12/2017 11:30:59 AM,EXIT LONG,17.6000 Loss =-0.05
12/12/2017 11:45:00 AM,LONG,17.6500
12/13/2017 9:59:59 AM,EXIT LONG,17.8000 Profit =0.15
12/13/2017 10:30:00 AM,LONG,18.0000
12/13/2017 1:45:59 PM,EXIT LONG,18.1000 Profit =0.1
12/13/2017 3:15:59 PM,LONG,18.2500
12/14/2017 9:30:00 AM,EXIT LONG,17.9500 Loss =-0.3
12/14/2017 2:00:00 PM,LONG,17.9000
12/14/2017 2:45:00 PM,EXIT LONG,17.7500 Loss= -0.15
12/15/2017 9:30:00 AM,LONG,17.9000
12/15/2017 9:45:00 AM,EXIT LONG,17.7500 Loss= -0.15
12/19/2017 3:00:00 PM,LONG,17.1000
12/20/2017 9:15:59 AM,EXIT LONG,16.8500 Loss = -0.25
12/20/2017 11:30:59 AM,LONG,17.0000
12/21/2017 3:15:59 PM,EXIT LONG,18.4500 Profit =1.45
12/22/2017 9:15:59 AM,LONG,18.6500
12/22/2017 11:30:59 AM,EXIT LONG,18.5000 Loss =-0.15
12/26/2017 9:15:59 AM,LONG,18.6500
1/1/2018 9:15:59 AM,EXIT LONG,25.3500 Profit =6.7
1/1/2018 12:00:00 PM,LONG,26.2000
1/1/2018 2:45:00 PM,EXIT LONG,25.4000 Loss =-0.8
1/2/2018 1:30:00 PM,LONG,24.5000
1/2/2018 1:45:59 PM,EXIT LONG,24.0500 Loss =-0.45
1/3/2018 9:15:59 AM,LONG,24.8000
1/3/2018 12:59:59 PM,EXIT LONG,24.6500 Loss =-0.15
1/4/2018 9:15:59 AM,LONG,24.7000
1/4/2018 12:45:00 PM,EXIT LONG,24.6500 Loss =-0.05
1/5/2018 9:15:59 AM,LONG,24.7000
1/5/2018 11:15:00 AM,EXIT LONG,24.3500 Loss =-0.35
1/5/2018 1:30:00 PM,LONG,25.5000
1/8/2018 2:45:00 PM,EXIT LONG,25.4000 Loss =-0.1
1/10/2018 9:45:00 AM,LONG,23.9500
1/10/2018 2:45:00 PM,EXIT LONG,24.1000 Profit =0.15
1/11/2018 12:30:00 PM,LONG,23.9500
1/11/2018 12:45:00 PM,EXIT LONG,23.8500 Loss =-0.1
1/12/2018 9:59:59 AM,LONG,23.8500
1/12/2018 10:30:00 AM,EXIT LONG,23.6500 Loss =-0.2
1/15/2018 9:59:59 AM,LONG,23.3500
1/15/2018 1:30:00 PM,EXIT LONG,23.2000 Loss =-0.15
1/17/2018 11:30:59 AM,LONG,21.6500
1/18/2018 12:30:00 PM,EXIT LONG,22.8500 Profit =1.2
1/19/2018 2:00:00 PM,LONG,21.1000
1/22/2018 12:45:00 PM,EXIT LONG,22.5500 Profit =1.45
1/23/2018 10:15:00 AM,LONG,22.2500
1/23/2018 12:45:00 PM,EXIT LONG,22.1000 Loss =-0.15
1/25/2018 9:15:59 AM,LONG,21.8500
1/25/2018 1:15:00 PM,EXIT LONG,21.7500 Loss =-0.1
1/25/2018 2:30:59 PM,LONG,22.0000 Profit =0

HENCE, TOTAL LOSS = Rs. -4.55

TOTAL PROFIT = Rs. 12.05

Net Profit= Rs.7.5

``````Profit Percentage = 62.397%
``````

FURTHER, I HAVE CALCULATED & PASTED PROFIT & LOSS OF EACH TRANSACTIONS ABOVE FOR YOUR REFERENCE.

In above case, Risk to Reward Ratio = 7.5 / (-4.55) = 1.648 OR 62.397% / (-4.55) = 0.137; Whereas back test gives -0.188

I am very confused in UNDERSTANDING RISK TO REWARD RATIO GIVEN IN PI BACK TEST REPORT, PL guide me how it is being calculated step by step in detail… I discussed with few traders, nobody has answer… And How Negative values arrives… My understanding if I keep 1 risk to 3 profit, i.e, 1:3 = 1/3= 0.333 OR 3 Profit to 1 Risk, i.e, 3:1 = 3/1 = 3 vice-versa.
Which is correct? how zerodha pi calculates?