Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CrossAbove (Current Ask, Open price + Int Variable * TickSize)

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

    CrossAbove (Current Ask, Open price + Int Variable * TickSize)

    Hi having a problem setting a very simple condition

    // Condition set 1
    if (CrossBelow(GetCurrentAsk(), Open - S1 * TickSize, 1)
    && Open[1] < Close[1]
    && Position.Quantity == 0
    && Bracket == false)
    {
    EnterLongStop(Q, Open[0], "TSTZLong");
    }


    Note that S1 is a Private int previously defined.

    I am getting code NT0019.: Operator '-' cannot be applied to operands of type "NinjaTraderSata|DataSeries" and "double".


    I have also tried:
    if (CrossBelow(GetCurrentAsk(), Open (0) - S1 * TickSize, 1)
    and got: CS0103: The name 'Open' does not exist in the current context.

    I'll appreciate any help.

    Thanks Horacio








    #2
    Hello horacioofman,

    Thanks for your first post in the forums!

    The error message is advising that you cannot subtract a double value from a data series. In your code , Open - S1 * TickSize, 1), Open is a data series and S1 is a double type variable. You just need to specify which open value of the Open data series to subtract the S1 value from.

    This code: Open (0) - S1 * TickSize, 1) is producing an error because the use of (0) makes the compiler think Open(0) is a method

    I suspect you want this: Open[0] - S1 * TickSize, 1) In this case the square brackets are telling the compiler which data point in the data series of open to use.

    Comment


      #3
      Thanks Paul. You were right on the use of square parenthsis/brackets, but crossbellow funtion did not take the corrected statement either. I ended up using a >= operator for on currentprice(0):

      if (GetCurrentAsk(0)< (Open[0]-S1 * TickSize ) ........

      I think it is working. Thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by SalmaTrader, 07-07-2026, 10:26 PM
      0 responses
      45 views
      0 likes
      Last Post SalmaTrader  
      Started by CarlTrading, 07-05-2026, 01:16 PM
      0 responses
      22 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 06-17-2026, 10:32 AM
      0 responses
      14 views
      0 likes
      Last Post CaptainJack  
      Started by kinfxhk, 06-17-2026, 04:15 AM
      0 responses
      20 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 06-17-2026, 04:06 AM
      0 responses
      22 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X