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)
Hopefully someone can help me out of this.
In the following code opening a long position if the current price is higher than the previous candle's High.
Then I set a profit target, and a stop loss. The profit target is static, so that works fine, but the stop loss is variable. I have set it to look for the lowest price of the last 5 candles, and set that as a stop loss. However, in my code, what it does is that it sets the stop loss based on the lowest price of the 5 candles before the trade candle, and fixes it at that value.
I want the stop to keep on moving with each candle, i-e, after each candle, it evaluates the lowest value of the last 5 candles and sets the stop as that....
Any ideas on what Im missing, or what I need to add to the following code to achieve that?