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 GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,221 views
          0 likes
          Last Post xiinteractive  
          Started by andrewtrades, Today, 04:57 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          7 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          438 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          9 views
          0 likes
          Last Post FAQtrader  
          Working...
          X