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:	232
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 NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      64 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      139 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      75 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      50 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X