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 NullPointStrategies, Today, 05:17 AM
    0 responses
    52 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X