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'm still rather new to EasyLanguage and for a strategy I'm developing, I'm trying to figure out how I can keep track of the lowest tick (lowest price) since I entered a position.
I tried the following:
HTML Code:
Variables:
Intrabarpersist LowestPrice(0);
LowestPrice = EntryPrice; // since the initial lowest price is the price of your entry, that's stored in the variable
If Close < LowestPrice Then
LowestPrice = Close;
However, this only works as long as Close < Close[1]. That is, the lowest price is set to equal the Close price when it's higher than Close[1] but lower than EntryPrice. I think that I understand that what goes wrong is that at each tick/bar the code is executed again and the code only looks at whether Close < EntryPrice, not at whether Close < All previous Closes since entry.
Any ideas about how to do this?
Thanks!
Can you help answer these questions from other members on NexusFi?
Thanks for your reply, numberjuani. I'd tried this before however, and I always get an error telling me that it is trying to reference too many bars back. Or am I missing something?
Thanks again for your reply, numberjuani. Your solution does solve the error. However, the value is reset every time the maxbarsback is reached. I could increase that max, of course, but it seems to me that there has to be another way that isn't dependent on an arbitrary setting.
keep in mind the information you are looking for is in the performance report already, called run up/drawdown, also you have maxpositionloss as a reserved keyword in there. unless I know what you are trying to do, cant be of any more help
Im just quickly seeing this I'll go back later and read whole post but off the top of my head you just need to set MaxBarsBack MUCH farther. Either in the Tradestation settings or deliberately in your code. Its because your variables are trying to call too far back and theres no info there. Sorry if this is not what you need. I'll look at full post abit later.
Hi Sandpaddict, thanks for your reply. I tried that as well, but if I set the MaxBarsBack too high the strategy doesn't execute. When I read about the reserved word MaxBarsBack in the EasyLanguage reference, I don't really understand why, though.