Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Manual order entry with managed exit

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

    Manual order entry with managed exit

    I feel like this has been addressed already, but I can't find it in the forum. I am looking for a way to manually enter a trade, and then have an automated strategy manage the exit.

    Specifically, I want the ability to manually enter a long trade, then have an automated strategy automatically exit the trade if a candle closes below the EMA. Alternatively, I want the ability to manually enter a short trade, then have an automated strategy exit the trade if a candle closes above the EMA.

    I have found several old threads from 2011, 2015, 2018 stating this can't be accomplished....but them I've found some newer threads stating the best way to accomplish this is to create "long" or "short" order entry buttons within the automated strategy to accommodate manual order entry. Can someone provide information, or point me to existing information on how to accomplish this? Unfortunately I am not a coder, however I am familiar with the strategy builder in NT8, therefore any solutions that can either be imported or created within strategy builder would be the most helpful.

    #2
    Originally posted by GoCubsGo View Post
    I feel like this has been addressed already, but I can't find it in the forum. I am looking for a way to manually enter a trade, and then have an automated strategy manage the exit.

    Specifically, I want the ability to manually enter a long trade, then have an automated strategy automatically exit the trade if a candle closes below the EMA. Alternatively, I want the ability to manually enter a short trade, then have an automated strategy exit the trade if a candle closes above the EMA.

    I have found several old threads from 2011, 2015, 2018 stating this can't be accomplished....but them I've found some newer threads stating the best way to accomplish this is to create "long" or "short" order entry buttons within the automated strategy to accommodate manual order entry. Can someone provide information, or point me to existing information on how to accomplish this? Unfortunately I am not a coder, however I am familiar with the strategy builder in NT8, therefore any solutions that can either be imported or created within strategy builder would be the most helpful.


    In it's simplest, easiest form simply configure and add a specific ATM strategy to the Chart. The ATM code will automatically execute as soon as a Manuel order is placed.

    To get more complicated order management than an ATM strategy is possible, but is just that ... much more complicated.

    Will a ATM strategy meet your needs?

    Hedge

    Comment


      #3
      Unfortunately, no, unless there is a way that I'm not aware of for an ATM to identify a candle's closing price in relation to the EMA. All of the ATM exits are trail stops, breakevens, etc....they don't allow the trade to run indefinitely until the EMA is crossed.

      Comment


        #4
        I've never used the strategy builder, but I don't think this can be done without coding it. Like you mentioned, it can be done by creating a long and short button, which will programmatically create the market position. You will then create the checks in the OnBarUpdate function for the strategy. For example, I have a function called ManageOpenedPositions in the OnBarUpdate function. Something similar to the below, but the logic needs to check for your exit positions.

        Code:
        private void ManageOpenedPositions()
                {
                    if (Position.MarketPosition == MarketPosition.Long)
                    {
                        // Update logic for managing positions
                        // Exit position if current or future bar becomes bearish and has stacked imbalances
                        if (_dataBars.Bar.BarType == BarType.Bearish && _dataBars.Bar.Imbalances.HasBidStackedImbalances)
                        {
                            ExitLong();
                        }
                    }
        
                    if (Position.MarketPosition == MarketPosition.Short)
                    {
                        // Update logic for managing positions
                        // Exit position if current or future bar becomes bullish and has stacked imbalances
                        if (_dataBars.Bar.BarType == BarType.Bullish && _dataBars.Bar.Imbalances.HasAskStackedImbalances)
                        {
                            ExitShort();
                        }
                    }
                }​

        Comment


          #5
          Hello GoCubsGo,

          Thank you for your post.

          WaleeTheRobot is correct, this would not be able to be accomplished from the Strategy Builder.

          Typically, NinjaScript strategies are only able to read the orders placed by that specific instance of the strategy and cannot read orders that are manually placed outside of the strategy.

          You could create your own script that places manual orders from clicking on a custom button, and then manage the order within that strategy.

          Please see the linked example script below which demonstrates:


          If you have any further questions, please let us know.

          Comment


            #6
            Thank you, I appreciate the information.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            53 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            130 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            70 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            44 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            49 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X