TheStrategyLab.com Price Action Trading Support Forum http://www.thestrategylab.com/tsl/forum/ |
|
Multicharts Wide Range Body Code http://www.thestrategylab.com/tsl/forum/viewtopic.php?f=225&t=3431 |
Page 1 of 1 |
Author: | NickA [ Fri Jun 16, 2017 5:52 am ] |
Post subject: | Multicharts Wide Range Body Code |
This is something I knocked up on arriving here. I find codifying things useful as you really get to understand the principles and ramifications of what you re coding. It only does Wide Range Bodies currently (laziness) though would only take 5 minutes to add an option for Bars. let me know if you would like me to add that as an option. It probably will work in tradestation too. Set Plots 1 and 2 to HiLo bar to highlight WRBHG's. Code: Input: BarsBack(3), PlotWRBgap(true), PlotWRB(true); var: lastbarWRB(false),WRBgap(false), range(0); if lastbarWRB and PlotWRBgap then begin if (h[2] < l) then begin plot1 [1](h[2]); plot2 [1](l); end; if (l[2] > h) then begin plot1[1](l[2]); plot2 [1](h); end; lastbarWRB = false; end; range = absvalue (o-c); if range = highest(range,BarsBack+1) then begin lastbarWRB = true; if PlotWRB and (o-c) < 0 then plot3(l); if PlotWRB and (o-c) >= 0 then plot3(h); end; Attachment: Attachment: Attachment:
|
Author: | wrbtrader [ Fri Jun 16, 2017 8:14 am ] |
Post subject: | Re: Multicharts Wide Range Body Code |
Hi, Thanks for sharing your code for multicharts. I have a question...does your code identify WRB Hidden Gap intervals differently from WRB intervals via color Also, it looks like in your code you're using the RANGE to determine WRBs instead of the difference between Close & Open If so, that's ok but many others (including myself) don't use the range. Regards, M.A. Perry TheStrategyLab |
Author: | NickA [ Fri Jun 16, 2017 11:55 am ] |
Post subject: | Re: Multicharts Wide Range Body Code |
<deleted> |
Author: | NickA [ Fri Jun 16, 2017 12:15 pm ] |
Post subject: | Re: Multicharts Wide Range Body Code |
Unless there is a logic error (quite possible!) the indicator places a dot above any downward Wide Range Body interval or below any upward Wide Range Body interval. (purple in the examples). These intervals don't need have hidden gaps. This can be switched on or off. You can also select how many bars back to look (default 3). If it detects a WRBody it will look for a hidden gap by checking next interval low > previous interval high OR next interval high < previous interval low. It displays this as a background on that interval (blue in the examples). It is displayed from previous interval h/l to subsequent interval l/h. wrbtrader wrote: Hi,
Thanks for sharing your code for multicharts. I have a question...does your code identify WRB Hidden Gap intervals differently from WRB intervals via color Also, it looks like in your code you're using the RANGE to determine WRBs instead of the difference between Close & Open If so, that's ok but many others (including myself) don't use the range. Regards, M.A. Perry TheStrategyLab |
Author: | NickA [ Fri Jun 16, 2017 12:29 pm ] |
Post subject: | Re: Multicharts Wide Range Body Code |
Example image demonstrating logic note dots signify any WRBody highlights hidden gaps. Attachment: And finally how one would probably use it with only WRBody hidden gaps shown. Attachment:
|
Author: | NickA [ Tue Jun 20, 2017 6:22 am ] |
Post subject: | Re: Multicharts Wide Range Body Code |
To avoid confusion an updated version where you can select Wide Range Bodies or Wide Range Bars. I couldn't edit the first post I, guess there is a timer on edits. Code: Input: BarsBack(3), Bodies(true), PlotWRBgap(true), PlotWRB(true); var: lastbarWRB(false),WRBgap(false), spacer(0), range(0); if lastbarWRB and PlotWRBgap then begin if (h[2] < l) then begin plot1 [1](h[2]); plot2 [1](l); end; if (l[2] > h) then begin plot1[1](l[2]); plot2 [1](h); end; lastbarWRB = false; end; if bodies then range = absvalue (o-c) else range = absvalue (h-l); spacer = averagetruerange(13) /13; if range = highest(range,BarsBack+1) then begin lastbarWRB = true; if PlotWRB and (o-c) < 0 then plot3(l-spacer); if PlotWRB and (o-c) >= 0 then plot3(h+spacer); end; Bodies Attachment: Bars Attachment:
|
Author: | NickA [ Tue Jun 20, 2017 2:30 pm ] |
Post subject: | Re: Multicharts Wide Range Body Code |
I should read more carefully. Senility. Added option to plot hidden gaps as hidden gaps or full bodies. Code: Input: BarsBack(3), BodiesNotBars(true), PlotWRBgap(true), PlotWRB(true), PLotHGasWholeBody(true); var: lastbarWRB(false),WRBgap(false), spacer(0), range(0); if lastbarWRB and PlotWRBgap then begin if PlotHGasWholeBody then begin plot1 [1] (o[1]); plot2 [1] (c[1]); end else begin if (h[2] < l) then begin plot1 [1](h[2]); plot2 [1](l); end; if (l[2] > h) then begin plot1[1](l[2]); plot2 [1](h); end; end; lastbarWRB = false; end; if bodiesnotbars then range = absvalue (o-c) else range = absvalue (h-l); spacer = averagetruerange(13) /13; if range = highest(range,BarsBack+1) then begin lastbarWRB = true; if PlotWRB and (o-c) < 0 then plot3(l-spacer); if PlotWRB and (o-c) >= 0 then plot3(h+spacer); end; Attachment:
|
Author: | NickA [ Wed Jun 21, 2017 2:17 am ] |
Post subject: | Re: Multicharts Wide Range Body Code |
Fixed bug in the full body plot Code: Input:
BarsBack(3), BodiesNotBars(true), PlotWRBgap(true), PlotWRB(true), PLotHGasWholeBody(true); var: lastbarWRB(false),WRBgap(false),hg(false), spacer(0), range(0); if lastbarWRB and PlotWRBgap then begin if (h[2] < l) then begin hg = true; value1 = h[2]; value2 =l; end; if (l[2] > h) then begin hg = true; value1 = l[2]; value2 = h; end; if PlotHGasWholeBody then begin // clearer to simply overide value 1 and 2 value1 = o[1]; value2 = c[1]; end; if hg then begin plot1 [1](value1); plot2 [1](value2); end; lastbarWRB = false; hg = false; end; if bodiesnotbars then range = absvalue (o-c) else range = absvalue (h-l); spacer = averagetruerange(13) /13; if range = highest(range,BarsBack+1) then begin lastbarWRB = true; if PlotWRB and (o-c) < 0 then plot3(l-spacer); if PlotWRB and (o-c) >= 0 then plot3(h+spacer); end; |
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |