How would I generate lines on a chart representing the maximum high, the midprice and the minimum low (closing prices) for x number of bars. The lines would plot similar to pivot lines (not horizontal across the entire chart, but stairstep as minH and minL change respective to the selected number of bars (a linear regression I think).
Announcement
Collapse
No announcement yet.
MinL, MaxH and midpoints
Collapse
X
-
ccc243
If what you want is a channel based on the highest High, lowest Low and midpoint of these then use the Donchian Channel in Basic Studies.
If instead you want the channel based on the highest and lowest Close (or any other user defined variable) and the midpoint of these then use the efs in this post.
Alex
-
Thanks for the reply. I feel dumb for not seeing the Donchian channel. Both are almost what I am looking for.
I made a mistake by talking about close. Close is not what I need.
In the case of the highest, lowest efs, I would like to be able to make the high line use MaxH, and the lower line always use the MinL for the designated period. (Donchian appears to do this).
Now I want to plot additional lines. The midpoint (.500) is already plotted. How could I plot other lines such as (.382) and (.618).
And even plot outside the scale, eg. (1.382).
If the Donchian Channel allowed the addition of lines like this, I would have exactly what I envision.
Craig
Comment
-
Craig
If you use the builtinDonchian.efs that is in the Builtin subfolder of Formulas it will be easy to accomplish what you need.
First create the variables required to perform the basic math and insert them just under the commented section in the efs (ie under "Insert your code..etc")
var nUpper = vDonch.getValue(DonchianStudy.UPPER);
var nLower = vDonch.getValue(DonchianStudy.LOWER);
Once you have these you can compute all the lines you want. For example the inner 0.382 lines would be
var donch0382L = nLower+((nUpper-nLower)*0.382);
var donch0382U = nUpper-((nUpper-nLower)*0.382);
The outer would be
var donch1382U nLower+((nUpper-nLower)*1.382);
etc etc
Add the variables to the return statement and add the required statements in preMain() to color the lines, assign label names, etc
Alex
Comment
Comment