Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Trade Restriction for Certain Time Period After Stopping Out
First post here! I am trying to write a piece of EasyLanguage code intended for risk mitigation in my automated strategy, and I'm stumped. What I'm trying to do is: If a stop order is executed, I would like to have a "blackout period" during which no trade entries in that same direction will be made.
For example, say I am using a 15-min chart and my strategy is long 3 ES contracts. Then, the price drops and triggers my stop loss order for the 3 contracts, so I am now flat. I would like the strategy to not be permitted to enter into any new long positions for the next hour.
I think the best way to do this would be to have a condition that evaluates to "true" if the strategy has been stopped out of a long trade in the past hour, and have the "new orders" command be conditional on that condition being "false".
However, I have not been able to figure out a way to check if a stop order has been triggered in the past hour (and if there is a way to determine this, how to differentiate between a "sell" stop order and a "buy to cover" stop order).
Please let me know if you have encountered a similar problem before or know of a solution.
Thank you!
el oso
Can you help answer these questions from other members on NexusFi?
sorry for the confusion, I wasn't interested in your whole strategy, only the part you did so far for the feature you are asking for.
I would try something along the lines of this:
- use a boolean variable that you check before you enter long (something like "newLongsAllowed" for example)
- when the market position changes from long to short/flat, check if the trade was a loser and was exited at your stop price
- if this is the case set the variable newLongsAllowed to false and store the time of the bar in a second variable
- the last thing to do is check if the time of the current bar is later than the stored time + 1 hour
- at that moment you set the newLongsAllowed back to true so the system can take a new long entry
Thank you, ABCTG! This is very helpful, and I will try it out. Yeah, I had not written any code yet for this feature, as I was not sure where to start / what is possible, so this is what I was looking for.