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 am a non-programmer and am trying to understand the logic behind a portion of NT code from a VSA (VPA) indicator that has been posted on nexusfi.com (formerly BMT).
Is this considered it be an "If Then" statement? So IF the Close minus the Low was equal to zero, we would then use the (spread[0] / (Close[0] - Low[0]) to define x1?
At the same time, if the Close minus the Low does not equal zero, do we use the Close minus Low value then to define x1?
Thanks to sam028 who converted the prester´s vpa indicator to NT7b20
BTR
If you can keep your wits about you while all others are losing theirs, and blaming you....The world will be yours and everything in it, what's more, you'll be a man, my son. - Kipling
Can you help answer these questions from other members on NexusFi?
x1 = (Close[0] - Low[0] == 0.00 THEN USE THE avgSpread; ELSE USE (spread[0] / (Close[0] - Low[0])));
Is this correct?
If you can keep your wits about you while all others are losing theirs, and blaming you....The world will be yours and everything in it, what's more, you'll be a man, my son. - Kipling
But at the same time that line of code does not seem to make sense.
Let me explain why there is a problem.
Standard case (bar closes above the low): x1 holds a ratio > 1
Special case (shaven bottom, bar closes at the low): x1 holds the average spread
For example if you look at a 1 min chart for crude oil, the average spread of a few bars could be 0.05, that is much lower than the number used for the ratio, which is always larger than 1.
On the other hand, if you take a daily chart for YM, the average spread could we 200 points, much more than the ratio.
I think that there is a logical problem, as the values do have the same dimension.
Harry ,I see your point. I checked the Amibroker code that the NT version was developed from and the logic appears to be the same.
x1 is being used to determine where the close is in relation to the rest of the candle (clearly there are other ways to go about doing this). So following the line where x1 was defined, we have the following:
Again, to a layman, I would think it is simpler to define the where the close is in relation to the rest of the candle using a percentage of the range. For example, a close in the top 30% of the range would be an up close bar, close in the lower 30% of the range is a down close bar, etc.
Any thoughts?
If you can keep your wits about you while all others are losing theirs, and blaming you....The world will be yours and everything in it, what's more, you'll be a man, my son. - Kipling
If the bar closes 1 tick above the low, you would have x1 = Range[0]/TickSize, which is a pretty high value. If the bar closes at the bottom, a higher value should be selected. The indicator as it coded does not correctly address this problem.
If I had to code that indicator, I would replace the range with the extended tick range.
Range -> replace with -> 1 + (high-low)/ticksize
close - low -> replace with -> 1 + (close - low) / ticksize
Both are integer numbers. If you follow this idea, you get the folloing value
bar closes at the high: (x1 = 1)
bar closes at the midpoint: (x1 = 2)
bar closes at the low: (x1 = 1 + (high-low) / ticksize)
In that case the minimum value for the ratio is 1 (as expected) and the maximum value depends on the range of the bar.
The logic as shown in the NinjaTrader code seems to be flawed, as it does not offer an appropriate solution for the case where the bar closes at its low.
Thanks FatTails and Cory for all the input and help with this
If you can keep your wits about you while all others are losing theirs, and blaming you....The world will be yours and everything in it, what's more, you'll be a man, my son. - Kipling