hqchart 1.1.12635 → 1.1.12649

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.
@@ -934,6 +934,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
934
934
  if (IFrameSplitOperator.IsBool(item.IsShowXLine)) chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;
935
935
  if (IFrameSplitOperator.IsBool(item.IsShowYLine)) chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;
936
936
  if (IFrameSplitOperator.IsNumber(item.YTextBaseline)) chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;
937
+ if (IFrameSplitOperator.IsBool(item.IsShowIndexTitle)) chart.Frame.SubFrame[i].Frame.IsShowIndexTitle=item.IsShowIndexTitle;
937
938
 
938
939
  if (item.TopSpace>=0) chart.Frame.SubFrame[i].Frame.ChartBorder.TopSpace=item.TopSpace;
939
940
  if (item.BottomSpace>=0) chart.Frame.SubFrame[i].Frame.ChartBorder.BottomSpace=item.BottomSpace;
@@ -30547,13 +30548,13 @@ function ChartTradeIcon()
30547
30548
  var yOffset=0;
30548
30549
  if (this.TradeType=="BUY" || this.TradeType=="BUYSHORT")
30549
30550
  {
30550
- this.Canvas.textBaseline="bottom";
30551
- yOffset=-2;
30551
+ this.Canvas.textBaseline="top";
30552
+ yOffset+2;
30552
30553
  }
30553
30554
  else if (this.TradeType=="SELL" || this.TradeType=="SELLSHORT")
30554
30555
  {
30555
- this.Canvas.textBaseline="top";
30556
- yOffset+2;
30556
+ this.Canvas.textBaseline="bottom";
30557
+ yOffset=-2;
30557
30558
  }
30558
30559
 
30559
30560
  var bHScreen=(this.ChartFrame.IsHScreen===true);
@@ -30578,12 +30579,30 @@ function ChartTradeIcon()
30578
30579
  var right=xOffset+dataWidth;
30579
30580
  if (right>chartright) break;
30580
30581
 
30581
-
30582
30582
  var x=left+(right-left)/2;
30583
30583
  var y=this.GetYFromData(iconItem.Value, false);
30584
30584
 
30585
30585
  this.Canvas.fillStyle=iconItem.Color;
30586
- this.Canvas.fillText(iconItem.Icon,x,y+yOffset);
30586
+
30587
+ if (dataWidth>2) x=ToFixedPoint(x);
30588
+
30589
+ this.DrawTradeIcon(iconItem.Icon,x,y+yOffset, bHScreen);
30590
+ }
30591
+ }
30592
+
30593
+ this.DrawTradeIcon=function(text,x,y,isHScreen)
30594
+ {
30595
+ if (isHScreen)
30596
+ {
30597
+ this.Canvas.save();
30598
+ this.Canvas.translate(y, x);
30599
+ this.Canvas.rotate(90 * Math.PI / 180);
30600
+ this.Canvas.fillText(text,0,0);
30601
+ this.Canvas.restore();
30602
+ }
30603
+ else
30604
+ {
30605
+ this.Canvas.fillText(text,x,y);
30587
30606
  }
30588
30607
  }
30589
30608
 
@@ -48593,7 +48612,7 @@ function DynamicKLineTitlePainting()
48593
48612
  var item=this.OverlayChartPaint[i];
48594
48613
  if (!item.Symbol || !item.Title) continue;
48595
48614
 
48596
- data.OverlayStock.push({ Symbol:item.Symbol, Name:item.Title, Data:item.Data });
48615
+ data.OverlayStock.push({ Symbol:item.Symbol, Name:item.Title, Data:item.Data, Color:item.Color });
48597
48616
  }
48598
48617
  }
48599
48618
 
@@ -53149,6 +53168,7 @@ function ChartDrawHLine()
53149
53168
  this.IsPointIn=this.IsPointIn_XYValue_Line;
53150
53169
 
53151
53170
 
53171
+ /*
53152
53172
  this.GetXYCoordinate=function()
53153
53173
  {
53154
53174
  if (this.IsFrameMinSize()) return null;
@@ -53156,6 +53176,7 @@ function ChartDrawHLine()
53156
53176
 
53157
53177
  return this.PointRange(drawPoint);
53158
53178
  }
53179
+ */
53159
53180
 
53160
53181
  this.IsDrawMain=function() //选中绘制在动态绘图上, 没有选中绘制在背景上
53161
53182
  {
@@ -115,6 +115,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
115
115
  "OPEN":DATA_NAME, "O":DATA_NAME, "HIGH":DATA_NAME, "H":DATA_NAME, "LOW":DATA_NAME,"L":DATA_NAME,"AMOUNT":DATA_NAME,
116
116
  "CURRBARSCOUNT":DATA_NAME, "VOLINSTK":DATA_NAME, "ZSTJJ":DATA_NAME, "OPI":DATA_NAME,
117
117
 
118
+ "DOPEN":DATA_NAME,"DHIGH":DATA_NAME,"DLOW":DATA_NAME,"DCLOSE":DATA_NAME,"DVOL":DATA_NAME,
119
+
118
120
  //大盘数据
119
121
  "INDEXA":DATA_NAME,"INDEXC":DATA_NAME,"INDEXH":DATA_NAME,"INDEXL":DATA_NAME,"INDEXO":DATA_NAME,"INDEXV":DATA_NAME,'INDEXADV':DATA_NAME,'INDEXDEC':DATA_NAME,
120
122
  'UPCOUNT':FUNCTION_NAME,'DOWNCOUNT':FUNCTION_NAME,
@@ -133,7 +135,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
133
135
  'COLORSTICK':DRAW_NAME,'CIRCLEDOT':DRAW_NAME,'POINTDOT':DRAW_NAME,'LINESTICK':DRAW_NAME,'STICK':DRAW_NAME,'NODRAW':DRAW_NAME,
134
136
  "LINEAREA":DRAW_NAME,
135
137
 
136
- "BUY":DRAW_NAME,"SELL":DRAW_NAME,"SELLSHORT":DRAW_NAME,"BUYSHORT":DRAW_NAME,"TIPICON":DRAW_NAME,
138
+ "BUY":DRAW_NAME,"SELL":DRAW_NAME,"SELLSHORT":DRAW_NAME,"BUYSHORT":DRAW_NAME,"TIPICON":DRAW_NAME,"AUTOFILTER":FUNCTION_NAME,
137
139
 
138
140
  //颜色
139
141
  'COLORYELLOW':COLORYELLOW,'COLORBLACK':COLORBLACK,'COLORBLUE':COLORBLUE,'COLORGREEN':COLORGREEN,'COLORCYAN':COLORCYAN,'COLORRED':COLORRED,
@@ -5014,6 +5014,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5014
5014
  if (IFrameSplitOperator.IsBool(item.IsShowXLine)) chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;
5015
5015
  if (IFrameSplitOperator.IsBool(item.IsShowYLine)) chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;
5016
5016
  if (IFrameSplitOperator.IsNumber(item.YTextBaseline)) chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;
5017
+ if (IFrameSplitOperator.IsBool(item.IsShowIndexTitle)) chart.Frame.SubFrame[i].Frame.IsShowIndexTitle=item.IsShowIndexTitle;
5017
5018
 
5018
5019
  if (item.TopSpace>=0) chart.Frame.SubFrame[i].Frame.ChartBorder.TopSpace=item.TopSpace;
5019
5020
  if (item.BottomSpace>=0) chart.Frame.SubFrame[i].Frame.ChartBorder.BottomSpace=item.BottomSpace;
@@ -34627,13 +34628,13 @@ function ChartTradeIcon()
34627
34628
  var yOffset=0;
34628
34629
  if (this.TradeType=="BUY" || this.TradeType=="BUYSHORT")
34629
34630
  {
34630
- this.Canvas.textBaseline="bottom";
34631
- yOffset=-2;
34631
+ this.Canvas.textBaseline="top";
34632
+ yOffset+2;
34632
34633
  }
34633
34634
  else if (this.TradeType=="SELL" || this.TradeType=="SELLSHORT")
34634
34635
  {
34635
- this.Canvas.textBaseline="top";
34636
- yOffset+2;
34636
+ this.Canvas.textBaseline="bottom";
34637
+ yOffset=-2;
34637
34638
  }
34638
34639
 
34639
34640
  var bHScreen=(this.ChartFrame.IsHScreen===true);
@@ -34658,12 +34659,30 @@ function ChartTradeIcon()
34658
34659
  var right=xOffset+dataWidth;
34659
34660
  if (right>chartright) break;
34660
34661
 
34661
-
34662
34662
  var x=left+(right-left)/2;
34663
34663
  var y=this.GetYFromData(iconItem.Value, false);
34664
34664
 
34665
34665
  this.Canvas.fillStyle=iconItem.Color;
34666
- this.Canvas.fillText(iconItem.Icon,x,y+yOffset);
34666
+
34667
+ if (dataWidth>2) x=ToFixedPoint(x);
34668
+
34669
+ this.DrawTradeIcon(iconItem.Icon,x,y+yOffset, bHScreen);
34670
+ }
34671
+ }
34672
+
34673
+ this.DrawTradeIcon=function(text,x,y,isHScreen)
34674
+ {
34675
+ if (isHScreen)
34676
+ {
34677
+ this.Canvas.save();
34678
+ this.Canvas.translate(y, x);
34679
+ this.Canvas.rotate(90 * Math.PI / 180);
34680
+ this.Canvas.fillText(text,0,0);
34681
+ this.Canvas.restore();
34682
+ }
34683
+ else
34684
+ {
34685
+ this.Canvas.fillText(text,x,y);
34667
34686
  }
34668
34687
  }
34669
34688
 
@@ -52673,7 +52692,7 @@ function DynamicKLineTitlePainting()
52673
52692
  var item=this.OverlayChartPaint[i];
52674
52693
  if (!item.Symbol || !item.Title) continue;
52675
52694
 
52676
- data.OverlayStock.push({ Symbol:item.Symbol, Name:item.Title, Data:item.Data });
52695
+ data.OverlayStock.push({ Symbol:item.Symbol, Name:item.Title, Data:item.Data, Color:item.Color });
52677
52696
  }
52678
52697
  }
52679
52698
 
@@ -57229,6 +57248,7 @@ function ChartDrawHLine()
57229
57248
  this.IsPointIn=this.IsPointIn_XYValue_Line;
57230
57249
 
57231
57250
 
57251
+ /*
57232
57252
  this.GetXYCoordinate=function()
57233
57253
  {
57234
57254
  if (this.IsFrameMinSize()) return null;
@@ -57236,6 +57256,7 @@ function ChartDrawHLine()
57236
57256
 
57237
57257
  return this.PointRange(drawPoint);
57238
57258
  }
57259
+ */
57239
57260
 
57240
57261
  this.IsDrawMain=function() //选中绘制在动态绘图上, 没有选中绘制在背景上
57241
57262
  {
@@ -107294,6 +107315,46 @@ function JSSymbolData(ast,option,jsExecute)
107294
107315
  return result;
107295
107316
  }
107296
107317
 
107318
+ //求真实波幅, (最高-最低),(最高-昨收),(最低-昨收)三者绝对值中的最大值.
107319
+ //用法:
107320
+ //TR,求真实波幅.
107321
+ //例如:ATR:=MA(TR,10);
107322
+ //表示求真实波幅的10周期均值
107323
+ this.GetTRData=function(node)
107324
+ {
107325
+ var result=[];
107326
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return result;
107327
+
107328
+ let lCount=this.Data.Data.length;
107329
+ for(var i=0 ;i<lCount;++i)
107330
+ {
107331
+ var item=this.Data.Data[i];
107332
+ var max=null;
107333
+ if (IFrameSplitOperator.IsNumber(item.High) && IFrameSplitOperator.IsNumber(item.Low))
107334
+ {
107335
+ var value=Math.abs(item.High-item.Low);
107336
+ if (max==null || max<value) max=value;
107337
+ }
107338
+
107339
+ if (IFrameSplitOperator.IsNumber(item.High) && IFrameSplitOperator.IsNumber(item.YClose))
107340
+ {
107341
+ var value=Math.abs(item.High-item.YClose);
107342
+ if (max==null || max<value) max=value;
107343
+ }
107344
+
107345
+ if (IFrameSplitOperator.IsNumber(item.YClose) && IFrameSplitOperator.IsNumber(item.Low))
107346
+ {
107347
+ var value=Math.abs(item.Low-item.YClose);
107348
+ if (max==null || max<value) max=value;
107349
+ }
107350
+
107351
+ result[i]=max;
107352
+ }
107353
+
107354
+
107355
+ return result;
107356
+ }
107357
+
107297
107358
  //融资融券函数
107298
107359
  this.GetMarginCacheData=function(id, node)
107299
107360
  {
@@ -110433,7 +110494,10 @@ function JSExecute(ast,option)
110433
110494
  ['DRAWNULL',null],
110434
110495
  ["NULL",null],
110435
110496
 
110436
- ["MACHINEDATE",null],["MACHINETIME",null],["MACHINEWEEK",null]
110497
+ ["MACHINEDATE",null],["MACHINETIME",null],["MACHINEWEEK",null],
110498
+
110499
+ ["TR", null], //真实波幅
110500
+ ["AUTOFILTER", null]
110437
110501
 
110438
110502
  ]);
110439
110503
 
@@ -110601,6 +110665,9 @@ function JSExecute(ast,option)
110601
110665
  case 'VOLR':
110602
110666
  return this.SymbolData.GetVolRateCacheData(node);
110603
110667
 
110668
+ case "TR": //TR,求真实波幅.
110669
+ return this.SymbolData.GetTRData(node);
110670
+
110604
110671
  //大盘数据
110605
110672
  case 'INDEXA':
110606
110673
  case 'INDEXC':
@@ -112031,7 +112098,8 @@ function JSExplainer(ast,option)
112031
112098
  ["HYSYL","指数市盈率或个股所属行业的市盈率"],
112032
112099
  ["HYSJL","指数市净率或个股所属行业的市净率"],
112033
112100
 
112034
- ['DRAWNULL',"无效数据"]
112101
+ ['DRAWNULL',"无效数据"],
112102
+ ["TR", "求真实波幅"],
112035
112103
 
112036
112104
  ]);
112037
112105
 
@@ -112166,6 +112234,8 @@ function JSExplainer(ast,option)
112166
112234
  let isDotLine=false;
112167
112235
  let isOverlayLine=false; //叠加线
112168
112236
  var isNoneName=false;
112237
+ var fontSize=-1;
112238
+ var drawAlign=-1, drawVAlign=-1;
112169
112239
  //显示在位置之上,对于DRAWTEXT和DRAWNUMBER等函数有用,放在语句的最后面(不能与LINETHICK等函数共用),比如:
112170
112240
  //DRAWNUMBER(CLOSE>OPEN,HIGH,CLOSE),DRAWABOVE;
112171
112241
  var isDrawAbove=false;
@@ -112191,9 +112261,23 @@ function JSExplainer(ast,option)
112191
112261
  else if (value==="DRAWABOVE") isDrawAbove=true;
112192
112262
  else if (value.indexOf('COLOR')==0) color=value;
112193
112263
  else if (value.indexOf('LINETHICK')==0) lineWidth=value;
112264
+
112265
+ else if (value=="ALIGN0") drawAlign=0;
112266
+ else if (value=="ALIGN1") drawAlign=1;
112267
+ else if (value=="ALIGN2") drawAlign=2;
112268
+
112269
+ else if (value=="VALIGN0") drawVAlign=0;
112270
+ else if (value=="VALIGN1") drawVAlign=1;
112271
+ else if (value=="VALIGN2") drawVAlign=2;
112272
+
112194
112273
  else if (value.indexOf('NODRAW')==0) isShow=false;
112195
112274
  else if (value.indexOf('EXDATA')==0) isExData=true; //扩展数据, 不显示再图形里面
112196
112275
  else if (value.indexOf('LINEOVERLAY')==0) isOverlayLine=true;
112276
+ else if (value.indexOf("FONTSIZE")==0)
112277
+ {
112278
+ var strFontSize=value.replace("FONTSIZE","");
112279
+ fontSize=parseInt(strFontSize);
112280
+ }
112197
112281
  else
112198
112282
  {
112199
112283
  varName=itemExpression.Name;
@@ -112212,17 +112296,20 @@ function JSExplainer(ast,option)
112212
112296
  }
112213
112297
  else if (itemExpression.Type==Syntax.CallExpression)
112214
112298
  {
112215
- if (this.IsDrawFunction(itemExpression.Callee.Name))
112216
- {
112217
- draw=itemExpression.Out;
112218
- drawName=itemExpression.Callee.Name;
112219
- }
112220
- else
112299
+ if (j==0)
112221
112300
  {
112222
- let varValue=itemExpression.Out;
112223
- varName=`__temp_sc_${itemExpression.Callee.Name}_${i}__`;
112224
- isNoneName=true;
112225
- this.VarTable.set(varName,varValue);
112301
+ if (this.IsDrawFunction(itemExpression.Callee.Name))
112302
+ {
112303
+ draw=itemExpression.Out;
112304
+ drawName=itemExpression.Callee.Name;
112305
+ }
112306
+ else
112307
+ {
112308
+ let varValue=itemExpression.Out;
112309
+ varName=`__temp_sc_${itemExpression.Callee.Name}_${i}__`;
112310
+ isNoneName=true;
112311
+ this.VarTable.set(varName,varValue);
112312
+ }
112226
112313
  }
112227
112314
  }
112228
112315
  else if (itemExpression.Type==Syntax.BinaryExpression)
@@ -112507,6 +112594,7 @@ function JSExplainer(ast,option)
112507
112594
  ["CODELIKE", { Name:"CODELIKE", Param:{ Count:1 }, ToString:function(args) { return `查找品种名称中包含${args[0]}`; } } ],
112508
112595
  ["INBLOCK", { Name:"AVEDEV", Param:{ Count:1 }, ToString:function(args) { return `属于${args[0]}板块`; } } ],
112509
112596
  ["STKINDI",{ Name:"STKINDI", Param:{ Dynamic:true }, ToString:function(args) { return "指标引用"; } }],
112597
+ ["STRFORMAT",{ Name:"STRFORMAT", Param:{ Dynamic:true }, ToString:function(args) { return `格式化${args[0]}字符串`; } }],
112510
112598
 
112511
112599
 
112512
112600
  [
@@ -112619,6 +112707,8 @@ function JSExplainer(ast,option)
112619
112707
  return "相对位置上画矩形.";
112620
112708
  case "DRAWGBK":
112621
112709
  return "填充背景";
112710
+ case "TIPICON":
112711
+ return `当满足条件${args[0]}时,在${args[1]}位置画${args[2]}号图标`;
112622
112712
  case "STICKLINE":
112623
112713
  var barType="";
112624
112714
  if (args[4]==-1) barType="虚线空心柱";
@@ -112626,6 +112716,18 @@ function JSExplainer(ast,option)
112626
112716
  else barType="实线空心柱";
112627
112717
  return `当满足条件${args[0]}时, 在${args[1]}和${args[2]}位置之间画柱状线,宽度为${args[3]},${barType}`;
112628
112718
 
112719
+ case "SELL":
112720
+ return "卖出平仓";
112721
+ case "BUY":
112722
+ return "买入开仓";
112723
+ case "SELLSHORT":
112724
+ return "卖出开仓";
112725
+ case "BUYSHORT":
112726
+ return "买入平仓";
112727
+
112728
+ case "YMOVE":
112729
+ return;
112730
+
112629
112731
  default:
112630
112732
  this.ThrowUnexpectedNode(node,`函数${funcName}不存在`);
112631
112733
  }
@@ -112768,7 +112870,8 @@ function JSExplainer(ast,option)
112768
112870
  [
112769
112871
  "STICKLINE","DRAWTEXT",'SUPERDRAWTEXT','DRAWLINE','DRAWBAND','DRAWKLINE',"DRAWKLINE1",'DRAWKLINE_IF','PLOYLINE',
112770
112872
  'POLYLINE','DRAWNUMBER',"DRAWNUMBER_FIX",'DRAWICON','DRAWCHANNEL','PARTLINE','DRAWTEXT_FIX','DRAWGBK','DRAWTEXT_LINE','DRAWRECTREL',"DRAWTEXTABS",
112771
- 'DRAWOVERLAYLINE',"FILLRGN", "FILLRGN2","FILLTOPRGN", "FILLBOTTOMRGN", "FILLVERTICALRGN","FLOATRGN","DRAWSL", "DRAWGBK2"
112873
+ 'DRAWOVERLAYLINE',"FILLRGN", "FILLRGN2","FILLTOPRGN", "FILLBOTTOMRGN", "FILLVERTICALRGN","FLOATRGN","DRAWSL", "DRAWGBK2",
112874
+ "BUY","BUYSHORT","SELL","SELLSHORT",
112772
112875
  ]);
112773
112876
  if (setFunctionName.has(name)) return true;
112774
112877
 
@@ -112968,10 +113071,21 @@ function JSExplainer(ast,option)
112968
113071
  return this.SymbolPeriodExplain(aryPeriod[0],aryPeriod[1]);
112969
113072
  }
112970
113073
 
113074
+ if (name=="AUTOFILTER") //信号过滤
113075
+ {
113076
+ return this.AUTOFILTER();
113077
+ }
113078
+
112971
113079
  this.ThrowUnexpectedNode(node, '变量'+name+'不存在');
112972
113080
  return name;
112973
113081
  }
112974
113082
 
113083
+ this.AUTOFILTER=function()
113084
+ {
113085
+ //TODO:过滤信号
113086
+ return null;
113087
+ }
113088
+
112975
113089
  this.ThrowUnexpectedNode=function(node,message)
112976
113090
  {
112977
113091
  let marker=node.Marker;
@@ -119154,7 +119268,21 @@ var tokens=JSComplier.Tokenize(code1+code2);
119154
119268
  var ast=JSComplier.Parse(code2+code1);
119155
119269
 
119156
119270
  JSConsole.Complier.Log(ast);
119157
- *//*
119271
+ */
119272
+
119273
+ //外部通达信的变量 这些需要外部自己计算
119274
+ JSComplier.AddVariant({ Name:'DHIGH', Description:'不定周期最高价' } );
119275
+ JSComplier.AddVariant({ Name:'DOPEN', Description:'不定周期开盘价' } );
119276
+ JSComplier.AddVariant({ Name:'DLOW', Description:'不定周期最低价' } );
119277
+ JSComplier.AddVariant({ Name:'DCLOSE', Description:'不定周期收盘价' } );
119278
+ JSComplier.AddVariant({ Name:'DVOL', Description:'不定周期成交量价' } );
119279
+
119280
+
119281
+
119282
+
119283
+
119284
+
119285
+ /*
119158
119286
  Copyright (c) 2018 jones
119159
119287
 
119160
119288
  http://www.apache.org/licenses/LICENSE-2.0
@@ -130038,7 +130166,7 @@ function ScrollBarBGChart()
130038
130166
 
130039
130167
 
130040
130168
 
130041
- var HQCHART_VERSION="1.1.12634";
130169
+ var HQCHART_VERSION="1.1.12648";
130042
130170
 
130043
130171
  function PrintHQChartVersion()
130044
130172
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.12634";
8
+ var HQCHART_VERSION="1.1.12648";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {