♥ 0 |
Hello, I took the custom dong chian channel by Chris Ball and tried to create a scan with it. I’m using the candle close value instead of highest or lowest value. I’m sharing it with anyone interested in it. Feel free to try it and make improvements and post back your results. Thanks all.
# Dongchian channel Scan #Name: DonchianChannel input length = 21; def nowAggregation; switch (TermPeriod) { case “Daily”: # This section is for calculating dongchian values for the period resolution chosen plot scan; # plot upperBand = Highest(close[1], length); #plot lowerBand = Lowest(close[1], length); # upperBand.SetDefaultColor(Color.Blue);
Marked as spam
|
Private answer
Ok, thanks for clarifying that bit. Well I can tell you these two lines of code are not going to work. In it’s original form, the study should have an upperBand and a lowerBand. However you have commented out both of them. And for the upperBand variable there seems to be a few extra. Guess you were experimenting with those? From your clarification, you are wanting the scan to pick up when a stock is “hitting the lower Donchian channel”. This solution is as simple as this statement:
And it must be placed BELOW the lowerBand plot, which you have also commented out. You need to uncomment that lowerBand plot or you have no chance whatsoever of getting this to work correctly. To run as a scan, the “plot” will need to be changed to “def”, and you will have to comment out, or delete the style statement for the lowerBand. Hope this explains why it wasn’t working. Marked as spam
|
|||||
Private answer
Pete, I’m having some issues with the formatting of my latest posting. Can u give me a hint what I might be doing wrong. It posted well the first time but I’ve already tried several times to ‘correct’ the formatting of the last posting without success. Thanks. Marked as spam
|
|||||
Private answer
My previous posting was a little messed up and hard to read. Hopefully this one will come out right and easier to read. # Dongchian channel #Name: DonchianChannel input length = 21; def nowAggregation; switch (TermPeriod) { case “Daily”: # This section is for calculating dongchian values for the period resolution chosen # plot upperBand = Highest(close[1], length); def upperBand = Highest(close(period= nowAggregation), length); scan = low <= lowerBand; Marked as spam
|
|||||
Private answer
Obelix, do you have the code for the Donchian channels? Marked as spam
|
Please log in to post questions.
Moderator’s Note: The title of this post has been edited to reflect the correct spelling, ”Donchian”. This is to ensure folks are able to locate this post when searching the topics list. This code contains a statement ”plot scan;”, but it is not assigned to any signals and is therefore non-functional.
I wanted to add that the scan isn’t working properly. It’s returning stocks which are hitting the upper donchian channel although I programmed it to return the stocks which are hitting the lower donchian channel. Can someone look at the code and see if they can find what’s wrong. Thanks.