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!
See more
See less

Partner 728x90

Collapse

Understanding Max Strength

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Understanding Max Strength

    Hi I was looking at the Max Strength code. And I do not understand this code:

    Code:
    [FONT=Calibri]* (1.0 - 0.25 / (0.25 + (trades.TradesPerformance.ProfitFactor - 1))) // <value> = 2 -> x = 0.8; <value> = 1 -> x = 0[/FONT]
    [FONT=Calibri]* (1.0 - 25.0 / (25.0 + trades.TradesCount)); // <value> = 100 -> x = 0.8[/FONT]
    Code:
    [FONT=Calibri]// Weighing in any <value> between 0 .. 1 by the formula: x = 1 - weight / (weight + <value>)[/FONT]
    [FONT=Calibri]// ... where 'weight' could be calculated by: weight = <value> * (1 - x) / x[/FONT]
    [FONT=Calibri]// Set x = 0.8 as a good pivot point[/FONT]
    
    [FONT=Calibri]Cbi.TradeCollection trades = strategy.SystemPerformance.AllTrades;[/FONT]
    [FONT=Calibri]var value = 100[/FONT]
    [FONT=Calibri]* (trades.TradesPerformance.ProfitFactor < 1 ? 0 : 1) // filter non profitable strategies[/FONT]
    [FONT=Calibri]* (trades.TradesCount == 0 ? 0[/FONT]
    [FONT=Calibri]: ((double)trades.WinningTrades.TradesCount / trades.TradesCount)) // as many trades profitable as possible[/FONT]
    [FONT=Calibri]* trades.TradesPerformance.RSquared // we're looking for steady profits[/FONT]
    [FONT=Calibri]* (1.0 - 0.25 / (0.25 + (trades.TradesPerformance.ProfitFactor - 1))) // <value> = 2 -> x = 0.8; <value> = 1 -> x = 0[/FONT]
    [FONT=Calibri]* (1.0 - 25.0 / (25.0 + trades.TradesCount)); // <value> = 100 -> x = 0.8[/FONT]
    Thanks,
    Erik

    #2
    Hello ErikHR1969,

    What specifically are you asking for clarification about with the two lines you have highlighted?

    The two lines shown are part of the math used to find the max strength. Those two lines return a value and the * before the line means its part of the overall math used, its value is multiplied and returned as the Value.

    If you would like a more in-depth knowledge of what these lines do I would suggest to make a copy of the MaxStrengh using the NinjaScript editor -> Right click -> Save as. You could then add prints for whichever parts you wanted to get specific values from to better understand how that contributes to the overall result.


    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ETFVoyageur, Today, 04:00 PM
    0 responses
    5 views
    0 likes
    Last Post ETFVoyageur  
    Started by AaronKTradingForum, Today, 03:44 PM
    1 response
    6 views
    0 likes
    Last Post AaronKTradingForum  
    Started by Felix Reichert, 04-26-2024, 02:12 PM
    11 responses
    77 views
    0 likes
    Last Post Felix Reichert  
    Started by junkone, 04-28-2024, 02:19 PM
    7 responses
    83 views
    1 like
    Last Post junkone
    by junkone
     
    Started by pechtri, 06-22-2023, 02:31 AM
    11 responses
    136 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Working...
    X