Hi Murray.
Thanks for looking into this. Here is the sample code that is meant to compare session performances (simplified to remove clutter). The error is seen when the Session is run. The code saves/validates fine. Let me know if you find a fix or workaround.
' Session code:
Sub SYS_chan_break(modeTradeRisk, atrLen, atrOffset As Integer) MinMove = GetActiveMinMove() Hi = Highest(High, Slen, 0) Lo = Lowest(Low, Slen, 0) atr = Average(TrueRange, atrLen, atrOffset)
' Calculate trade risk based on test parameter setting. Select Case modeTradeRisk Case 0
tradeRisk = (Hi - Lo) Case 1 tradeRisk = (atr * 3) Case Else Print "Invalid modeTradeRisk: ", modeTradeRisk StopRun End Select ' Set trade risk. If (tradeRisk > 0) Then SetTradeRisk(tradeRisk) End If ' Place order. Buy ("ChanBuy", 1, Hi + MinMove, Stop, Day) Sell("ChanSell", 1, Lo - MinMove, Stop, Day) customExpectancyReport() End Sub
' Custom Report Code:
Sub customExpectancyReport() ' This results in error: "trying to call method of NULL object" Dim objSum As TSProcessor.ISummary objSum = thisSession.Summary
' I've also tried these with NO success:
' Dim objSes As TSProcessor.ISession
'objSes = thisSession or objSum = TradePlan.Session(0) 'objSum = objSes.Summary
' Calculate and print custom stats (ex. expectancy, opportunity, expectancy-score, etc.) calculated based on the objSum attributes End Sub |