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)
In my continuing efforts to learn Thinkscript, I have cobbled together my first "Hello World"-type script. This script is in response to my wanting to efficiently condense multiple moving average studies/settings/property pages into one single "dashboard", so to speak...
Rather than try to describe what I have tried to accomplish, below is the code and "dashboard" for any/all to review:
While the script basically works, I have one outstanding issue. I think the lookback is associated with longest SMA length, in this case 200 bars, so charts with fewer than 200 bars will be drawn without any SMAs. Is there a solution/workaround?
Comments/modifications are certainly welcome
Can you help answer these questions from other members on NexusFi?
As a result of further research, I scrapped my original code. I came across TOS' MovAvgTwoLines study, which simply plots two MAs on a chart, with only the length parameter available for individual customization. The AverageType also offers a degree of flexibility/customization, but it applies to both MAs globally.
I wanted to have all the MAs (whether it be 2 or, in my case, 5) be individually customizable with the customizability available from one settings/property page. Now, using the new script below, I can have 5 MAs plotted with different price calculations, different lengths, different displacements and different average types.
At least now I can access all the MAs on my chart from one centralized "dashboard" or settings/property page, as opposed to keeping track of 5 different applied MA studies. Nothing major, to be sure, but nice from a learning perspective...
While it feels good to create something useful, I came across an issue using the new study. When I plot the study in some cases, it doesn't draw the study to the left edge of the chart. See the sample below:
AAPL 180 d 4h
In my prior post, I speculated about this:
I further thought this may have been a problem with the original code, but it is happening with new code as well. I'm stumped and hoping someone might have an insight or solution to this dilemma...