Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

delete condition

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

    delete condition

    Hello,

    I want to ask please how on can delete a condition by another condition in NT-script. I couldnt find it in the video library.

    For Example there is

    if (GetCurrentAsk(0) > Position.AvgPrice +10 * TickSize)
    ExitLongt(2000);

    When a certain condition is true this condition and the exitlong should be deleted (for understanding we expect the market to move stronger in the direction)

    (I do not ask for the other condition of course, only how one can delete.)

    Thanks
    Tony

    #2
    tonynt,

    I am not sure what you mean here. You wish to delete a condition from your code or to exit an order? Could you clarify please?
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      delete condition

      Hello,

      yes, I want to delete a condition from the code. Eg if xMA(xx) crossabove xMA(xx) then "delete" condition (as posted in the question).

      We expect rising prices and therefore the exitlong should not be realized in this case, I want to "let it run" without the target and only with the stoploss. Therefore I want to delete the profit-target-condition in the script (eg by the xma crossover another xma (or anything else - only to explain)

      Thats it.

      Thanks
      Tony



      Originally posted by NinjaTrader_AdamP View Post
      tonynt,

      I am not sure what you mean here. You wish to delete a condition from your code or to exit an order? Could you clarify please?

      Comment


        #4
        Hello tonynt,
        Thanks for the clarification and I am replying for Adam.

        Unfortunately there are no native NinjaScript code to do it. However you can custom code simple C# logic to do it.

        in variable
        Code:
        bool isExit = ture;
        in OnBarUpdate
        Code:
         if (xMA(xx) crossabove xMA(xx))
        {
          isExit = false;
        }
        
        if (isExit && GetCurrentAsk(0) > Position.AvgPrice +10 * TickSize)
        ExitLongt(2000);
        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Thank you, I´ll try to get it this way. For your information I want to "click away" a certain profit target like

          private void btndeletetarget_Click(object s, EventArgs e)
          {
          ??delete?? ExitLong(1000, "xA","A");
          }

          and I think now it works only with your solution with the variable as I have to cancel the referring conditon. Thank you for the idea.

          Best regards
          Tony



          for
          Originally posted by NinjaTrader_Joydeep View Post
          Hello tonynt,
          Thanks for the clarification and I am replying for Adam.

          Unfortunately there are no native NinjaScript code to do it. However you can custom code simple C# logic to do it.

          in variable
          Code:
          bool isExit = ture;
          in OnBarUpdate
          Code:
           if (xMA(xx) crossabove xMA(xx))
          {
            isExit = false;
          }
          
          if (isExit && GetCurrentAsk(0) > Position.AvgPrice +10 * TickSize)
          ExitLongt(2000);
          Please let me know if I can assist you any further.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          63 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          41 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          22 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          25 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          51 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X