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 recently wrote a bit of code which purpose is to calculate Intraday-Turnover no matter what resolution you're looking at. The results:
The code calculates the intraday value of all contracts which was sold and resets until the next day, and it seems to work fine.
Out of curiosity and learning, I wanted to make an array which stored the Close of the last bar of each day, no matter the resolution. I figured that since I've got some code that already figures out when the next day comes, this shouldn't be a problem.
New Code:
And now the results are completely different. As soon as I try to assign any variable to "Close[currentbar]", the rest of my code stop working properly. How come this is? It's driving me nuts. I know I can use different data series, but for this experiment I'm trying to fit it into the same.
All the best,
TahuPhoenix
Can you help answer these questions from other members on NexusFi?
when you index a reserved word or variable to get the value from X bars back the values start from the current bar and go up. Currentbar = 0, 1 = the bar on the left from the currentbar etc.
With Close[CurrentBar] you are likely trying to look at a bar that is not even accessible. Assume you are at CurrentBar = 100, with Close[100] you try to access the 100th bar left from the current bar. Which means you'd need 101 bars on the chart, but only have 100 at current bar 100.
Long story short you have to use Close[0] to get the current close at the moment of the code calculation.