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 CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    58 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    34 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    195 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    360 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    281 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X