Support Board
Date/Time: Sun, 24 Nov 2024 16:38:32 +0000
[User Discussion] - Implementation of Wilson RSI Channel in Sierra
View Count: 2380
[2013-11-06 14:01:54] |
djcurcio - Posts: 236 |
Is there a Wilson RSI Channel implementation for Sierra charts? Please see http://www.thinkscripter.com/indicator/wilson-relative-price-channel/ Thanks |
[2013-11-06 15:45:44] |
vegasfoster - Posts: 444 |
I think I can do it later if someone doesn't beat me to it.
|
[2013-11-06 18:53:23] |
vegasfoster - Posts: 444 |
Later being within next couple days :)
|
[2013-11-06 19:02:48] |
djcurcio - Posts: 236 |
Fine with me - thanks very much
|
[2013-11-08 18:11:25] |
vegasfoster - Posts: 444 |
Ok, I did this but the lines are going way off the chart and I can't see anything wrong with the conversion from what you posted. Maybe someone can take a look at this cuz I'm not seeing what's wrong with it. #include "sierrachart.h" SCDLLName("WilsonRelativePriceChannel") /*==========================================================================*/ SCSFExport scsf_WilsonRelativePriceChannel(SCStudyInterfaceRef sc) { SCSubgraphRef OB = sc.Subgraph[0]; SCSubgraphRef UNZ = sc.Subgraph[1]; SCSubgraphRef OS = sc.Subgraph[2]; SCSubgraphRef LNZ = sc.Subgraph[3]; SCSubgraphRef obinput = sc.Subgraph[4]; SCSubgraphRef unzinput = sc.Subgraph[5]; SCSubgraphRef osinput = sc.Subgraph[6]; SCSubgraphRef lnzinput = sc.Subgraph[7]; SCInputRef InputData = sc.Input[0]; SCInputRef Period = sc.Input[1]; SCInputRef Smoothing = sc.Input[2]; SCInputRef Overbought = sc.Input[3]; SCInputRef Oversold = sc.Input[4]; SCInputRef UpperNeutralZone = sc.Input[5]; SCInputRef LowerNeutralZone = sc.Input[6]; if (sc.SetDefaults) { sc.GraphName="Wilson Relative Price Channel"; sc.AutoLoop = 1; sc.GraphRegion = 0; sc.ValueFormat = 3; sc.FreeDLL = 1; // Subgraphs OB.Name = "OverBought"; OB.DrawStyle = DRAWSTYLE_LINE; OB.PrimaryColor = RGB(0,192,0); UNZ.Name = "Upper Neutral Zone"; UNZ.DrawStyle = DRAWSTYLE_LINE; UNZ.PrimaryColor = RGB(0,192,0); OS.Name = "OverSold"; OS.DrawStyle = DRAWSTYLE_LINE; OS.PrimaryColor = RGB(0,192,0); LNZ.Name = "Lower Neutral Zone"; LNZ.DrawStyle = DRAWSTYLE_LINE; LNZ.PrimaryColor = RGB(0,192,0); // Data Inputs InputData.Name = "Input Data"; InputData.SetInputDataIndex(SC_LAST); Period.Name = "Period"; Period.SetInt(34); Period.SetIntLimits(1, MAX_STUDY_LENGTH); Smoothing.Name = "Smoothing"; Smoothing.SetInt(1); Smoothing.SetIntLimits(1, MAX_STUDY_LENGTH); Overbought.Name = "Overbought"; Overbought.SetInt(70); Overbought.SetIntLimits(1, MAX_STUDY_LENGTH); Oversold.Name = "Overbought"; Oversold.SetInt(30); Oversold.SetIntLimits(1, MAX_STUDY_LENGTH); UpperNeutralZone.Name = "Period"; UpperNeutralZone.SetInt(55); UpperNeutralZone.SetIntLimits(1, MAX_STUDY_LENGTH); LowerNeutralZone.Name = "Period"; LowerNeutralZone.SetInt(45); LowerNeutralZone.SetIntLimits(1, MAX_STUDY_LENGTH); return; } if (sc.Index < Period.GetInt()) return; sc.RSI(sc.BaseDataIn[InputData.GetInputDataIndex()], sc.Subgraph[10], MOVAVGTYPE_WILDERS, Period.GetInt()); obinput[sc.Index] = sc.Subgraph[10][sc.Index] - Overbought.GetInt(); unzinput[sc.Index] = sc.Subgraph[10][sc.Index] - UpperNeutralZone.GetInt(); osinput[sc.Index] = sc.Subgraph[10][sc.Index] - Oversold.GetInt(); lnzinput[sc.Index] = sc.Subgraph[10][sc.Index] - LowerNeutralZone.GetInt(); sc.MovingAverage(obinput, sc.Subgraph[11], MOVAVGTYPE_EXPONENTIAL, Smoothing.GetInt()); sc.MovingAverage(unzinput, sc.Subgraph[12], MOVAVGTYPE_EXPONENTIAL, Smoothing.GetInt()); sc.MovingAverage(osinput, sc.Subgraph[13], MOVAVGTYPE_EXPONENTIAL, Smoothing.GetInt()); sc.MovingAverage(lnzinput, sc.Subgraph[14], MOVAVGTYPE_EXPONENTIAL, Smoothing.GetInt()); //plot O_B = close - (close*(OB/100)); //plot U_NZ = close - (close*(NZU/100)); //plot O_S = close - (close*(OS/100)); //plot L_NZ = close - (close*(NZL/100)); float InputD = sc.BaseDataIn[InputData.GetInputDataIndex()][sc.Index]; OB[sc.Index] = InputD - (InputD*(sc.Subgraph[11][sc.Index]/100)); UNZ[sc.Index] = InputD - (InputD*(sc.Subgraph[12][sc.Index]/100)); OS[sc.Index] = InputD - (InputD*(sc.Subgraph[13][sc.Index]/100)); LNZ[sc.Index] = InputD - (InputD*(sc.Subgraph[14][sc.Index]/100)); } |
[2013-11-10 00:04:47] |
vegasfoster - Posts: 444 |
So looking at this again after being well rested, and the formula as shown on Thinkscripter is going to work this way. It looks fine on aapl because the share price is 500+, but on anything substantially smaller or substantially larger it's gonna looks screwy. There needs to be some adjustment for the ticksize and/or instrument price, but I'm not a mathetician, so I'll have to think about a way to do that. The only other option is to put it on your chart and left scale it so it more less floats like putting a stochastic or something on the price panel, which wouldn't be desirable to me. Any feedback would be good.
|
[2013-11-19 16:11:05] |
djcurcio - Posts: 236 |
I think this solves the issue. Create a user input filed called Divisor. Default = 100. Change the "100"s to Divisor. see below -------------- OB[sc.Index] = InputD - (InputD*(sc.Subgraph[11][sc.Index]/100)); UNZ[sc.Index] = InputD - (InputD*(sc.Subgraph[12][sc.Index]/100)); OS[sc.Index] = InputD - (InputD*(sc.Subgraph[13][sc.Index]/100)); LNZ[sc.Index] = InputD - (InputD*(sc.Subgraph[14][sc.Index]/100)); ------------------ Increasing the Divisor to 1000 or 10,000 allows the adjustment for the price of the instrument. d Best regards dj |
To post a message in this thread, you need to log in with your Sierra Chart account: