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)
you need to either store the stop price when you compute the buy limit price and make sure it doesn't get updated any more while you are in a position. Something like this should work for you.
These values can update while you are either short of flat and as soon as you are long the values can't change anymore.
what does your code do, that you think you are missing something?
One thing I noticed is that your stop order is a limit order. As limit orders are executed at this price or better, a limit order to sell below the current market price will be filled right away.
when starting out with learning EasyLanguage or PowerLanguage (or any other language for that matter) I would suggest not to jump into something complex like strategy development right away. Start with the basics and move forward step by step.
Regarding your code, the compiler points you to the issues and gives an idea about the solution in the Output tab. I don't have a function called AverageTrueRange within my PL Editor. This is the first error I am running into, so for the code to compile on my end this needs to be changed to the default AvgTrueRange function.
The next thing is that your limit order for the stop can't be used with the phrase "this bar" - the error message "'This bar' can only be used in close orders.", points you toward this. So you need to change it to "next bar" and for the order to be a stop order use "stop" instead of "limit". Change this and the code will compile fine.
Yes you are right, I should not dig in to this!
But as I say this is my first signal and I did not realize how hard it was!!
I thought it was only couple of lines for this simple strategy, but I was wrong there.
Maybe I should give the code to a professional EL programmer, but then I had not learned anything.
At the moment the strategy is working with the StopLoss function, just a minor adjustments on the entry price. It is little bit to high.
You are welcome. I have learned a lot from other coders when I started out, so a proper commented and written code by someone else can still help you making a lot of progress in your learning.
Forums are also a great source when you can get help with coding problems.