Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adjusting ExitLongStop after a certain amount of ticks

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

    Adjusting ExitLongStop after a certain amount of ticks

    Trying to adjust the stop once the price reaches a certain amount of ticks above the entry. The Breakeven stop never gets triggered though


    EnterLong(DefaultQuantity,"Entry");
    PT = (Close[0]+ATR(20)[0]*10.00);
    SL = (Close[0]-ATR(20)[0]*3.00);
    POS = (GetCurrentBid(0) + (35 * TickSize));
    Print(POS.ToString());
    Print(Position.AvgPrice.ToString());

    Profx = 0;
    }
    // Exits
    if (PT_ON == 1 && Long_on == 1) { ExitLongLimit(PT,"PTx",""); }
    if (Position.AvgPrice > 0 && High[0] > POS && Long_on == 1) { ExitLongStop(POS - (35 * TickSize),"Breakeven",""); }
    else if (SL_ON == 1 && Long_on == 1) { ExitLongStop(SL,"SLx",""); }

    #2
    Hello akonkol2,

    Thank you for your post.

    Do you receive any errors or messages in the log when the order should move? If so, what do these messages report?

    I would recommend enabling Trace Orders in the strategy and tracking the orders in the Output window. You can find more details on Trace Orders at the following link: http://ninjatrader.com/support/forum...ead.php?t=3627

    I look forward to your response.

    Comment


      #3
      Here is the last output of the trace. The high during this long was 5918.75 which is above the 5913.75. This should move the stop from 5899.25 to 5905 but it doesnt it keeps the 5899.25 stop price.

      5905
      5913.75
      7/28/2017 2:19:11 PM Entered internal PlaceOrder() method at 7/28/2017 2:19:11 PM: BarsInProgress=0 Action=Sell OrderType=Limit Quantity=0 LimitPrice=5924.50 StopPrice=0 SignalName='PTx' FromEntrySignal=''
      7/28/2017 2:19:11 PM Ignore order amendment: Action=Sell OrderType=Limit Quantity=0 LimitPrice=5924.50 StopPrice=0 SignalName=PTx' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'
      7/28/2017 2:19:11 PM Entered internal PlaceOrder() method at 7/28/2017 2:19:11 PM: BarsInProgress=0 Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=5899.25 SignalName='SLx' FromEntrySignal=''
      7/28/2017 2:19:11 PM Ignore order amendment: Action=Sell OrderType=Stop Quantity=0 LimitPrice=0 StopPrice=5899.25 SignalName=SLx' FromEntrySignal='' Reason='Order already has this stop price/limit price/quantity'

      Comment


        #4
        Hello akonkol2,

        Thank you for your response.

        May we review the full strategy code on our end?

        If so, please send the file to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' in the subject line and a reference to this thread in the body of the email.

        You can export your strategy by going to Tools > Export > NinjaScript Add On > Add > select your strategy > OK > Export > name the file 'NTsupport' > Save. The file will be located under Documents\NinjaTrader 8\bin\Custom\ExportNinjaScript.

        I look forward to your response.

        Comment


          #5
          Just sent it

          Comment


            #6
            Hello akonkol2,

            Thank you for your patience.

            If you print out the PT and compare it against the POS is the POS at a lower value? In my tests the POS was always higher than the PT and therefore never triggered.

            I look forward to your response.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            558 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            545 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X