• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

stop loss porblem

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

    stop loss porblem

    I have a stop loss strategy set up as SL 10 ticks and profit target 40 ticks. Since i am a trend trader so as the the trend as my direction, i usurally add more position. I have been testing my strategy for the past a couple of day. The porblem appeared was once i added the second or the third positon, the stop loss became 40 ticks instead of 10 ticks. I had to manually move it to 10. Never had any problem with first position though. Is that a bug or something?

    #2
    Hello peterhxu7.

    Thanks for the note.

    I tested this scenario. I placed my SetProfitTarget and SetStopLoss in State.Configure and made the strategy take a position on bar 0 and then another one on bar 1 with the code below:

    PHP Code:
    private bool flip true;

    protected 
    override void OnBarUpdate()
    {
            if(
    State == State.Historical) return;
                
            if (
    Close[0] > Open[0] && flip)
            {
                    
    flip false;
                    
    EnterLong(1);
            }
                    
            if (
    Close[0] > Open[2] && Position.MarketPosition == MarketPosition.Long)    
            {                    
                    
    EnterLong(1);            
            }

    I then ran the simulated data feed, set the trend up so that the positions would be taken, then I set the trend down. Both of the positions had discrete stop losses and profit targets and each position were closed in the correct order, as expected. If you wrote this script, could you please provide some code snippets? If you received this strategy from a third party, they might need to fix the logic of the strategy themselves.

    I look forward to assisting further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      hi chris:
      I didn't do any coding. just the ATM stetegy that ninja provides. The problem happens when i enter the second position.

      thanks

      Comment


        #4
        Hello peterhxu7,

        Thanks for the reply.

        In my testing, the stop loss is not moved if I scale up the position at a different price level.

        What version of NinjaTrader are you using? Please provide the entire version number. This can be found under Help -> About

        What instrument (and expiry if applicable) have you selected? For example, ES 09-18, AAPL, EURUSD, etc.

        Can you provide screenshots, or possibly a video of this happening with an ATM Strategy? Also, a screenshot of the ATM Strategy setup will help as well.

        I look forward to your reply.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          hi chris:
          i was using version 7 and the instrument was CL 08-18
          Attached Files
          Last edited by peterhxu7; 07-16-2018, 01:44 PM.

          Comment


            #6
            Hello peterhxu7,

            Thanks for the reply.

            If you are able to reproduce this issue every time you try to scale up your position with an ATM Strategy, there could be some bad item in your NinjaTrader database.

            Please follow the instructions below to reset the NinjaTrader database. (This can take longer depending on the size of your database file and your system.)
            1. Disconnect NinjaTrader from any open connections via File > Disconnect.
            2. From the NinjaTrader Control Center window select the menu Tools > Options.
            3. Select the 'Data' tab.
            4. Press the 'Reset DB' button.
            5. Press the 'OK' button.


            The following data will be removed.
            • Historical orders.
            • Historical executions.
            • Historical ATM strategy data.
            • Saved Strategy Analyzer backtest results.


            After you do this, test the ATM Strategy again and let me know if you get the same results.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              thanks. I retested using simulated data. It worked as long as i chose the ATM strategy again before i placed the next order. I guess the system does know if you want to use the same stop loss and profit target as default. it's a bit anoring but i think i 've solved the porblem.

              Comment


                #8
                Hello peterhxu7,

                Thanks for the reply.

                You may edit the default "ATM Strategy Selection Mode" by right-clicking Chart Trader and selecting properties.

                Here is the help guide page that describes each selection mode:
                https://ninjatrader.com/support/help...ction_mode.htm

                Please let us know if we may be of any further assistance.
                Chris L.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by afoschini, Today, 02:57 AM
                0 responses
                1 view
                0 likes
                Last Post afoschini  
                Started by Newtrader101, Yesterday, 06:31 PM
                1 response
                9 views
                0 likes
                Last Post NinjaTrader_EricB  
                Started by Tyler7498, Yesterday, 07:34 PM
                0 responses
                4 views
                0 likes
                Last Post Tyler7498  
                Started by Woomera, Yesterday, 07:24 PM
                2 responses
                10 views
                0 likes
                Last Post Woomera
                by Woomera
                 
                Started by Newtrader101, Yesterday, 12:31 PM
                3 responses
                16 views
                0 likes
                Last Post NinjaTrader_EricB  
                Working...
                X