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.
@@ -5058,6 +5058,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5058
5058
  if (IFrameSplitOperator.IsBool(item.IsShowXLine)) chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;
5059
5059
  if (IFrameSplitOperator.IsBool(item.IsShowYLine)) chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;
5060
5060
  if (IFrameSplitOperator.IsNumber(item.YTextBaseline)) chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;
5061
+ if (IFrameSplitOperator.IsBool(item.IsShowIndexTitle)) chart.Frame.SubFrame[i].Frame.IsShowIndexTitle=item.IsShowIndexTitle;
5061
5062
 
5062
5063
  if (item.TopSpace>=0) chart.Frame.SubFrame[i].Frame.ChartBorder.TopSpace=item.TopSpace;
5063
5064
  if (item.BottomSpace>=0) chart.Frame.SubFrame[i].Frame.ChartBorder.BottomSpace=item.BottomSpace;
@@ -34671,13 +34672,13 @@ function ChartTradeIcon()
34671
34672
  var yOffset=0;
34672
34673
  if (this.TradeType=="BUY" || this.TradeType=="BUYSHORT")
34673
34674
  {
34674
- this.Canvas.textBaseline="bottom";
34675
- yOffset=-2;
34675
+ this.Canvas.textBaseline="top";
34676
+ yOffset+2;
34676
34677
  }
34677
34678
  else if (this.TradeType=="SELL" || this.TradeType=="SELLSHORT")
34678
34679
  {
34679
- this.Canvas.textBaseline="top";
34680
- yOffset+2;
34680
+ this.Canvas.textBaseline="bottom";
34681
+ yOffset=-2;
34681
34682
  }
34682
34683
 
34683
34684
  var bHScreen=(this.ChartFrame.IsHScreen===true);
@@ -34702,12 +34703,30 @@ function ChartTradeIcon()
34702
34703
  var right=xOffset+dataWidth;
34703
34704
  if (right>chartright) break;
34704
34705
 
34705
-
34706
34706
  var x=left+(right-left)/2;
34707
34707
  var y=this.GetYFromData(iconItem.Value, false);
34708
34708
 
34709
34709
  this.Canvas.fillStyle=iconItem.Color;
34710
- this.Canvas.fillText(iconItem.Icon,x,y+yOffset);
34710
+
34711
+ if (dataWidth>2) x=ToFixedPoint(x);
34712
+
34713
+ this.DrawTradeIcon(iconItem.Icon,x,y+yOffset, bHScreen);
34714
+ }
34715
+ }
34716
+
34717
+ this.DrawTradeIcon=function(text,x,y,isHScreen)
34718
+ {
34719
+ if (isHScreen)
34720
+ {
34721
+ this.Canvas.save();
34722
+ this.Canvas.translate(y, x);
34723
+ this.Canvas.rotate(90 * Math.PI / 180);
34724
+ this.Canvas.fillText(text,0,0);
34725
+ this.Canvas.restore();
34726
+ }
34727
+ else
34728
+ {
34729
+ this.Canvas.fillText(text,x,y);
34711
34730
  }
34712
34731
  }
34713
34732
 
@@ -52717,7 +52736,7 @@ function DynamicKLineTitlePainting()
52717
52736
  var item=this.OverlayChartPaint[i];
52718
52737
  if (!item.Symbol || !item.Title) continue;
52719
52738
 
52720
- data.OverlayStock.push({ Symbol:item.Symbol, Name:item.Title, Data:item.Data });
52739
+ data.OverlayStock.push({ Symbol:item.Symbol, Name:item.Title, Data:item.Data, Color:item.Color });
52721
52740
  }
52722
52741
  }
52723
52742
 
@@ -57273,6 +57292,7 @@ function ChartDrawHLine()
57273
57292
  this.IsPointIn=this.IsPointIn_XYValue_Line;
57274
57293
 
57275
57294
 
57295
+ /*
57276
57296
  this.GetXYCoordinate=function()
57277
57297
  {
57278
57298
  if (this.IsFrameMinSize()) return null;
@@ -57280,6 +57300,7 @@ function ChartDrawHLine()
57280
57300
 
57281
57301
  return this.PointRange(drawPoint);
57282
57302
  }
57303
+ */
57283
57304
 
57284
57305
  this.IsDrawMain=function() //选中绘制在动态绘图上, 没有选中绘制在背景上
57285
57306
  {
@@ -107338,6 +107359,46 @@ function JSSymbolData(ast,option,jsExecute)
107338
107359
  return result;
107339
107360
  }
107340
107361
 
107362
+ //求真实波幅, (最高-最低),(最高-昨收),(最低-昨收)三者绝对值中的最大值.
107363
+ //用法:
107364
+ //TR,求真实波幅.
107365
+ //例如:ATR:=MA(TR,10);
107366
+ //表示求真实波幅的10周期均值
107367
+ this.GetTRData=function(node)
107368
+ {
107369
+ var result=[];
107370
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return result;
107371
+
107372
+ let lCount=this.Data.Data.length;
107373
+ for(var i=0 ;i<lCount;++i)
107374
+ {
107375
+ var item=this.Data.Data[i];
107376
+ var max=null;
107377
+ if (IFrameSplitOperator.IsNumber(item.High) && IFrameSplitOperator.IsNumber(item.Low))
107378
+ {
107379
+ var value=Math.abs(item.High-item.Low);
107380
+ if (max==null || max<value) max=value;
107381
+ }
107382
+
107383
+ if (IFrameSplitOperator.IsNumber(item.High) && IFrameSplitOperator.IsNumber(item.YClose))
107384
+ {
107385
+ var value=Math.abs(item.High-item.YClose);
107386
+ if (max==null || max<value) max=value;
107387
+ }
107388
+
107389
+ if (IFrameSplitOperator.IsNumber(item.YClose) && IFrameSplitOperator.IsNumber(item.Low))
107390
+ {
107391
+ var value=Math.abs(item.Low-item.YClose);
107392
+ if (max==null || max<value) max=value;
107393
+ }
107394
+
107395
+ result[i]=max;
107396
+ }
107397
+
107398
+
107399
+ return result;
107400
+ }
107401
+
107341
107402
  //融资融券函数
107342
107403
  this.GetMarginCacheData=function(id, node)
107343
107404
  {
@@ -110477,7 +110538,10 @@ function JSExecute(ast,option)
110477
110538
  ['DRAWNULL',null],
110478
110539
  ["NULL",null],
110479
110540
 
110480
- ["MACHINEDATE",null],["MACHINETIME",null],["MACHINEWEEK",null]
110541
+ ["MACHINEDATE",null],["MACHINETIME",null],["MACHINEWEEK",null],
110542
+
110543
+ ["TR", null], //真实波幅
110544
+ ["AUTOFILTER", null]
110481
110545
 
110482
110546
  ]);
110483
110547
 
@@ -110645,6 +110709,9 @@ function JSExecute(ast,option)
110645
110709
  case 'VOLR':
110646
110710
  return this.SymbolData.GetVolRateCacheData(node);
110647
110711
 
110712
+ case "TR": //TR,求真实波幅.
110713
+ return this.SymbolData.GetTRData(node);
110714
+
110648
110715
  //大盘数据
110649
110716
  case 'INDEXA':
110650
110717
  case 'INDEXC':
@@ -112075,7 +112142,8 @@ function JSExplainer(ast,option)
112075
112142
  ["HYSYL","指数市盈率或个股所属行业的市盈率"],
112076
112143
  ["HYSJL","指数市净率或个股所属行业的市净率"],
112077
112144
 
112078
- ['DRAWNULL',"无效数据"]
112145
+ ['DRAWNULL',"无效数据"],
112146
+ ["TR", "求真实波幅"],
112079
112147
 
112080
112148
  ]);
112081
112149
 
@@ -112210,6 +112278,8 @@ function JSExplainer(ast,option)
112210
112278
  let isDotLine=false;
112211
112279
  let isOverlayLine=false; //叠加线
112212
112280
  var isNoneName=false;
112281
+ var fontSize=-1;
112282
+ var drawAlign=-1, drawVAlign=-1;
112213
112283
  //显示在位置之上,对于DRAWTEXT和DRAWNUMBER等函数有用,放在语句的最后面(不能与LINETHICK等函数共用),比如:
112214
112284
  //DRAWNUMBER(CLOSE>OPEN,HIGH,CLOSE),DRAWABOVE;
112215
112285
  var isDrawAbove=false;
@@ -112235,9 +112305,23 @@ function JSExplainer(ast,option)
112235
112305
  else if (value==="DRAWABOVE") isDrawAbove=true;
112236
112306
  else if (value.indexOf('COLOR')==0) color=value;
112237
112307
  else if (value.indexOf('LINETHICK')==0) lineWidth=value;
112308
+
112309
+ else if (value=="ALIGN0") drawAlign=0;
112310
+ else if (value=="ALIGN1") drawAlign=1;
112311
+ else if (value=="ALIGN2") drawAlign=2;
112312
+
112313
+ else if (value=="VALIGN0") drawVAlign=0;
112314
+ else if (value=="VALIGN1") drawVAlign=1;
112315
+ else if (value=="VALIGN2") drawVAlign=2;
112316
+
112238
112317
  else if (value.indexOf('NODRAW')==0) isShow=false;
112239
112318
  else if (value.indexOf('EXDATA')==0) isExData=true; //扩展数据, 不显示再图形里面
112240
112319
  else if (value.indexOf('LINEOVERLAY')==0) isOverlayLine=true;
112320
+ else if (value.indexOf("FONTSIZE")==0)
112321
+ {
112322
+ var strFontSize=value.replace("FONTSIZE","");
112323
+ fontSize=parseInt(strFontSize);
112324
+ }
112241
112325
  else
112242
112326
  {
112243
112327
  varName=itemExpression.Name;
@@ -112256,17 +112340,20 @@ function JSExplainer(ast,option)
112256
112340
  }
112257
112341
  else if (itemExpression.Type==Syntax.CallExpression)
112258
112342
  {
112259
- if (this.IsDrawFunction(itemExpression.Callee.Name))
112260
- {
112261
- draw=itemExpression.Out;
112262
- drawName=itemExpression.Callee.Name;
112263
- }
112264
- else
112343
+ if (j==0)
112265
112344
  {
112266
- let varValue=itemExpression.Out;
112267
- varName=`__temp_sc_${itemExpression.Callee.Name}_${i}__`;
112268
- isNoneName=true;
112269
- this.VarTable.set(varName,varValue);
112345
+ if (this.IsDrawFunction(itemExpression.Callee.Name))
112346
+ {
112347
+ draw=itemExpression.Out;
112348
+ drawName=itemExpression.Callee.Name;
112349
+ }
112350
+ else
112351
+ {
112352
+ let varValue=itemExpression.Out;
112353
+ varName=`__temp_sc_${itemExpression.Callee.Name}_${i}__`;
112354
+ isNoneName=true;
112355
+ this.VarTable.set(varName,varValue);
112356
+ }
112270
112357
  }
112271
112358
  }
112272
112359
  else if (itemExpression.Type==Syntax.BinaryExpression)
@@ -112551,6 +112638,7 @@ function JSExplainer(ast,option)
112551
112638
  ["CODELIKE", { Name:"CODELIKE", Param:{ Count:1 }, ToString:function(args) { return `查找品种名称中包含${args[0]}`; } } ],
112552
112639
  ["INBLOCK", { Name:"AVEDEV", Param:{ Count:1 }, ToString:function(args) { return `属于${args[0]}板块`; } } ],
112553
112640
  ["STKINDI",{ Name:"STKINDI", Param:{ Dynamic:true }, ToString:function(args) { return "指标引用"; } }],
112641
+ ["STRFORMAT",{ Name:"STRFORMAT", Param:{ Dynamic:true }, ToString:function(args) { return `格式化${args[0]}字符串`; } }],
112554
112642
 
112555
112643
 
112556
112644
  [
@@ -112663,6 +112751,8 @@ function JSExplainer(ast,option)
112663
112751
  return "相对位置上画矩形.";
112664
112752
  case "DRAWGBK":
112665
112753
  return "填充背景";
112754
+ case "TIPICON":
112755
+ return `当满足条件${args[0]}时,在${args[1]}位置画${args[2]}号图标`;
112666
112756
  case "STICKLINE":
112667
112757
  var barType="";
112668
112758
  if (args[4]==-1) barType="虚线空心柱";
@@ -112670,6 +112760,18 @@ function JSExplainer(ast,option)
112670
112760
  else barType="实线空心柱";
112671
112761
  return `当满足条件${args[0]}时, 在${args[1]}和${args[2]}位置之间画柱状线,宽度为${args[3]},${barType}`;
112672
112762
 
112763
+ case "SELL":
112764
+ return "卖出平仓";
112765
+ case "BUY":
112766
+ return "买入开仓";
112767
+ case "SELLSHORT":
112768
+ return "卖出开仓";
112769
+ case "BUYSHORT":
112770
+ return "买入平仓";
112771
+
112772
+ case "YMOVE":
112773
+ return;
112774
+
112673
112775
  default:
112674
112776
  this.ThrowUnexpectedNode(node,`函数${funcName}不存在`);
112675
112777
  }
@@ -112812,7 +112914,8 @@ function JSExplainer(ast,option)
112812
112914
  [
112813
112915
  "STICKLINE","DRAWTEXT",'SUPERDRAWTEXT','DRAWLINE','DRAWBAND','DRAWKLINE',"DRAWKLINE1",'DRAWKLINE_IF','PLOYLINE',
112814
112916
  'POLYLINE','DRAWNUMBER',"DRAWNUMBER_FIX",'DRAWICON','DRAWCHANNEL','PARTLINE','DRAWTEXT_FIX','DRAWGBK','DRAWTEXT_LINE','DRAWRECTREL',"DRAWTEXTABS",
112815
- 'DRAWOVERLAYLINE',"FILLRGN", "FILLRGN2","FILLTOPRGN", "FILLBOTTOMRGN", "FILLVERTICALRGN","FLOATRGN","DRAWSL", "DRAWGBK2"
112917
+ 'DRAWOVERLAYLINE',"FILLRGN", "FILLRGN2","FILLTOPRGN", "FILLBOTTOMRGN", "FILLVERTICALRGN","FLOATRGN","DRAWSL", "DRAWGBK2",
112918
+ "BUY","BUYSHORT","SELL","SELLSHORT",
112816
112919
  ]);
112817
112920
  if (setFunctionName.has(name)) return true;
112818
112921
 
@@ -113012,10 +113115,21 @@ function JSExplainer(ast,option)
113012
113115
  return this.SymbolPeriodExplain(aryPeriod[0],aryPeriod[1]);
113013
113116
  }
113014
113117
 
113118
+ if (name=="AUTOFILTER") //信号过滤
113119
+ {
113120
+ return this.AUTOFILTER();
113121
+ }
113122
+
113015
113123
  this.ThrowUnexpectedNode(node, '变量'+name+'不存在');
113016
113124
  return name;
113017
113125
  }
113018
113126
 
113127
+ this.AUTOFILTER=function()
113128
+ {
113129
+ //TODO:过滤信号
113130
+ return null;
113131
+ }
113132
+
113019
113133
  this.ThrowUnexpectedNode=function(node,message)
113020
113134
  {
113021
113135
  let marker=node.Marker;
@@ -119198,7 +119312,21 @@ var tokens=JSComplier.Tokenize(code1+code2);
119198
119312
  var ast=JSComplier.Parse(code2+code1);
119199
119313
 
119200
119314
  JSConsole.Complier.Log(ast);
119201
- *//*
119315
+ */
119316
+
119317
+ //外部通达信的变量 这些需要外部自己计算
119318
+ JSComplier.AddVariant({ Name:'DHIGH', Description:'不定周期最高价' } );
119319
+ JSComplier.AddVariant({ Name:'DOPEN', Description:'不定周期开盘价' } );
119320
+ JSComplier.AddVariant({ Name:'DLOW', Description:'不定周期最低价' } );
119321
+ JSComplier.AddVariant({ Name:'DCLOSE', Description:'不定周期收盘价' } );
119322
+ JSComplier.AddVariant({ Name:'DVOL', Description:'不定周期成交量价' } );
119323
+
119324
+
119325
+
119326
+
119327
+
119328
+
119329
+ /*
119202
119330
  Copyright (c) 2018 jones
119203
119331
 
119204
119332
  http://www.apache.org/licenses/LICENSE-2.0
@@ -130196,7 +130324,7 @@ function HQChartScriptWorker()
130196
130324
 
130197
130325
 
130198
130326
 
130199
- var HQCHART_VERSION="1.1.12634";
130327
+ var HQCHART_VERSION="1.1.12648";
130200
130328
 
130201
130329
  function PrintHQChartVersion()
130202
130330
  {