Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Syntax Problems

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?

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

    LinReg(Close, 2)[0] - bBuff
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Syntax errors continued

      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"
      );
      }

      Comment


        #4
        Skat100,

        No, you need the first one as a DataSeries.

        You want a DataSeries to cross a specific double value.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        19 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        45 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        20 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        180 views
        0 likes
        Last Post jeronymite  
        Working...
        X