Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Profit targets giving problems

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

    Profit targets giving problems

    I trying to create a simple EMA strategy that is taking taking 2 contracts either short or long depending on the EMA for target 1 = 10 ticket and target 2 = 15 tickets. The problem I'm running into is if target 1 is hit, the strategy is basically closing all instead of letting it run to target 2 or even 3 if I add a 3rd target. I know it has something to do with my logic on the Order and stops.

    Click image for larger version

Name:	image.png
Views:	157
Size:	54.3 KB
ID:	1257369

    #2
    In my strategy, using strategy builder, my strategy works as intended. However, when I test it on market replay it doesn't. It's simple strategy that enters with 1 contract 2 times thus clicking buy or sell twice when entering long or short. If price hits target one, it's closing out the full position rather than letting it hit target 2. I know it's something to do with my order logic. It's closing the entire position if it hits Target 1 in market replay and live sim.

    This is a screen shot of Strategy Analyzer results showing it working as intended. You can see by the "entry names" that EMALONG 1 and 2 are the targets and they're working. Look at the profits of each.

    This is the screenshot of showing market replay and it closing both contracts on target 1. Look at the profits

    Click image for larger version

Name:	image.png
Views:	173
Size:	118.1 KB
ID:	1257590​​


    This is a screenshot of the strategy running when in market replay/live. Again look at the profits.

    Click image for larger version

Name:	image.png
Views:	127
Size:	50.0 KB
ID:	1257591
    Here is my entries when taking a long.

    Click image for larger version

Name:	image.png
Views:	129
Size:	1.7 KB
ID:	1257593

    Here is my entries for taking a position short.
    Click image for larger version

Name:	image.png
Views:	139
Size:	1.7 KB
ID:	1257594​​

    ​Here is my Stops and Targets in Strategy Builder.

    Click image for larger version

Name:	image.png
Views:	130
Size:	48.0 KB
ID:	1257592

    Comment


      #3
      Hello rsmustang19,

      May I have you enable TraceOrders and also print the value of the Target1 and Target2 inputs.

      Below is a link to a forum post on using Print() and TraceOrders to understand behavior.


      Then save the output from the output window to a text file and include this with your next post so we may investigate further.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Here are the inputs for the targets and stops. All 3 orders are using the StopLoss. I'm using the strategy builder to make this some I'm reading through the post you shared on how to add the print(). I have :Trace Orders" enabled in the properties of the strategy.


        Click image for larger version

Name:	image.png
Views:	143
Size:	35.2 KB
ID:	1257634

        Enteries both long and short.

        Click image for larger version

Name:	image.png
Views:	133
Size:	15.9 KB
ID:	1257635
        Click image for larger version

Name:	image.png
Views:	134
Size:	15.9 KB
ID:	1257636​​​

        Comment


          #5
          Hello rsmustang19,

          The output from TraceOrders and Prints will appear in the NinjaScript Output window.

          This will give us more information about the targets that are being submitted and at what price.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Ok. I just have to figure out how to get the Strategy Builder to add the prints.

            Comment


              #7
              Hello rsmustang19,

              Be sure to watch the video 'Debugging using prints with the Strategy Builder'.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Is there any reading material that you have that shows how to properly enter multiple targets? I'm deleted everything and starting over. I have a as simple as simple can be strategy. If the last bar close cross below the 50 EMA, Enter short 2 times for target 1 and target 2. Again, the strategy is closing the entry position if target 1 is hit. It doesn't even let it go to target 2.

                Click image for larger version

Name:	image.png
Views:	144
Size:	99.9 KB
ID:	1257669Click image for larger version

Name:	image.png
Views:	127
Size:	99.9 KB
ID:	1257670​​
                Last edited by rsmustang19; 06-26-2023, 02:50 PM.

                Comment


                  #9
                  Interesting....It's now working in both Analyzer and Market Replay.

                  Comment


                    #10
                    Hello rsmustang19,

                    I have an example of scaling out you may find helpful.
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by NullPointStrategies, Today, 05:17 AM
                    0 responses
                    50 views
                    0 likes
                    Last Post NullPointStrategies  
                    Started by argusthome, 03-08-2026, 10:06 AM
                    0 responses
                    126 views
                    0 likes
                    Last Post argusthome  
                    Started by NabilKhattabi, 03-06-2026, 11:18 AM
                    0 responses
                    69 views
                    0 likes
                    Last Post NabilKhattabi  
                    Started by Deep42, 03-06-2026, 12:28 AM
                    0 responses
                    42 views
                    0 likes
                    Last Post Deep42
                    by Deep42
                     
                    Started by TheRealMorford, 03-05-2026, 06:15 PM
                    0 responses
                    46 views
                    0 likes
                    Last Post TheRealMorford  
                    Working...
                    X