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)
How to program price cross below a number of previous bars
I am using the strategy wizard to build a couple of strategies, but I am struggling to do something quite simple.
What I want to do is the following: When the close of a bar is below the price of the previous x number of bars. So basically just a simple break the a low of a period.
I have tried using the "crossbelow" option with with various price options as both the data sets, and then the lookback period value of the number of bars i want the range to be within... no go. I have tried various other methods also, can't seem to get it working. It seems like such a simple thing...
Any help would be most appreciated.
Cheers
Can you help answer these questions from other members on NexusFi?
I guess the easiest (and crude) way would be to simply reference the low of the previous bar...
if close < low[1] then ......
And if you wanted 2 bars....just add an and statement with low[2]
so forth and so on.....
I'm sure there's some geek type that can craft a more elegant way to use an input to specify the number of bars you desire and have the code reflect that......
This condition is equivalent to Low[0] < DonchianChannel.Lower(n)[1], but the question was about the close. So this would be a better match for what @Twiddle asked for: