The code is here but it does not return any value.
Can you point out the mistake and a better code?
[FONT=Microsoft Sans Serif][/FONT][FONT=Microsoft Sans Serif][COLOR=#0000ff][FONT=Microsoft Sans Serif][COLOR=#0000ff]private[/COLOR][/FONT][/COLOR][/FONT][FONT=Microsoft Sans Serif] [/FONT][FONT=Microsoft Sans Serif][COLOR=#0000ff][FONT=Microsoft Sans Serif][COLOR=#0000ff]double[/COLOR][/FONT][/COLOR][/FONT][FONT=Microsoft Sans Serif] profitlossLastnHours( [/FONT][FONT=Microsoft Sans Serif][COLOR=#0000ff][FONT=Microsoft Sans Serif][COLOR=#0000ff]int[/COLOR][/FONT][/COLOR][/FONT][FONT=Microsoft Sans Serif] nHrs) { nHrs= [/FONT][FONT=Microsoft Sans Serif][COLOR=#800080][FONT=Microsoft Sans Serif][COLOR=#800080]2[/COLOR][/FONT][/COLOR][/FONT][FONT=Microsoft Sans Serif]; [/FONT][FONT=Microsoft Sans Serif][COLOR=#0000ff][FONT=Microsoft Sans Serif][COLOR=#0000ff]if[/COLOR][/FONT][/COLOR][/FONT][FONT=Microsoft Sans Serif](Performance.RealtimeTrades.Count > [/FONT][FONT=Microsoft Sans Serif][COLOR=#800080][FONT=Microsoft Sans Serif][COLOR=#800080]1[/COLOR][/FONT][/COLOR][/FONT][FONT=Microsoft Sans Serif]) { Trade tradesAgo = Performance.RealtimeTrades[Performance.RealtimeTrades.Count - [/FONT][FONT=Microsoft Sans Serif][COLOR=#800080][FONT=Microsoft Sans Serif][COLOR=#800080]1[/COLOR][/FONT][/COLOR][/FONT][FONT=Microsoft Sans Serif]]; [/FONT][FONT=Microsoft Sans Serif][COLOR=#0000ff][FONT=Microsoft Sans Serif][COLOR=#0000ff]if[/COLOR][/FONT][/COLOR][/FONT][FONT=Microsoft Sans Serif] (DateTime.Compare(tradesAgo.EntryExecution.Time.AddHours(nHrs), DateTime.Now) >= [/FONT][FONT=Microsoft Sans Serif][COLOR=#800080][FONT=Microsoft Sans Serif][COLOR=#800080]0[/COLOR][/FONT][/COLOR][/FONT][FONT=Microsoft Sans Serif]) { pl= Instrument.MasterInstrument.Round2TickSize(tradesAgo.ProfitCurrency); } } [/FONT][FONT=Microsoft Sans Serif][COLOR=#0000ff][FONT=Microsoft Sans Serif][COLOR=#0000ff]return[/COLOR][/FONT][/COLOR][/FONT][FONT=Microsoft Sans Serif](pl); } [/FONT]
Comment