Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enter Long On Stop Order Not Working

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

    Enter Long On Stop Order Not Working

    Sorry for such a simple question but this is driving me mad. I tried to use an Enter Long On Stop Command so I only enter a trade at a $x or above. When I do this I get no entries at all. If I use a Enter Long Limit or Enter market it always works. I have gone back to basics and just did a short script to do this alone and still it will not work. The only entry condition is a long candle. I draw an arrow every time there is a long candle and this works for all entry conditions so I know the condition is being met. What am I missing about the Enter Long Stop Order???

    I have been doing everything to date in the wizard (and have learnt a lot about its nuances with setting things out). As most people here use the script I have attached that.

    Thanks in advance.

    // Condition set 1
    if (Position.MarketPosition == MarketPosition.Flat
    && Close[
    0] > Open[0])
    {
    DrawArrowUp(
    "Condition Met" + CurrentBar, false, 0, (Low[0]) * (1 + -0.02), Color.Gray);
    EnterLongStop(DefaultQuantity, Close[
    0], "");
    Variable0 = Low[
    0];
    }
    // Condition set 2
    if (Position.MarketPosition != MarketPosition.Flat)
    {
    ExitLongLimit((Position.AvgPrice) * (
    1 + 0.03), "", "");
    ExitLongStop(Variable0,
    "", "");
    }
     

    #2
    Hello rodneya63,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    Please go to the Log tab of the Control Center. Do you see any messages or errors related to the EnterLongStop() method as the times it should have entered or when you enable the strategy?

    I look forward to your response.

    Comment


      #3
      Log Message

      Hi Patrick, Thank you for your quick response.

      I checked the log entry and it came up with the following message;

      "A Buy order placed at '2010-02-04 7:00:00 AM' has been ignored since the stop price is less than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy."

      I started the back test date on 2010-01-01 with a min of 20 bars required for the strategy to start.

      I test against 3 tickers as a first cut and it gave the same message 3 times. To test this further I then ran it against the Dow 30 and got 30 identical messages.

      In looking at the 3 charts for my standard tickers on this date all 3 showed a green (bull) candle for the day. 1 off the 3 should have triggered entry on the next day, the other 2 opening lower and the upper candle wick never reaching the trigger point of Close[0].

      Hope this gives some additional information,

      Regards,

      Rodney.

      Comment


        #4
        Hello rodneya63,

        Thank you for your response.

        Try setting the EnterLongStop() to the Close[0] plus a few ticks or even the Ask by using GetCurrentAsk().

        Comment


          #5
          Adding one tick triggers the action

          Hi Patrick,

          Either of those methods to get the price works as long as I add one tick. Thank you for resolving the problem.

          Out of curiosity do you know why the additional tick needs to be added to trigger the action?

          Regards,

          Rodney.

          Comment


            #6
            Originally posted by rodneya63 View Post
            Out of curiosity do you know why the additional tick needs to be added to trigger the action?
            Thank you for your response. I am actually unsure of what you mean here. Are you referring to the price of the order or the 'if' condition to trigger the action of placing the order?

            Comment


              #7
              Hi Patrick,

              I was referring to why do I need to add the 1 tick for the order to trigger. What has this made a difference? Why does Close[0] not work but Close[0]+Tick*1 does?

              Comment


                #8
                rodneya63,

                That just gives it enough room in some cases. Even with that added tick you could still have a case where the order is submitted at the price and the market moves quick enough that the order is invalid when submitted. It is just the speed between processing orders and the markets movement. You would need to compensate for it in your strategy.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                64 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
                52 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Working...
                X