![]() |
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
|
|||||||
| 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. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Sep 2008
Location: Old Lyme, CT
Posts: 108
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
You need to be subtracting that buffer from the actual value of the LinReg and not the DataSeries.
LinReg(Close, 2)[0] - bBuff
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Senior Member
Join Date: Sep 2008
Location: Old Lyme, CT
Posts: 108
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
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"); } |
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Skat100,
No, you need the first one as a DataSeries. You want a DataSeries to cross a specific double value.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |