hqchart 1.1.13318 → 1.1.13324

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13318",
3
+ "version": "1.1.13324",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -4847,6 +4847,35 @@ function JSAlgorithm(errorHandler,symbolData)
4847
4847
  return result;
4848
4848
  }
4849
4849
 
4850
+ //反向过滤连续出现的信号.
4851
+ //用法:FILTERX(X,N):X满足条件后,将其前N周期内的数据置为0,N为常量.
4852
+ //例如:FILTERX(CLOSE>OPEN,5)查找阳线,前5天内出现过的阳线不被记录在内
4853
+ this.FILTERX=function(data, n, node)
4854
+ {
4855
+ var result=[];
4856
+ for(let i=0,j=0; i<data.length; ++i)
4857
+ {
4858
+ if (data[i])
4859
+ {
4860
+ result[i]=1;
4861
+ for(j=0;j<n && i-j-1>=0;++j)
4862
+ {
4863
+ result[i-j-1]=0;
4864
+ }
4865
+ i+=n;
4866
+ }
4867
+ else
4868
+ {
4869
+ result[i]=0;
4870
+ }
4871
+ }
4872
+
4873
+ return result;
4874
+ }
4875
+
4876
+ //上一次条件成立到当前的周期数.
4877
+ //用法:BARSLAST(X):上一次X不为0到现在的周期数
4878
+ //例如:BARSLAST(CLOSE/REF(CLOSE,1)>=1.1)表示上一个涨停板到当前的周期数
4850
4879
  this.BARSLAST=function(data)
4851
4880
  {
4852
4881
  var result=[];
@@ -4866,6 +4895,52 @@ function JSAlgorithm(errorHandler,symbolData)
4866
4895
  return result;
4867
4896
  }
4868
4897
 
4898
+ //倒数第N次成立时距今的周期数.
4899
+ //用法:BARSLASTS(X,N):X倒数第N满足到现在的周期数,N支持变量
4900
+ this.BARSLASTS=function(data, n, node)
4901
+ {
4902
+ var result=[];
4903
+ if (!data) return result;
4904
+ if (n<=0) n=data.length;
4905
+
4906
+ var day=null;
4907
+ var SingleValue=0; //单词数
4908
+ var periodCount=0;
4909
+ for(let i=0;i<data.length;++i)
4910
+ {
4911
+ result[i]=null;
4912
+ var value=data[i];
4913
+
4914
+ if (value>0)
4915
+ {
4916
+ if (day==null)
4917
+ {
4918
+ day=0;
4919
+ ++periodCount;
4920
+ }
4921
+ else
4922
+ {
4923
+ ++periodCount;
4924
+ if (periodCount>n) day-=SingleValue;
4925
+ }
4926
+
4927
+ SingleValue=0;
4928
+ }
4929
+ else
4930
+ {
4931
+ if (day!=null)
4932
+ {
4933
+ ++day;
4934
+ ++SingleValue;
4935
+ }
4936
+ }
4937
+
4938
+ if (day!=null) result[i]=day;
4939
+ }
4940
+
4941
+ return result;
4942
+ }
4943
+
4869
4944
  /*
4870
4945
  N周期内第一个条件成立到当前的周期数.
4871
4946
  用法:
@@ -8887,10 +8962,15 @@ function JSAlgorithm(errorHandler,symbolData)
8887
8962
  return this.FILTER(args[0],args[1]);
8888
8963
  case 'TFILTER':
8889
8964
  return this.TFILTER(args[0],args[1],args[2]);
8965
+ case "FILTERX":
8966
+ return this.FILTERX(args[0],args[1],node);
8890
8967
  case 'SLOPE':
8891
8968
  return this.SLOPE(args[0],args[1]);
8892
8969
  case 'BARSLAST':
8893
8970
  return this.BARSLAST(args[0]);
8971
+ case "BARSLASTS":
8972
+ //this.ThrowUnexpectedNode(node,`函数'BARSLASTS'还在开发中`, name);
8973
+ return this.BARSLASTS(args[0],args[1],node);
8894
8974
  case 'BARSCOUNT':
8895
8975
  return this.BARSCOUNT(args[0]);
8896
8976
  case 'BARSSINCEN':
@@ -18341,6 +18421,7 @@ function JSExplainer(ast,option)
18341
18421
  this.JobList=[]; //执行的任务队列
18342
18422
  this.VarTable=new Map(); //变量表
18343
18423
  this.OutVarTable=[]; //输出变量
18424
+ this.MaxValueLength=150; //最长的字符
18344
18425
 
18345
18426
  //脚本自动变量表, 只读
18346
18427
  this.ConstVarTable=new Map(
@@ -19290,7 +19371,7 @@ function JSExplainer(ast,option)
19290
19371
 
19291
19372
  this.ConvertToShortValue=function(value)
19292
19373
  {
19293
- var maxLength=80;
19374
+ var maxLength=this.MaxValueLength;
19294
19375
  if (value && value.length>=maxLength)
19295
19376
  {
19296
19377
  var shortValue=value.slice(0, maxLength-10);
@@ -100329,6 +100329,35 @@ function JSAlgorithm(errorHandler,symbolData)
100329
100329
  return result;
100330
100330
  }
100331
100331
 
100332
+ //反向过滤连续出现的信号.
100333
+ //用法:FILTERX(X,N):X满足条件后,将其前N周期内的数据置为0,N为常量.
100334
+ //例如:FILTERX(CLOSE>OPEN,5)查找阳线,前5天内出现过的阳线不被记录在内
100335
+ this.FILTERX=function(data, n, node)
100336
+ {
100337
+ var result=[];
100338
+ for(let i=0,j=0; i<data.length; ++i)
100339
+ {
100340
+ if (data[i])
100341
+ {
100342
+ result[i]=1;
100343
+ for(j=0;j<n && i-j-1>=0;++j)
100344
+ {
100345
+ result[i-j-1]=0;
100346
+ }
100347
+ i+=n;
100348
+ }
100349
+ else
100350
+ {
100351
+ result[i]=0;
100352
+ }
100353
+ }
100354
+
100355
+ return result;
100356
+ }
100357
+
100358
+ //上一次条件成立到当前的周期数.
100359
+ //用法:BARSLAST(X):上一次X不为0到现在的周期数
100360
+ //例如:BARSLAST(CLOSE/REF(CLOSE,1)>=1.1)表示上一个涨停板到当前的周期数
100332
100361
  this.BARSLAST=function(data)
100333
100362
  {
100334
100363
  var result=[];
@@ -100348,6 +100377,52 @@ function JSAlgorithm(errorHandler,symbolData)
100348
100377
  return result;
100349
100378
  }
100350
100379
 
100380
+ //倒数第N次成立时距今的周期数.
100381
+ //用法:BARSLASTS(X,N):X倒数第N满足到现在的周期数,N支持变量
100382
+ this.BARSLASTS=function(data, n, node)
100383
+ {
100384
+ var result=[];
100385
+ if (!data) return result;
100386
+ if (n<=0) n=data.length;
100387
+
100388
+ var day=null;
100389
+ var SingleValue=0; //单词数
100390
+ var periodCount=0;
100391
+ for(let i=0;i<data.length;++i)
100392
+ {
100393
+ result[i]=null;
100394
+ var value=data[i];
100395
+
100396
+ if (value>0)
100397
+ {
100398
+ if (day==null)
100399
+ {
100400
+ day=0;
100401
+ ++periodCount;
100402
+ }
100403
+ else
100404
+ {
100405
+ ++periodCount;
100406
+ if (periodCount>n) day-=SingleValue;
100407
+ }
100408
+
100409
+ SingleValue=0;
100410
+ }
100411
+ else
100412
+ {
100413
+ if (day!=null)
100414
+ {
100415
+ ++day;
100416
+ ++SingleValue;
100417
+ }
100418
+ }
100419
+
100420
+ if (day!=null) result[i]=day;
100421
+ }
100422
+
100423
+ return result;
100424
+ }
100425
+
100351
100426
  /*
100352
100427
  N周期内第一个条件成立到当前的周期数.
100353
100428
  用法:
@@ -104369,10 +104444,15 @@ function JSAlgorithm(errorHandler,symbolData)
104369
104444
  return this.FILTER(args[0],args[1]);
104370
104445
  case 'TFILTER':
104371
104446
  return this.TFILTER(args[0],args[1],args[2]);
104447
+ case "FILTERX":
104448
+ return this.FILTERX(args[0],args[1],node);
104372
104449
  case 'SLOPE':
104373
104450
  return this.SLOPE(args[0],args[1]);
104374
104451
  case 'BARSLAST':
104375
104452
  return this.BARSLAST(args[0]);
104453
+ case "BARSLASTS":
104454
+ //this.ThrowUnexpectedNode(node,`函数'BARSLASTS'还在开发中`, name);
104455
+ return this.BARSLASTS(args[0],args[1],node);
104376
104456
  case 'BARSCOUNT':
104377
104457
  return this.BARSCOUNT(args[0]);
104378
104458
  case 'BARSSINCEN':
@@ -113823,6 +113903,7 @@ function JSExplainer(ast,option)
113823
113903
  this.JobList=[]; //执行的任务队列
113824
113904
  this.VarTable=new Map(); //变量表
113825
113905
  this.OutVarTable=[]; //输出变量
113906
+ this.MaxValueLength=150; //最长的字符
113826
113907
 
113827
113908
  //脚本自动变量表, 只读
113828
113909
  this.ConstVarTable=new Map(
@@ -114772,7 +114853,7 @@ function JSExplainer(ast,option)
114772
114853
 
114773
114854
  this.ConvertToShortValue=function(value)
114774
114855
  {
114775
- var maxLength=80;
114856
+ var maxLength=this.MaxValueLength;
114776
114857
  if (value && value.length>=maxLength)
114777
114858
  {
114778
114859
  var shortValue=value.slice(0, maxLength-10);
@@ -132804,7 +132885,7 @@ function ScrollBarBGChart()
132804
132885
 
132805
132886
 
132806
132887
 
132807
- var HQCHART_VERSION="1.1.13317";
132888
+ var HQCHART_VERSION="1.1.13323";
132808
132889
 
132809
132890
  function PrintHQChartVersion()
132810
132891
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13317";
8
+ var HQCHART_VERSION="1.1.13323";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -100373,6 +100373,35 @@ function JSAlgorithm(errorHandler,symbolData)
100373
100373
  return result;
100374
100374
  }
100375
100375
 
100376
+ //反向过滤连续出现的信号.
100377
+ //用法:FILTERX(X,N):X满足条件后,将其前N周期内的数据置为0,N为常量.
100378
+ //例如:FILTERX(CLOSE>OPEN,5)查找阳线,前5天内出现过的阳线不被记录在内
100379
+ this.FILTERX=function(data, n, node)
100380
+ {
100381
+ var result=[];
100382
+ for(let i=0,j=0; i<data.length; ++i)
100383
+ {
100384
+ if (data[i])
100385
+ {
100386
+ result[i]=1;
100387
+ for(j=0;j<n && i-j-1>=0;++j)
100388
+ {
100389
+ result[i-j-1]=0;
100390
+ }
100391
+ i+=n;
100392
+ }
100393
+ else
100394
+ {
100395
+ result[i]=0;
100396
+ }
100397
+ }
100398
+
100399
+ return result;
100400
+ }
100401
+
100402
+ //上一次条件成立到当前的周期数.
100403
+ //用法:BARSLAST(X):上一次X不为0到现在的周期数
100404
+ //例如:BARSLAST(CLOSE/REF(CLOSE,1)>=1.1)表示上一个涨停板到当前的周期数
100376
100405
  this.BARSLAST=function(data)
100377
100406
  {
100378
100407
  var result=[];
@@ -100392,6 +100421,52 @@ function JSAlgorithm(errorHandler,symbolData)
100392
100421
  return result;
100393
100422
  }
100394
100423
 
100424
+ //倒数第N次成立时距今的周期数.
100425
+ //用法:BARSLASTS(X,N):X倒数第N满足到现在的周期数,N支持变量
100426
+ this.BARSLASTS=function(data, n, node)
100427
+ {
100428
+ var result=[];
100429
+ if (!data) return result;
100430
+ if (n<=0) n=data.length;
100431
+
100432
+ var day=null;
100433
+ var SingleValue=0; //单词数
100434
+ var periodCount=0;
100435
+ for(let i=0;i<data.length;++i)
100436
+ {
100437
+ result[i]=null;
100438
+ var value=data[i];
100439
+
100440
+ if (value>0)
100441
+ {
100442
+ if (day==null)
100443
+ {
100444
+ day=0;
100445
+ ++periodCount;
100446
+ }
100447
+ else
100448
+ {
100449
+ ++periodCount;
100450
+ if (periodCount>n) day-=SingleValue;
100451
+ }
100452
+
100453
+ SingleValue=0;
100454
+ }
100455
+ else
100456
+ {
100457
+ if (day!=null)
100458
+ {
100459
+ ++day;
100460
+ ++SingleValue;
100461
+ }
100462
+ }
100463
+
100464
+ if (day!=null) result[i]=day;
100465
+ }
100466
+
100467
+ return result;
100468
+ }
100469
+
100395
100470
  /*
100396
100471
  N周期内第一个条件成立到当前的周期数.
100397
100472
  用法:
@@ -104413,10 +104488,15 @@ function JSAlgorithm(errorHandler,symbolData)
104413
104488
  return this.FILTER(args[0],args[1]);
104414
104489
  case 'TFILTER':
104415
104490
  return this.TFILTER(args[0],args[1],args[2]);
104491
+ case "FILTERX":
104492
+ return this.FILTERX(args[0],args[1],node);
104416
104493
  case 'SLOPE':
104417
104494
  return this.SLOPE(args[0],args[1]);
104418
104495
  case 'BARSLAST':
104419
104496
  return this.BARSLAST(args[0]);
104497
+ case "BARSLASTS":
104498
+ //this.ThrowUnexpectedNode(node,`函数'BARSLASTS'还在开发中`, name);
104499
+ return this.BARSLASTS(args[0],args[1],node);
104420
104500
  case 'BARSCOUNT':
104421
104501
  return this.BARSCOUNT(args[0]);
104422
104502
  case 'BARSSINCEN':
@@ -113867,6 +113947,7 @@ function JSExplainer(ast,option)
113867
113947
  this.JobList=[]; //执行的任务队列
113868
113948
  this.VarTable=new Map(); //变量表
113869
113949
  this.OutVarTable=[]; //输出变量
113950
+ this.MaxValueLength=150; //最长的字符
113870
113951
 
113871
113952
  //脚本自动变量表, 只读
113872
113953
  this.ConstVarTable=new Map(
@@ -114816,7 +114897,7 @@ function JSExplainer(ast,option)
114816
114897
 
114817
114898
  this.ConvertToShortValue=function(value)
114818
114899
  {
114819
- var maxLength=80;
114900
+ var maxLength=this.MaxValueLength;
114820
114901
  if (value && value.length>=maxLength)
114821
114902
  {
114822
114903
  var shortValue=value.slice(0, maxLength-10);
@@ -136483,7 +136564,7 @@ function HQChartScriptWorker()
136483
136564
 
136484
136565
 
136485
136566
 
136486
- var HQCHART_VERSION="1.1.13317";
136567
+ var HQCHART_VERSION="1.1.13323";
136487
136568
 
136488
136569
  function PrintHQChartVersion()
136489
136570
  {