Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Probability Statistic Confirmation
Collapse
X
-
Probability Statistic Confirmation
I'm sorry to resurrect this thread, but I see this question come up in several other posts and didn't want to re-ask it. I've been playing around with various strategies and have one that indicates 5 trades executing... all 5 hit the profit target. The profit win average is exactly the same as the overall average. Yet the probability is 0. I'm having a hard time understanding what relevance "probability" has. The formula isn't published on the help page (not that I could find). Are we sure that it's working as intended?Tags: None
-
Hi, thanks for posting.
You can plug your results into the students t-distribution to find out why this is producing 0, the method will return a 1 for true or 0 for false.
I found a community members re-implementation:
Code:double div = systemPerformance.AllTrades.TradesPerformance.Percent.StdDev / Math.Sqrt(systemPerformance.AllTrades.TradesCount) ; double t = Stat.StudTp(systemPerformance.AllTrades.TradesPerf ormance.Percent.AvgProfit / div, systemPerformance.AllTrades.TradesCount - 1); return (div <= 0.5 ? 1 - t : t);
-ChrisLChris L.NinjaTrader Customer Service
-
I appreciate the response, but I think you have a bug here in the SystemPerformance.AllTrades.TradesPerformance.Perc ent collection.
btw... the "s" should be capitalized in "SystemPerformance."
I have run a Print() on just about all the properties in the Percent collection. The numbers returned do not represent anything even close to what they should. I ran this in a backtest strategy that had exactly six trades. Each of them had a take profit of $25. There were no losers. ie, Percent.AverageProfit returns a value of "0.00112206428499886" following the last trade in the dataset. So, if "AverageProfit" "LargestWinner" "LargestLoser" are all returning very similar values to 0.00112206428499886, I didn't bother messing with the rest of the method you posted, nor try to check NT's math on the StdDev.
Comment
-
Hello Chippy,
I've made some output to see if this is calculating correctly. From what I am seeing the numbers are matching.
Note, that with percent metrics the profit is re-invested into the next trade and is cumulative.
A sample of the output from the last trade:
AllTrades.Count: 6, Currency.StdDev: 43.3304118940428, Percent.StdDev: 0.000197012793405613
2/14/2022 4:20:00 PM | trade.Quantity: 1, trade.ProfitCurrency -37.5, trade.ProfitPercent: -0.000170415814587594
(profitCurrency: -37.5 / quantity: 1 - currencySumProfit: 162.5 / TradesCount: 6): -64.5833333333333 * (profitCurrency / quantity - currencySumProfit / TradesCount) = 4171.00694444444
-
(profitPercent: -0.000170415814587594 - percentSumProfit: 0.000738930258560834 / TradesCount: 6): -0.000293570857681066 * (profitPercent - percentSumProfit / TradesCount) = 8.61838484795968E-08
√(currencyDevProfit: 11265.1475694444 / TradesCount): 1877.52459490741 = 43.3304118940428
√(percentDevProfit: 2.32884244592896E-07 / TradesCount): 3.88140407654827E-08 = 0.000197012793405613Attached FilesChelsea B.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ChrisR, Yesterday, 09:24 PM
|
3 responses
16 views
0 likes
|
Last Post
![]()
by ChrisR
Today, 06:16 PM
|
||
Started by balltrader, Today, 10:06 AM
|
6 responses
30 views
1 like
|
Last Post
|
||
Started by Attila, 03-07-2023, 09:47 AM
|
4 responses
32 views
0 likes
|
Last Post
![]()
by BartMan
Today, 04:01 PM
|
||
Started by BartMan, Today, 03:59 PM
|
0 responses
14 views
0 likes
|
Last Post
![]()
by BartMan
Today, 03:59 PM
|
||
Started by QuantKey_Bruce, 03-29-2023, 02:31 PM
|
10 responses
43 views
0 likes
|
Last Post
![]()
by BartMan
Today, 03:45 PM
|
Comment