Registered User Joined: 2/11/2006 Posts: 3
|
does anyone know how to set up bill williams "alligator" in the chart template?
mbuff
|
|
Registered User Joined: 1/28/2005 Posts: 6,049
|
Thats displaced 5/8/13 exp mavs.
I think.
Do you know how far they are offset?
Thanks diceman
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
My research would seem to indicate the Moving Averages used are not Exponential and are actually Smoothed Moving Averages (SMMA). The indicator appears to be a 13-Period SMMA shifted right by 8, an 8-Period SMMA shifted right by 5 and a 5-Period SMMA shifted right by 3. These Moving Averages seem to be applied to the Median Price instead of the Closing Price.
Since Smoothed Moving Averages are not built into TeleChart, the best way to do this might be to use TeleChart's data in SnapSheets. You will need to install SnapSheets and will probably wish to review the SnapSheets Tutorial Videos before proceeding:
SnapSheets Website
I didn't find Blocks in SnapSheets for a Smoothed Moving Average or for shifting a Plot. I suspect both could be implemented using existing Blocks, but creating two custom Line and Int to Line Code Blocks seemed simpler to me. I called these Code Blocks Moving Average Smoothed and Shifted Line Plot (the shifts before or after the time of the existing Plot are rather crude) but you can use any name you want. If the Code Block name has spaces, make sure the name listed after Public Class does not. You can delete the spaces or replace them with another character (I used underscores).
In the Moving Average Smoothed Code Block, replace:
'************ Your Code Here ***************
With:
Dim period As Integer = Me.CodeBlock.ParameterValue Dim count As Integer = Me.CodeBlock.InputCount If count >= period Dim sum As Double = 0 Dim average As Double = 0 For bar As Integer = 0 To period-1 sum = sum + Me.CodeBlock.InputValue(bar) Next average = sum / period Me.CodeBlock.AddToOutput(Me.CodeBlock.InputDate(period-1),average) If count > period For bar As Integer = period To count - 1 sum = sum - average + Me.CodeBlock.InputValue(bar) average = sum / period Me.CodeBlock.AddToOutput(Me.CodeBlock.InputDate(bar),average) Next End If End If
In the Shifted Line Plot Code Block, replace:
'************ Your Code Here ***************
With:
Dim first As Integer = System.Math.Max(0,ParameterValue) Dim last As Integer = System.Math.Min(InputCount-1,InputCount+ParameterValue-1) Dim interval As Long = Microsoft.VisualBasic.DateAndTime.DateDiff(microsoft.VisualBasic.DateInterval.Minute,InputDate(0),InputDate(InputCount-1)) / InputCount If ParameterValue < 0 For bar As Integer = first+ParameterValue To first-1 AddToOutput(Microsoft.VisualBasic.DateAndTime.DateAdd(microsoft.VisualBasic.DateInterval.Minute,(bar-first)*interval,InputDate(first)),InputValue(bar-ParameterValue)) Next End If If System.Math.Abs(InputCount) > ParameterValue For bar As Integer = first To last Me.CodeBlock.AddToOutput(Me.CodeBlock.InputDate(bar),Me.CodeBlock.InputValue(bar-ParameterValue)) Next End If If ParameterValue > 0 For bar As Integer = last+1 To last+ParameterValue AddToOutput(Microsoft.VisualBasic.DateAndTime.DateAdd(microsoft.VisualBasic.DateInterval.Minute,(bar-last)*interval,InputDate(last)),InputValue(bar-ParameterValue)) Next End If
You can then create a Chart Snap-In Tool with the Alligator's Jaw, Teeth and Lips (they should all be on the same Scale and you might wish to add and scale with a Price Plot as well). The Jaw is a 13-Period SMMA shifted right 8-Periods. Here's a Block Diagram using an existing Price Chart as input. The Blocks labeled High and Low are Convert: Bar to Number Blocks. Double-click them to change them from Last after you've added the Convert: Bar to Number Blocks:
To create the Teeth and Lips, copy and paste the Jaw Plot, adjust the periods, change the colors and rename. For the Teeth, the Moving Average Smoothed Block Period is 8 and the Shift Line Plot Period is 5. For the Lips, the Moving Average Smoothed Block Period is 5 and the Shift Line Plot Period is 3.
The Alligator also has an Oscillator plotted in another pane. While the result is a single indicator, it is actually two plots on the same scale. Each plot has the Style set to Bar. Here are the Block Diagrams:
The result should look something like this:
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You may wish to review the previous post about creating the Alligator indicators before creating these additional Bill Williams designed indicators that have also been requested. The Awesome Oscillator (AO) and Accelerator/Decelerator Oscillator (AC) should be plotted with the Style set to Bar. Here are the Block Diagrams. The Blocks labeled High and Low are Convert: Bar to Number Blocks. Double-click them to change them from Last after you've added the Convert: Bar to Number Blocks:
Awesome Oscillator (AO):
Acceleration/Deceleration (AC):
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
Ugh! Is there no hope for this old man!! On 16Aug you said >In the Moving Average Smoothed Code Block, replace: etc, etc.
Already I've forgotten where to start building that code block. My old mind isn't what it used to be
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
alindsley,
If the problem is with creating the Custom Code Block, I would review the following videos on creating Custom Code Blocks and then try it again:
Hello World! Writing Code Blocks for SnapSheets in Visual Basic.NET
VB.Net (code block) to color down Monday red
VB.net exercise to access Quickedit from your codeblock
Creating a True Range Block
If you wish to try creating some of Bill Williams' other indicators, you may also wish to review the following:
Bill Williams Gator Oscillator
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
Thanks Bruce. I knew you would steer me in the right directions
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
I'm beginning to see what you were saying Bruce. Each word in your sentences are so packed full of meaning I just have to learn how to read your instructions closer.
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
Finished with all 3 Alligator, AO, & AC. Turned out super. ******************************************* BTW! Is it possible to change the colors of a 4dsma line as it crosses up through the 9dsma from white to green as it crosses up (Not necessarily on the alligator chart I just created only but on another also)?
To change colors once again as the 4d crosses back down through the 9dsma?
I'd also like to increase the thickness of these two ma's a little also if possible.
TIA!!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
alindsley, I'm happy to read it worked for you. I don't know how to adjust the width, but you may wish to try creating the following Block Diagram to experiment with changing a Plot Color:
The 4 Block is a Parameter: Whole Number Block. The red and green Color Blocks are Parameter: Color Blocks. Double left-click these Blocks once they are added to adjust them.
The Bar Chart Price History Block is the Indicator being Averaged. The Bar Chart Moving Average Block is the 9-Period Simple Moving Average Plot. You can left-click on the Input and drag to the appropriate Legend (plot name) to add these.
The Above Block has two Date & Number Inputs. If Input1 is Above Input2, the True Color will be displayed. If Input1 is below or equal to Input 2, the False Color will be displayed.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/28/2005 Posts: 825
|
Dog-gone if that didn't work great! That was fun!!
If you ever figure out how to change the thickness of the lines let us know please. I suspect that might make it a little easier to view.
thanks again.
|
|
Registered User Joined: 12/13/2006 Posts: 14
|
Hi, I tried to create a custom block in Blocks to paste in the code for the alligator and was unable to see "my custom block" as the video described how to do it. The code is also different than what is in this thread. Can you help me create and find my custom block. It states no diagram when I try to open it from the directory. Thanks, Riptide
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
riptide681, The code in Hello World! Writing Code Blocks for SnapSheets in Visual Basic.NET and Creating a True Range Block are different than what is in this topic because they are for different things. You pretty much just need to copy and paste the code from the forums into the Code Block.
When you go to look at your Custom Code Block again, it will be blank. You will need to use the Open Code Block Icon (folder) to view your code.
You may wish to review the following:
Alligator Oscillator
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
I would like to add all of Bill Williams indicators to my Blocks program, but I am completely green when it comes to using the program. Ive had the program for months and have not figured out how to use it. I keep going back to tc2000. Is there anyway I can cut and paste the info above into blocks? Any advice on what my next step should be?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
wtheis03,
Alligator Oscillator has a completed Workspace where the indicators have already been created.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
Thanks Bruce. I downloaded the bworks document and it looks great. According to the book, the three lines s/b offset 8 bars into the future, which I would like to do. I read one of your earlier post and it seems that you gave instructions on how to do that. The problem for me is that I have no experience with changing code. Its like looking at a foriegn language.I called the phone tech support to see if they could walk me thru it, but was told they dont know how to do it either. Is there any chance you can update the bworks file with the offset?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
wtheis03,
I can't just upload the Workspace and have it work. The Shifted Line Plot Custom Code Block contained in my Wednesday, August 16, 2006 5:24:00 PM ET post (or something similar) is absolutely required to offset the bars into the future. Please start by creating the following Code Block as Line and Int to Line (please keep in mind I'm not a programmer):
Shifted Line Plot:
Replace everything in the Code Block with (Firefox seems to work for copy and paste, IE does not):
<WBIGuid("0de27d64-9cc5-4a79-845f-cc4756764ce6"),FriendlyName("Shifted Line Plot")> _
Public Class Shifted_Line_Plot
inherits BaseTemplateDLStoDLSPeriod
Public Overrides Sub calculate()
Dim first As Integer = System.Math.Max(0,ParameterValue)
Dim last As Integer = System.Math.Min(InputCount-1,InputCount+ParameterValue-1)
Dim interval As Long = Microsoft.VisualBasic.DateAndTime.DateDiff(microsoft.VisualBasic.DateInterval.Minute,InputDate(0),InputDate(InputCount-1)) / InputCount
If ParameterValue < 0
For bar As Integer = first+ParameterValue To first-1
AddToOutput(Microsoft.VisualBasic.DateAndTime.DateAdd(microsoft.VisualBasic.DateInterval.Minute,(bar-first)*interval,InputDate(first)),InputValue(bar-ParameterValue))
Next
End If
If System.Math.Abs(InputCount) > ParameterValue
For bar As Integer = first To last
AddToOutput(InputDate(bar),InputValue(bar-ParameterValue))
Next
End If
If ParameterValue > 0
For bar As Integer = last+1 To last+ParameterValue
AddToOutput(Microsoft.VisualBasic.DateAndTime.DateAdd(microsoft.VisualBasic.DateInterval.Minute,(bar-last)*interval,InputDate(last)),InputValue(bar-ParameterValue))
Next
End If
End Sub
End Class
You may wish to review the following for help with creating Custom Code Blocks:
VB.Net (code block) to color down Monday red
VB.net exercise to access Quickedit from your codeblock
Hello World! Writing Code Blocks in Visual Basic .Net
Once you have created the Custom Code Block, you can save the attached .bWorks file to the following folder:
\My Documents\Blocks Files\Workspaces
You can then open the Workspace via your FILE menu (Open Workspace then My Computer).Attachments: Bill Williams Shifted Line.bWorks - 100 KB, downloaded 741 time(s).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
I completely messed up. Originally I downloaded bworks from (Thursday, May 31, 2007 9:59:32 PM ). It had all three Bill Williams indicators. It looked great. Then I tried to use your directions from (Tuesday, December 18, 2007 2:04:09 PM ). Long story short, I couldnt figure it out. I lost the original bworks. When I went back to download it again and start over, it was not the same download. It keeps showing the second download with only one indicator. Any help you can give me would be greatly appreciated. Im frustrated and on the verge of giving up and switching to another product. Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
wtheis03,
They are definetely two different Workspaces with two different file names, I re-downloaded them to make sure they didn't somehow get mixed together. Please make sure you are loading the Bill Williams Workspace and not the Bill Williams Shifted Line Workspace. The Bill Williams Workspace doesn't use the Shifted Line Plot Block, it uses Bar Offset Blocks instead.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
something must be wrong on my end. I downloaded it again and have the same shifted line screen from the second bworks download.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
wtheis03,
Let me try two things. First, I'll attach a copy to this topic instead of the Alligator Oscillator topic. Then I'll make sure somebody else on our end can get the copy to work.
Please save the attached .bWorks file to the following folder:
\My Documents\Blocks Files\Workspaces
You can then open the Workspace via your FILE menu (Open Workspace then My Computer).Attachments: Bill Williams.bWorks - 98 KB, downloaded 727 time(s).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
Yesss. It worked that time. Thank you. Now, am I able to into the code editor and change it from bar offset block to shifted line block???
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
wtheis03,
After what happened the last time, I don't think that would be a good idea. You would be better off trying to create the Shifted Line Plot Block using the instructions in my Tuesday, December 18, 2007 2:04:09 PM ET post and then re-downloading the Bill Williams Shifted Line Workspace that is attached to that post. Make sure you are creating the Custom Code Block first.
That way you have a functional Workspace to use if your Shifter Line Plot Custom Code Block Block doesn't work.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
Ok, thanks for your help and patients.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
wtheis03,
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
If i use the shifted line block, will it look like your Thursday, September 07, 2006 2:22:06 PM post.?From reading the book, I believe it is supposed to look like that. Second question, If I follow the directions in the shifted line block, Im missing the other three indicators which are in your 2nd bworks file.How can I get the shifted line and the other three oscillators? Third question, Im still having trouble entering the new code. I have IE which as you pointed out, doesnt allow cut and paste. Is there anything I can do to bypass that. The cut and paste would be much easier.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (wtheis03) If i use the shifted line block, will it look like your Thursday, September 07, 2006 2:22:06 PM post.?From reading the book, I believe it is supposed to look like that.
If you use the Shifted Line Block it will look like my Thursday, September 07, 2006 2:22:06 PM ET post in Bill Williams Gator Oscillator.
QUOTE (wtheis03) If I follow the directions in the shifted line block, Im missing the other three indicators which are in your 2nd bworks file.How can I get the shifted line and the other three oscillators?
Maybe I'm misunderstanding, but the only reason I can think of why this would happen is that the Shifted Line Custom Code Block is not created correctly. If this is the case, none of the Plots that rely on this Block (or that rely on the output of Plots with this Block) will Plot. The Bill Williams Shifted Line Workspace from my Tuesday, December 18, 2007 2:04:09 PM ET post is the same as the Billi Williams Workspace from Thursday, January 10, 2008 11:00:03 AM ET post with the exception that the Bar Offset Blocks have been replaced with Shifted Line Plot Blocks. Any modification that uses the Shifted Line Plot Block will not work correctly unless the Shifted Line Custom Code Block has been correctly created.
QUOTE (wtheis03) Im still having trouble entering the new code. I have IE which as you pointed out, doesnt allow cut and paste. Is there anything I can do to bypass that. The cut and paste would be much easier.
I'm not in a position to fix Internet Explorer bugs, so my best suggestion would be to install Firefox and use it for the copy and paste.
The dates and times for future bars in the Shifted Line Plot are determined using a naive algorithm that assumes that the time between these Bars should be the average of the time between all of the Bars in the input. This is certainly not going to be an accurate prediction of where future bars are actually going to occur (and, as a result, the this Custom Code Block is not up to the standards required for inclusion in the Web Library).
At some point the the developers will be adding a similar Block that both works with Bars instead of Lines and understands the market calendar to more accurately place shifted Bars. Once this is done, I will be creating another Workspace that uses this Block instead of the Bar Offset Block or Shifted Line Plot Block. I do not have an estimate on when this might happen however.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
OK, I spent some uninterupted time reading the Williams book, and past post re Bill Williams indicators, alligator and anything else related. My conclusion is that I mixed up the book with some of the past post. To make sure thats correct, a couple of questions.....is the Thursday, September 07, 2006 2:22:06 PM is the shifted line block, 5 bars into the future? Is the Thursday, May 31, 2007 9:59:32 pm b.Works file (the alligator lines on the top indicator) equal to the following...Blue line--a 13 bar smoothed moving average offset 8 bars into the future, Red Line-- an 8 bar smoothed moving average offset 5 bars into the future, Green line-- a 5 bar smoothed moving average offset 3 bars into the future??? Is the Tuesday, December 18, 2007 2:04:09 PM info, the same three smoothed moving averages but offset 8 bars into the future, which allows the line to extend past the price?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
wtheis03,
In all of the Bill Williams Workspaces provided, the Jaw (blue line) is a 13-Period Simplified Moving Average Offset 8-Bars into the future, the Teeth (red line) is an 8-Period Simplified Moving Average Offset 5-Bars into the future and the Lips (green line) is a 5-Period Simplified Moving Average Offset 3-Bars into the future. The difference is in using a Bar Offset Block or a Shifted Line Plot Block to offset the lines into the future. When using the Bar Offset Block, the plots will be clipped to the present date. When using the Shifted Line Plot Block, the plots will extend beyond the present date.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
Ok, I tried several times to input the formula into code editor unsuccessfully. I keep getting many errors. "syntax error" is the most common. Is there an on line guide where I can look up the error and how to correct it? Am I supposed to be copying everything from WBIGuid on, or everything blow "your code here"? I even tried downloading Firefox and attempted the cut and paste. way too many errors.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
wtheis03,
You are supposed to copy the entire code in my Tuesday, December 18, 2007 2:04:09 PM ET post (don't worry about the Custom Code Blocks in any other posts) from <WBIGuid through End Class and replace everything (don't leave anything) in the Code Block Editor.
A syntax error just means the program doesn't understand what's there antd is mostly likely because something isn't typed correctly. This shouldn't happen when using Copy and Paste with Firefox (I've tried it again to make sure and don't get any messages when selecting Compile).
The code is Visual Basic, so you may be able to find the specific meanings of various error messages using internet searches (or in a Visual Basic programming book).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
Does the spacing have to be exactly the same too? Indentations?
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
Here are the steps Im taking; let me know if this is correct;
in personal chartist
click "system"
click "code block editor"
click "new code block"
choose "Line to Int Line" ( under "block Syntax" C# is highlighted, not VB.NET)
enter block name
in code block editor....I delete everything and retype the formula word for word, line for line, with indentation and spacing the same as Tuesday, December 18, 2007 2:04:09 PM ET post
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
wtheis03,
While spacing might matter, indents shouldn't. The Code Block Editor will eventually adjust the indents on its own if everything else is correct.
It's a Visual Basic Code Block, so VB.NET should be selected (it's always selected by default on my system). The steps you are following otherwise seem to be correct (although it would obviously be a lot easier if you could get copy and paste to work).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 5/14/2005 Posts: 16
|
What do the colors of the price chart (not jaw,lips,teeth) represent? red,white,blue,green.?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
wtheis03,
The colors are initially determined by the Awesome Oscillator and Accelerator/Decelerator Oscillator.
AO | A/D O
+ | + = Green
- | - = Red
This is then overriden by the interactions of Volume and the Bill Williams' Market Facilitation Index (BW MFI).
Volume | BW MFI
+ | + = Green (Players are Entering the Market)
- | - = Fade (Market has Slowed - End of Trend)
- | + = Fake (Market Makers moving Price - Fake put)
+ | - = Squat (Heavy Activity - Trend change)
The Squat is the only one of these interactions that actually affects the color (it changes it to Blue). Any Bar that does not meet the Conditions to be painted Green, Red or Blue is colored a Light Gray.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
QUOTE (Bruce_L) My research would seem to indicate the Moving Averages used are not Exponential and are actually Smoothed Moving Averages (SMMA). The indicator appears to be a 13-Period SMMA shifted right by 8, an 8-Period SMMA shifted right by 5 and a 5-Period SMMA shifted right by 3. These Moving Averages seem to be applied to the Median Price instead of the Closing Price.
Bruce,
The above is from your first post. If I read the code correctly, the moving averages are Wilder Smoothing initialized with the SMA exactly as Wilder did. As you know, they are equivalent to EMAs as diceman stated.
The Moving Averages are give in TeleChart by:
Blue:
(XAVGH25.8+XAVGL25.8)/2
Red:
(XAVGH15.5+XAVGL15.5)/2
Green:
(XAVGH9.3+XAVGL9.3)/2
Did I read the code correctly?
Thanks,
Jim Murphy
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
It might be of interest that the "Simplified Moving Average" block in Knowledge Base is also Wilder Smoothing (that is if I read the code correctly).
Exponential Moving Average goes by the names:
Exponential Moving Average
Wilder Smoothing
Smoothed Moving Average
Simplified Moving Average
Geometric Weighted Moving Average
and probably a few more.
Thanks,
Jim Murphy
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
bustermu,
You read the code correctly. I actually use this technique in TeleChart related posts on the topic:
PCF question
PCF Formula
Profitunity AO and AC
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |