Announcement

Collapse
No announcement yet.

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.


    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    89 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X