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'm working on converting the NinjaTrader VPA indicator (found in the downloads section) to ThinkorSwim. I'm still at the beginning stages right now and I'm starting this thread so the readers here can keep me honest
Included are 2 screen shots of GDX with the indicator in ToS and NT. There are some differences in that the NT version is showing some items the ToS version is not and vice versa it seems. I hope to iron out the differences in the following days.
ToS can't draw some of the symbols the same way NT can. For example, a diamond symbol does not exist (as of this post) in ToS, so I am resorting to just using a circle. Downward pointing triangles are not supported in ToS either, so this indicator will use the upward pointing triangle. These differences will be noted in this thread.
My first objective is to get the conditions correct on displaying the symbols on the bars so that the ToS version matches the NT version. Second, I will create the volume histogram with the colored bars to match. Third, I will attempt to document as much as possible the differences between the two and note any caveats.
The ToS study has been added here, but the file extension has been changed to .txt. If you want to import it to ToS, then you have to either rename the extension to .ts and import it or copy the content of the file into a new ToS study.
Regards,
-C
“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
While I was comparing the ToS and NT VSA indicators that I posted earlier, I was looking at the test for no supply. In the NT version for GDX, 9/28 is a no supply bar, but not on the ToS chart for the same instrument and date. I traced this back to the results for computing the isNarrowSpreadBar which is defined as this in the NT version:
The reason for the difference in the ToS version is that the results for the avgSpread is not equal to the NT computation which could lead to different values when computing the no supply test. ToS has a built in WildersAverage function which is what I used. The NT version has a provided Wilders indicator and it has no author on it. This is the meat of the code from that indicator:
Googling, I found this definition of wilders ma:
Wilder's Current Day Moving Average = (Previous Day Wilder's Moving Average * (n-1) + Current Day Price)/n
So the Wilders indicator that comes with VPA is not correct. It should be something like this:
This is the code that I think should be used for the NT Wilders indicator:
I did some comparison between the values of plotting the spread using the wilders average on both ToS and NT. For the first 60 bars or so, the values differ but that difference decreases. I'm not sure why that is. Maybe something in the way I wrote the indicator? After those 60 bars, there is no difference to within 2 decimal places.
At this point, I don't know the authors original intention. Did they mean to use Wilders average and incorrectly implement the indicator? Or was this intentional? If the former, then the version in the download section is incorrect and, I think, the above patch should be what is needed. The downside is that it *could* give false signals as what I am suspecting is the reason for the difference between the ToS and NT version that I mentioned before (not counting my code errors ).
My expectation that someone with authority on this subject chiming in here is pretty slim and my knowledge of the VSA algorithm is limited. That being said, I am proceeding with the assumption that the Wilders average (as defined by Wilder) is to be used so future NT charts in this thread will be based on the revised indicator.
If you are using NT's VPA indicator, I hope you take this under advisement.
Anyways, I will post more charts for comparison and iron out more issues.
Regards,
-C
“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
In the Wilder function, the first element computed is the SMA on the given data series. However, the first condition of the OnBarUpdate() says that if the current bar is less than volumeEmaAve, then exit. Let's assume that volumeEmaAve = 10. So when CurrentBar == 10, the first value of the spread is set and the SMA for the part of Wilders indicator is calculated on the spread. Right? So the SMA on 10 bars of data is
Sum(High[n] - Low[n])/10 for n = 0..9
Right? But only 1 value of the spread data series is set because of the first condition. So that sum is just
(High[0] - Low[0])/10
This creates incorrect computed values for the average spread.
To get the correct sum of the spread for the first 10 bars, the spread data series must be set for bars 1..9. The following code will set the spread then perform the condition:
Now the SMA on the Wilders algorithm is correctly computed.
Be careful with that C# code!
Regards,
-C
“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
If I can put in my two cents, I would suggest you take a step back and think what you want to accomplish.
VSA is based on a few simple concepts, like No Demand, No Supply, Tests, Thrusts, etc. The VSA Ninja Indicator is just one author's interpretation of mathematically defining these concepts.
If your goal is to assume that the author of the NinjaTrader's VSA interpretation is "correct" and try to match it exactly, then it is important to port his code exactly.
On the other hand, VSA is not a mechanical system and should not be treated as such. I think this more important to understand the concepts and once you do, this really doesn't matter what kind of moving average you use to define the average range as long as you do it in a consistent way. There is no way to say one is better than the other.
The goal is to have a usable ToS version based on the NT version of what I think the author's intentions are. I am detailing this process so others can benefit from this conversion and hopefully 1) gain an understanding of how complex coding can be, and 2) don't assume any indicator does what they think it actually does.
My assumption is with the intention of what the author means, not blindly porting the indicator line for line. If that means corrections and improvements can be proposed back into the NT version, then I think I have accomplished something. I have been pointing out "issues" with the NT version for the purpose of learning and to make others aware that the implementation may produce false signals based on that implementation. While VSA is not a mechanical system, it does act as a guide for the user to make informed decisions.
Making observations and proposing corrections in this sense is analogous to getting a car mechanic to inspect your Prius. If you assume that the brakes on your Prius work well for you, then there's no need to have someone double check Toyota's work.
Regards,
-C
“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
In the variables section in the NT version, narrowSpreadFactor is defined as a double with a value 0.7:
However, the Properties section reassigns these values to have a minimum of 1:
For example, when this indicator is added to a chart, narrowSpreadFactor is set to 1 and not the default of 0.7. ultraHighVolfactor and aboveAvgVolfactor have minimum property values of 1, but these have a default of 2 and 1.5, respectively.
If you want to use the default values, then I suggest you set the above three to have a minimum of 0 in the properties section.
Regards,
-C
“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Sorry I have not posted much lately. I've been busy with other things.
With the changes in the NT version I mentioned in the previous postings, I am now able to match both.
I have a new version of the VSA study for ThinkorSwim. This version has the input parameters for the scaling factors as well as paint bar colors by trend (see the screen shot). I also added code to hide the titles for each plot since that can get very messy and not really convey any useful information.
(Please remember that the attached ToS study is a .txt file. If you want to import it into ToS, you need to change the extension to .ts or copy the content of the file into a new ToS study.)
ToS has some rudimentary text plotting functions that I plan on using for matching with some of the banners on the NT version. I'm not sure how this will work out, but I'll try to get something useful in the coming days. I plan on making the volume plot at some point as well.
Regards,
-C
“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu