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

Not All Code Path Return a Value

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

    Not All Code Path Return a Value

    When I try to compile the following Constructor, my compiler complains that not all code paths return a value.

    Could you suggest potential causes and how in general to diagnose this error?

    public override double GetPerformanceValue(SystemPerformance systemPerformance)
    {
    grossProfit = systemPerformance.AllTrades.TradesPerformance.Gros sProfit;
    grossLoss = systemPerformance.AllTrades.TradesPerformance.Gros sLoss;
    avgProfPct = systemPerformance.AllTrades.TradesPerformance.Perc ent.AvgProfit;
    stdDev = systemPerformance.AllTrades.TradesPerformance.Perc ent.StdDev;
    }

    Not sure why this post shows spaces in Gross and Percent but the source does not.
    Last edited by Jan Gullett; 07-27-2011, 01:17 PM.

    #2
    Hi Jan Gullett,

    You need to return something from the method if you write a type (double in your example). If you don't want to return a value, you use void.

    Some examples of custom methods are available here:
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Salahinho99, Today, 04:13 AM
    0 responses
    9 views
    0 likes
    Last Post Salahinho99  
    Started by junkone, 04-28-2024, 02:19 PM
    8 responses
    92 views
    1 like
    Last Post brucerobinson  
    Started by mkouitra, 10-23-2021, 04:40 PM
    17 responses
    1,965 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by Vietanhnguyen2hotmailcom, 05-03-2024, 10:29 AM
    4 responses
    30 views
    0 likes
    Last Post Vietanhnguyen2hotmailcom  
    Started by PhillT, 04-19-2024, 02:16 PM
    4 responses
    39 views
    0 likes
    Last Post PhillT
    by PhillT
     
    Working...
    X