Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trying to protect profits

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

    Trying to protect profits

    Click image for larger version

Name:	aaa.png
Views:	243
Size:	44.7 KB
ID:	1179456
    I'm trying to protect profits. Like if I go positive into profit, I want to make sure I get out before it goes against me. Like a break even.
    However my code doesnt have any response.
    How can I fix it?

    If I cant get something like this to work, I think I'll try to add my trailing stop back on. Thanks

    #2
    Hello ezrollin,

    Thanks for your post.

    The Strategy Builder uses the "Managed approach" which provides rules to govern how the strategy places orders. One of those rules is that limit type (resting) order will be automatically canceled if not filled on the bar the order is submitted. In your case of the ExitLongMIT, this is a resting order and if it is not filled when the sets conditions are true then it will be canceled.

    The order price is specified as the current ask minus 30, to be clear that would be minus 30 points which seems like a lot.

    If I may suggest a far easier path for you would be to simply use ExitLong which is a market order that will exit immediately when your PNL is > 50.


    If you want to use a resting order then you will need to do the following (relative to the displayed set):

    1) Create a bool variable that is set true when the sets conditions are true.
    2) In the sets conditions, check that the bool is false. (The idea is that the set only runs once)
    3) Create a double variable to hold the exit price
    4) In the displayed set, save the exit price to use in the double variable.

    Next, create a new set and check:
    1) Market position is long
    2) check that the bool is true
    For the action, create the exitlongMIT with the double variable that holds the price.

    Finally, you would need to create another set that will reset the bool back to false for the next entry. You will need to determine the conditions for this.

    So what happens is:
    1) When the display sets conditions of market position, pnl>50 and bool is false, the set will then set the bool true and will save the exit price into a double variable. Because the bool is now true, the sets conditions are false so that means the exit price cannot change.
    2) The new set conditions are the bool is true and you are in a long position, as long as that remains true the exit order will be submitted on every new bar until it gets filled (which changes the market position) or you change the state of the bool which would then cause the order to be canceled on the next bar.

    Comment


      #3
      Wow that is a lot to take in and I am not that smart anymore. lol
      I still have the option of going back to my Trailing stop. Its easier.

      But I think the simplest option is to work on fixing up my ATM strategy.
      I've recently discovered that the ATM does actually work well and is very handy!
      I just need to figure out the correct settings. Thanks Mr Paul!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      135 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X