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)
Once the for loop is done it basically repeats the entire process starting again at the top doing calculations but this time for the next bar correct?
Because since this is on autoloop it will cycle through every single candle until it has hit the array end. So it will perform the bool calcualtion for index 5 then it will do it for index 6 then 7 then 8 etc etc correct?
So why would i want to propagate values backwards when the calculation is going to be done anyways?
Can you help answer these questions from other members on NexusFi?
No, you only get called for each historical bar once when you start up (i.e. you will be called once for each bar 0, 1, 2, ..., last bar). You then get called for each update to the current bar (i.e. 138, 138, 138, 138, ... 139, ....). Again, I do not know the intent or that loop, but it is getting copied back one for the calc on next bar, perhaps the second copy is for visual effect?
So this part of the code gets called on startup and is run through each bar (first bar to the right up to the last bar on the left) or to put it in code terms from sc.currentindex all the way to the left of the chart to sc.ArraySize-1
And once that is done it is called once for each currentbar update, or in other terms everytime the sc.index/sc.currentindex changes or gets a new value?
Yes, at startup it would be called once with sc.Index set to 0 .. sc.ArraySize-1 (in that order). Then it would only be called with sc.Index set to the current bar index (updates to current bar or a new bar gets started) This is how autoloop works.
I have made some modifications to the code, after i finally was able to understand why @vegasfoster was using that for loop (thanks again btw for answering all those pesky pm's)
I decided to play around with the code a bit. So here is basically why vegas was using the for loop:
Basically it is necessary to make sure the horizontal line is exactly where i want it to be.
Now i have modified the code to the following and basically made it much simpler:
Basically all it does is for every iteration that is happening during autoloop being on, it checks if the bool value is true, and if it is it draws it at index-2 with the value of sc.low that is located at index-2.
All fine and dandy and working except for this:
The horizontal line is quite short...
So my questions are
1) Any criticism on the code? Weaknesses from a logic perspective? 2) Any idea how to make that horizontal line longer?
EDIT: Yeah nvm i think i see it now, thats pretty much what the ternary operator did... god damnit, im trying to put this into the "Else" part of the If statement, will update my code into here as i work along and figure stuff out, perhaps it may help someone when they are working on developing their custom study