Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Startegy handled exits differnetly when live, than in analyzer....

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

    Startegy handled exits differnetly when live, than in analyzer....

    I have a strat opening two short positions..."short1" and "short2"

    short1 has a stop and target set, and on entry execution name is set correctly to short1 in the stops and targets section of the builder
    short 2 has a stop set the same, but no target.

    there is another tab in the actions where I have conditions set that if I am short, and this happens, 'Exit Short Position, short2" and label it short2exit

    in the analyzer this works perfect...i see the profit target exit, then i see the second lot exit when the conditions trigger. however when i went live on a sim account, both lots exit at the target, but i did not change anything....why is this?

    I noticed the setting "stop & target submission" can be per entry, or by strategy. I have analyzed both these and see zero difference in results. is this related?

    example below, on the left the short positions were generated historically, the ones on the right are placed live by the strat, same window just one was historical the other done live. i initiated the strategy between the two. very strange.
    Click image for larger version

Name:	example.PNG
Views:	177
Size:	69.7 KB
ID:	1174197
    Last edited by HaveGunsWillTravel; 10-08-2021, 09:15 AM.

    #2
    Hi, thanks for posting.

    The strategy is likely breaking the order handling rule listed here:

    Methods that generate orders to exit a position will be ignored if:

    •A position is open and an order submitted by a set method (SetStopLoss() for example) is active

    There should be an entry in the Log tab of the Control Center about this ignored order. You would need to use only Exit methods or only Set methods for exiting the position.

    Kind regards,
    ChrisL

    Comment


      #3
      Ok that make sense...What would an exit method for a stop look like? i tried doing price is equal to average position price offset by -8 (for 8 ticks below since it is a short) but it didn't work, I am not sure if the 8 would be ticks, dollars, or something else. thanks for the help

      Comment


        #4
        Hi, thanks for your reply.

        I attached an example that uses a stop market order as a stop. Please see attached and let me know if you have any questions on it. Place the .cs file within Documents\NinjaTrader 8\bin\Custom\Strategies and compile.

        Kind regards,
        -ChrisL
        Attached Files

        Comment


          #5
          VERY helpful! so 'trigger state' is just an index of where the strategy is, and then as you progress through those you can have different orders initiate?

          Comment


            #6
            Hi, thats correct. It keeps track of where the stop should be based on the price condition. There is a little more leg work when using an exit method as a stop in the builder, but you can do more customizable actions.

            Best regards,
            -ChrisL

            Comment


              #7
              Awesome, it is really helping me. one question. My tabs (the set1, set2 ,set3 etc...keep re-arranging themselves whenever I compile. they do not stay in order like your example file. Does this matter as long as the logic is all correct?

              Comment


                #8
                Hi,

                The tab order does matter because that is the order they are checked in OnBarUpdate. The sets to not rearrange on my installation, it should be staying put.

                Comment


                  #9
                  ok, good to know. It was weird I just had to rebuild it from scratch and now it stays. I kept arranging them correctly, hit compile, and it looked fine, then if I re-opened they were mixed up again...after rebuilding it they stayed.

                  on another note, so i took your template, added in a condition to go long, but realized your example has no initial stop order. Just the update part. So I have been working with it feverishly and I cannot get it to work right. Sometimes it will make the updated stop price, other times it wont even place the initial stop. I am sure i am overlooking something with flow...Should i be using the stop and target section for the initial stop and then actions just to cancel and update it with the breakeven as in the template?

                  Second question, I have a strat I have been running live, and watching. It is only one lot each way, and i have the exit tagged to the entry signal name, but it triggered 2 'exit' orders leaving me short with no stop and no way for the start to pick up on it. it only did this once out of 5 trades I watched. yesterday it did it as well twice at random times.The trigger time was correct, it just did it twice. I snapped a pic of the order log and i cannot make sense of it. it appears both Exit orders shared the same order id ending in *399? but I got filled on both...I have 'update on each tick' active for this strat, is it related? maybe it triggered jumped up and triggered again before the start even knew it placed an order?
                  Here is a pic, you can see i manually closed it after it placed itself. Thanks for the help
                  Click image for larger version

Name:	DoubleExit Error.PNG
Views:	143
Size:	177.4 KB
ID:	1174749

                  Comment


                    #10
                    Hi, thanks for your reply.

                    We can not use both Exit orders and SetStopLoss in the stop and target section because it will go against the order handling rules here:


                    You can run the strategy example OnEachTick to get the stop loss submitted sooner. For your second question, I will need to see screen shots of the strategy you made to know what the problem is.

                    Kind regards,
                    -ChrisL

                    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