NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 06-01-2009, 08:11 AM   #1
skat100
Senior Member
 
Join Date: Sep 2008
Location: Old Lyme, CT
Posts: 108
Thanks: 0
Thanked 0 times in 0 posts
Default Syntax Problems

In the following condition:

// Condition set 2
if (Position.MarketPosition == MarketPosition.Flat
&& CrossBelow(LinReg(Close,
15), (LinReg(Close, 2) - bBuff), 1))
{
EnterShort(n,
"SS.LRx");
}

I get an error message ojectiong to the - operand in (-bBuff).

How can I apply a buffer, such as an addition or subtraction of value, from one of the elements of a crossover strategy?
skat100 is offline  
Reply With Quote
Old 06-01-2009, 08:15 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

You need to be subtracting that buffer from the actual value of the LinReg and not the DataSeries.

LinReg(Close, 2)[0] - bBuff
NinjaTrader_Josh is offline  
Reply With Quote
Old 06-01-2009, 08:24 AM   #3
skat100
Senior Member
 
Join Date: Sep 2008
Location: Old Lyme, CT
Posts: 108
Thanks: 0
Thanked 0 times in 0 posts
Default Syntax errors continued

Quote:
Originally Posted by NinjaTrader_Josh View Post
You need to be subtracting that buffer from the actual value of the LinReg and not the DataSeries.

LinReg(Close, 2)[0] - bBuff

Is this the way it should read? (I have add the [0] to both legs of the condition?

// Condition set 2
if
(Position.MarketPosition == MarketPosition.Flat
&& CrossBelow(LinReg(Close,
15)[0], (LinReg(Close, 2)[0] - bBuff), 1
))
{
EnterShort(n,
"SS.LRx"
);
}
skat100 is offline  
Reply With Quote
Old 06-01-2009, 08:27 AM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Skat100,

No, you need the first one as a DataSeries.

You want a DataSeries to cross a specific double value.
NinjaTrader_Josh is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
what is wrong with this syntax junkone Indicator Development 4 05-22-2009 05:25 PM
Problem of Syntax germano Strategy Development 13 04-02-2009 10:55 AM
Syntax Problems skat100 Strategy Development 77 12-16-2008 08:47 AM
Print() syntax stefy General Programming 8 10-08-2008 06:22 PM
indicator syntax help safetrading Indicator Development 4 05-16-2008 08:00 AM


All times are GMT -6. The time now is 08:32 AM.