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)
I create the following code (see below), but my stop loss doesnt seem to work at some instances (both for the "stop l" and the "Stop&rev 1". Any idea why?
Thanks!
Can you help answer these questions from other members on NexusFi?
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,049 since Dec 2013
Thanks Given: 4,386
Thanks Received: 10,207
Not an expert, but I will point out that Tradestation runs code at the end of the bar, for action on the next bar. Since your stops are dependent upon you having a position (you use marketposition to check this) the bar that you enter your position, you will have no stop for that bar as marketposition was different at end of the previous bar. You can get around this by creating your own tracker variable to monitor your position and when you create a new order, update the variable.
It's possible the Entryprice(1) is the culprit. Entryprice(0) is your current position entry. Entryprice(1) is your previous position. Looks like most of the logic is expecting more than one bar to hit stops or targets so you may not need intrabar order generation but that may be a good thing to check if you are expecting some fills in the same bar. I can see that being detrimental to this strategy though.