Welcome to NexusFi: the best trading community on the planet, with over 200,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 -- discounts are available after registering.
-- The NexusFi team
(If you already have an account, login at the top of the page)
I'm a beginner who's studying a lot to learn how to use tradestation platform to code an automated strategy for Futures Contracts.
I need your help in order to create a simple easylanguage code to set a "trigger bar" (with some very basic given characteristics) where, referring to next bars starting from this "trigger bar", the strategy goes long (1 contract) when the current price overcome the "trigger bar" High, and goes short (1 contract) when the current price overcome the "trigger bar" Low value up until a new "trigger bar" is identified.
Could anyone please help by sending me a code example for doing this? I'm really struggling with it...
Thanks a lot!
Can you help answer these questions from other members on NexusFi?
first of all I would like to thank you very much for your very appreciated reply and and for your try to help me in coding my idea.
I try to be more clear as I can imagine my previous message was a little bit confusing...
The "trigger bar" is a bar that satisfy some given conditions. The "trigger bar" has two trigger points (Bar High and Bar Low).
What I need to code is, referring to following bars starting from the identified one, a buy order (1 contract) when the current price violate the High value of the "trigger bar", and a short order (1 contract) when the current price violate the Low value of the "trigger bar".
This mechanism must be in place until a new "trigger bar" is identified, and do do the same for the following bars.
Basically the system should store my trigger points (high and low of the "trigger bar") and overwrite them when a new trigger bar is identified and do the same again and again.
Please take a look to the attached drawing which I believe can better clarify my point.
If a certain bar satisfy some conditions this will be the first "trigger bar". What I need to do is write a code that store the High and the Low value of this trigger bar and send orders to market for buying and selling not only fore next bar, but also for all the following bars until a new "trigger bar" is identified (you can see also from the pictures I sent you).
MP is always =1 or -1.
going back to your question:
for buy, what i understand is it will buy whenever it break the trigger bar high, but when you have position when do you sell?
The system should sell when the low of a trigger bar is violated. It will never be MP=2 or MP=-2. If a double long or short signal is received it will stay in the position.