PDA

View Full Version : multi timeframe and TSSuperTrend


ohowie
06-11-2009, 08:42 PM
I get the following error in my log and the reference to BarsArray[1] for TSSuperTrend is ignored. What may I be doing wrong. Is it because TSSuperTrend is returning a bool for the Bar object?

Error on calling the "OnBarUpdate" method for indicator "TSSuperTrend on bar 1:Object reference not set to an instance of an object.

Code snipet follows: THANK YOU, Howard

protectedoverridevoid Initialize()
{
Add(PeriodType.Minute, Series2); // series 2 passed to strategy


protectedoverridevoid OnBarUpdate()
{
if (BarsInProgress != 0)
{
return;
}
if (Position.MarketPosition == MarketPosition.Flat)
{
SetStopLoss("", CalculationMode.Ticks, StopLoss, false);
//stopTaken = false;
entryPrice = 0.00;
}

// Condition set 1
if (TSSuperTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Trend[0]
&& !TSSuperTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Trend[1]
&& Position.MarketPosition == MarketPosition.Flat
&& TSSuperTrend(BarsArray[1], 14, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode. ATR).Trend[1]
)

ohowie
06-11-2009, 10:57 PM
um... i made the changes based on the post that provided for "signal" bssignal data series and now it appears the error is no longer and it is respecting the use of TSsupertrend with multi timeframes. Unless someone else sees something amiss i do believe i've got it. (gollly)

ohowie
06-11-2009, 11:07 PM
disregard last um. Problem still exists. i get object reference not set to an instance of the object. HELP

NinjaTrader_Bertrand
06-12-2009, 05:59 AM
ohowie, unfortunately we're not familiar with the addon indicator call you try to work into a multitimeframe environment - I would suggest contacting the original author to clarify.