Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entries being chased (unexpected)

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

    Entries being chased (unexpected)

    I have a script that puts in a long or short entry via

    EnterLongLimit(Lots, GetCurrentBid(), "Long")

    Or

    EnterShortLimit(Lots, GetCurrentAsk(), "Short");


    The initial price is exactly what I want. But it continually updates the would-be entry price with each price change.

    How do I tell a script to submit at a the current bid/ask and just sit there and wait to be filled and not update with each tick that adjusts the entry price?

    #2
    Hello LookOutBelow,

    One approach to this is using bool flags. Following is the general steps needed here.
    • Check the bool flag in the same condition you use to evaluate whether an order should be placed.
    • Set the bool the opposite direction in the same block that places the order.
    • Reset it somewhere - maybe when your market position == long.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the quick response. I'll take a look at implementing something like this.

      While I have you.. I'm new to NT, so I don't know if this is the case or not. Is this to be expected with every script I make (if I place the order on the Bid for a buy and Ask for a short), or is this somehow related to the way I created the conditions?

      Thanks much.




      Originally posted by NinjaTrader_RyanM View Post
      Hello LookOutBelow,

      One approach to this is using bool flags. Following is the general steps needed here.
      • Check the bool flag in the same condition you use to evaluate whether an order should be placed.
      • Set the bool the opposite direction in the same block that places the order.
      • Reset it somewhere - maybe when your market position == long.

      Comment


        #4
        Yes, you will probably notice this more as you work with NinjaScript. It's a C# extension so you will see behaviour typical of a real programming language.

        In this case, it executes the statements if the code evaluates to true. If there has been an update to the values, these get updated as well.

        Using bool flags here is one approach but since you're working with a programming language there may be others as well. You will have a lot of flexibility with NinjaScript but of course there's always a challenge learning a new system.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, Yesterday, 06:40 PM
        2 responses
        19 views
        0 likes
        Last Post algospoke  
        Started by ghoul, Today, 06:02 PM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        45 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        21 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        181 views
        0 likes
        Last Post jeronymite  
        Working...
        X