Support Board
Date/Time: Fri, 29 Nov 2024 22:50:25 +0000
wave trend oscillator
View Count: 1160
[2022-07-13 20:20:00] |
User411320 - Posts: 289 |
any way the wave trend oscillator can be put in SC? this is code from Tradeovate. const predef = require("./tools/predef"); const meta = require("./tools/meta"); const EMA = require("./tools/EMA"); const SMA = require("./tools/SMA"); const typicalPrice = require("./tools/typicalPrice"); const p = require("./tools/plotting"); class waveTrendOscillator { init() { this.c1 = EMA(this.props.channelLength); this.c2 = EMA(this.props.channelLength); this.a = EMA(this.props.averageLength); this.s = SMA(this.props.smoothLength); this.pWt1 = 0.0; this.pWt2 = 0.0; this.obIndex = 0; this.osIndex = 0; this.crossunderIndex = 0; this.crossoverIndex = 0; } map(d, i, history) { const typ = typicalPrice(d); let esa = this.c1(typ); let dist = this.c2(Math.abs(typ - esa)); let ci = (typ - esa) / (this.props.cciConstant * dist); let ci2 = Number.isNaN(ci) ? 0 : ci let wt1 = this.a(ci2); let wt2 = this.s(wt1); const obValue = Math.min(this.props.overbought1, this.props.overbought2) const osValue = Math.max(this.props.oversold1, this.props.oversold2); // save index of where ob/os condition occurred if (this.pWt1 obValue) { this.obIndex = i; } if (this.pWt1 >= osValue && wt1 < osValue) { this.osIndex = i; } // crossunder from overbought let sell = false; let buy = false; if (this.pWt1 >= this.pWt2 && wt1 < wt2) { if (this.obIndex < i && this.obIndex > this.crossunderIndex) { this.crossunderIndex = i; sell = true; } } // crossover from oversold if (this.pWt1 wt2) { if (this.osIndex < i && this.osIndex > this.crossoverIndex) { this.crossoverIndex = i; buy = true; } } this.pWt1 = wt1; this.pWt2 = wt2; return { waveTrend: wt1, waveTrendSmooth: wt2, ob1: this.props.overbought1, ob2: this.props.overbought2, os1: this.props.oversold1, os2: this.props.oversold2, mid: 0, buy, sell, buyColor: this.props.buyColor, sellColor: this.props.sellColor, } } filter(_, i) { return i >= this.props.averageLength && i >= this.props.channelLength; } } function tradePlotter(canvas, indicatorInstance, history) { for(let i=0; i 0) { if (item.buy || item.sell) { const x = p.x.get(item); const item1 = history.get(i - 1); const x1 = p.x.get(item1); const y = item.buy ? Math.min(item.waveTrend, item.waveTrendSmooth) : Math.max(item.waveTrend, item.waveTrendSmooth) canvas.drawLine( p.offset(x1, y), p.offset(x, y), { color: item.buy ? item.buyColor : item.sellColor, relativeWidth: 2, opacity: 1.0 }); } } } } module.exports = { name: "waveTrendOscillator", description: "Wave Trend Oscillator", calculator: waveTrendOscillator, params: { channelLength: predef.paramSpecs.period(10), averageLength: predef.paramSpecs.period(21), smoothLength: predef.paramSpecs.period(4), cciConstant: predef.paramSpecs.number(0.015, 0.001, 0.001), overbought1: predef.paramSpecs.period(60), overbought2: predef.paramSpecs.period(53), oversold1: predef.paramSpecs.period(-60), oversold2: predef.paramSpecs.period(-53), buyColor: predef.paramSpecs.color('cyan'), sellColor: predef.paramSpecs.color('magenta'), }, tags: [predef.tags.Oscillators], areaChoice: meta.AreaChoice.NEW, inputType: meta.InputType.BARS, plots: { waveTrend: { title: "Wave Trend"}, waveTrendSmooth: { title: "Wave Trend Smoothed"}, ob1: { title: "Overbought 1", displayOnly: true}, ob2: { title: "Overbought 2", displayOnly: true}, os1: { title: "Oversold 1", displayOnly: true}, os2: { title: "Oversold 2", displayOnly: true}, mid: { title: "Mid", displayOnly: true}, }, plotter: [ predef.plotters.singleline("waveTrend"), predef.plotters.singleline("waveTrendSmooth"), predef.plotters.singleline("ob1"), predef.plotters.singleline("ob2"), predef.plotters.singleline("os1"), predef.plotters.singleline("os2"), predef.plotters.singleline("mid"), predef.plotters.custom(tradePlotter), ], schemeStyles: { dark: { waveTrend: predef.styles.plot("#00C0C0"), waveTrendSmooth: predef.styles.plot("#C000C0"), ob1: predef.styles.plot("#FF0000"), ob2: predef.styles.plot({ color: "#FF0000", lineStyle: 3 }), os1: predef.styles.plot("#00FF00"), os2: predef.styles.plot({ color: "#00FF00", lineStyle: 3 }), mid: predef.styles.plot("#707070"), } } }; |
[2022-07-18 18:14:29] |
User411320 - Posts: 289 |
anyone?
|
[2022-07-18 21:10:43] |
JohnR - User831573 - Posts: 306 |
You might try directly reaching out to some of the people listed on the SC 3rd party page. https://www.sierrachart.com/index.php?page=doc/SierraChartStudyAndSystemProgrammers.php JohnR |
[2022-07-18 22:40:50] |
SC Support Tom - Posts: 450 |
If you can accept this version, then I can do it. I do not have time to learn Tradeovate's proprietary language, but I know Tradingview's pretty well. //
// @author LazyBear // // If you use this code in its original/modified form, do drop me a note. // study(title="WaveTrend [LazyBear]", shorttitle="WT_LB") n1 = input(10, "Channel Length") n2 = input(21, "Average Length") obLevel1 = input(60, "Over Bought Level 1") obLevel2 = input(53, "Over Bought Level 2") osLevel1 = input(-60, "Over Sold Level 1") osLevel2 = input(-53, "Over Sold Level 2") ap = hlc3 esa = ema(ap, n1) d = ema(abs(ap - esa), n1) ci = (ap - esa) / (0.015 * d) tci = ema(ci, n2) wt1 = tci wt2 = sma(wt1,4) plot(0, color=gray) plot(obLevel1, color=red) plot(osLevel1, color=green) plot(obLevel2, color=red, style=3) plot(osLevel2, color=green, style=3) plot(wt1, color=green) plot(wt2, color=red, style=3) plot(wt1-wt2, color=blue, style=area, transp=80) |
[2022-07-18 23:17:40] |
User411320 - Posts: 289 |
Thank you Tom, I'd be willing to use it but not sure how to input your code into SC |
[2022-07-19 00:07:51] |
SC Support Tom - Posts: 450 |
I can input the code into SC.
|
[2022-07-19 16:39:21] |
User411320 - Posts: 289 |
Thank you!
|
[2022-07-26 09:13:28] |
SC Support Tom - Posts: 450 |
I am still working on this. Normally, oscillators take on values from -100 to +100. But this one takes on very high values (due to the factor of 0.015 in the denominator of the Composite Index). I am trying to get to the bottom of this.
|
[2022-07-26 10:22:49] |
User411320 - Posts: 289 |
THank you so much , let me know if anyway I can help
|
[2022-08-18 21:03:15] |
User658125 - Posts: 20 |
I just came across this thread as I was searching for the very same thing. Did the code get completed or is it still a work in progress?
|
[2022-08-18 22:37:03] |
User411320 - Posts: 289 |
Still a work in progress
|
[2022-08-19 02:26:10] |
Ackin - Posts: 1865 |
User658125) It's possible download it for free + HA modified version contact link: https://www.sierrachart.com/UserControlPanel.php?page=StudyStore&SCDLLName=zyp_download_free Date Time Of Last Edit: 2022-08-19 02:26:45
|
WaveTrend.png / V - Attached On 2022-08-19 02:26:39 UTC - Size: 97.09 KB - 144 views |
[2023-01-04 19:46:29] |
SC Support Tom - Posts: 450 |
This is done. It will be available in the next release.
|
To post a message in this thread, you need to log in with your Sierra Chart account: