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)
So I've been programming with EASY/POWERlanguage for about 13 years now. And I'm not too proud to say that I'm not a "know-it-all" nor do I pretend to know everything there is to know. With that said, I'm in the process of coding a strategy that adds contracts and takes off contracts during a trade. While thinking of how to do this, I decided to actually look up the keyword "SELL" in the reference guide. In there, I found the following example:
Completely exit from the long position established by the entry labeled "Original
Entry", at Market price on open of next bar:
Sell From Entry("Original Entry")Next Bar At Open;
Sell 10 shares of the long position established by the entry labeled "Original
Entry", at Market price on open of next bar:
Sell Entry("Original Entry")10 Shares Next Bar At Market;
I found this useful but perplexing at the same time. So I must ask the community for clarity. Let's say I put in code that will Buy 20 contracts once the signal tests are met and I call that trade "Original Entry" Then, while that position is open, the strat identifies another condition and buys another 10 contracts that is labeled "Second Position". So now there is a total of 30 contracts open (20 under the label "Original Entry" and 10 under the label "Second Position".) Is MC's example in the reference guide saying that if I want to close all or some of only the contracts in the "Original Entry" position, it will do it with the examples shown? Please confirm.
Also, if the strategy has used this label in prior positions but are now closed out, is this a problem? In other words, can I assume it will only consider the open trades and nothing already closed out?
Thanks for the help.
Can you help answer these questions from other members on NexusFi?
an exit tied to a specific entry name will only close shares/lots/contracts from entries with that name. If nothing is left to close from that entry it would not affect differently named entries.
In case you have multiple entries open that share the same name an exit like you wrote below would be applied to all entries with the same name. Using the "Total" reserved word in an exit allows you to change that default behavior.
This is a good topic for testing various scenarios on a chart as this should clarify all your questions and show you how you can control the behavior of exits.