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, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    41 views
    0 likes
    Last Post CarlTrading  
    Working...
    X