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)
not to enter a position if the previous position was closed in a stop loss
Hello, I use EasyLanguage as my programming code with TradeStation. I'm having trouble telling the code not to enter a position if the previous position was closed in a stop loss. Does anyone have any suggestions? Thank you
Can you help answer these questions from other members on NexusFi?
It would help if you would provide a little more information about exactly what you want to do. Are you day-trading and want to experience no more than one losing trade per day?
Or do you have something else in mind? If you are day-trading, do you ever exit a trade at a loss before the end-of-session without being stopped out?
it shows a simple approach to "wait a while after losing trade" and see if this is is what you are looking for. At tleast this may point you in the right direction.
Other good sources can be the tradestation forums (in case have not tried that already...) and the Easy Language Mastery Website: https://easylanguagemastery.com/. You can get good code scripts from both sites for free.
As the first entry, I write the exact date. For example, if I'm conducting a 3-year backtest, I specify the day: If marketposition=0 and time=time_ and date=dateexactly, then buy next bar at market.
For the second entry to continue the strategy: If marketposition=0 and time=time_ and entryprice(1)<exitprice(1), then buy next bar at market.
The issue now is that I want to instruct the code that, by writing the first two lines, it should continue entering a position only if the previous position was profitable. It should stop after the first stop loss. I would like to add a condition to continue entering positions only if I achieve a take profit (TP). In this case, after the first stop loss, I would be back in a position, but I would start counting from the next one.