Пользовательский индикатор JS TradingView
. 1 __customIndicators =[
2 {
. 3 name: 'ShuBenRSI',
. 4 metainfo: {
. 5 '_metainfoVersion': 40,
. 6 'id': 'ShuBenRSI@tv-basicstudies-1',
. 7 'scriptIdPart': '',
. 8 'name': 'ShuBenRSI',
. 9 'description': 'ShuBenRSI',
10 'shortDescription': 'ShuBenRSI',
. 11 'is_hidden_study': to true ,
true ,
1312 is 'is_price_study': 'isCustomIndicator': to true ,
14 'plots': [{'id': 'plot_0', 'type': 'line'}],
15 'defaults': {
16 'styles': {
. 17 'plot_0': {
18 is 'linestyle': 0,
. 19 'visible': to true ,
20 is 'linewidth': 1,
21 is 'plottype': 2, //The drawing type is line graph: 2
22 'trackPrice': to true ,
23 is 'transparency': 40,
24 'color': '#880000'
25 }
26 is },
27 'precision': 1, precision EG: 608.4
28 'inputs': {}
29 },
30 'styles': {
31 is 'plot_0': {
32 'title': 'ShuBenRSI',
33 is 'histogrambase': 0,
34 is }
35 },
36 'inputs': [],
44 this37 },
38 constructor: function () {
39 this.init = function (context, inputCallback) {
40 this._context =context;
41 this._input =inputCallback;
42 var symbol ='p1905';
43 var symbol = PineJS.Std.ticker(this._context); Get the selected product._context.new_sym(symbol, PineJS.Std.period(this._context), PineJS.Std.period(this ._context));
45 } ;
46 this .main.main = function (context, inputCallback) {
47 this._context =context;
48 this._input =inputCallback;
49 this._context.select_sym(1);
50 if(this._context['symbol']['time'] !=NaN){
51 var c = PineJS.Std.close(this._context)-50;
52 var o = PineJS.Std.open(this._context)-50;
53 var l = PineJS.Std.low(this._context)-50;
54 var h = PineJS.Std.high(this._context)-50;
55 console.log('execute custom index!');
56 console.log('symbol: ', this._context['symbol']['time']);
57 return [o, c];
58 }
59
60 }
61 }
62 }
63 ];
Annoyed Aardvark