Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 CortexZenUSA, Today, 12:53 AM
            0 responses
            1 view
            0 likes
            Last Post CortexZenUSA  
            Started by CortexZenUSA, Today, 12:46 AM
            0 responses
            1 view
            0 likes
            Last Post CortexZenUSA  
            Started by usazencortex, Today, 12:43 AM
            0 responses
            5 views
            0 likes
            Last Post usazencortex  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            168 responses
            2,265 views
            0 likes
            Last Post sidlercom80  
            Started by Barry Milan, Yesterday, 10:35 PM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X