hqchart 1.1.12655 → 1.1.12674
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/lib/umychart.vue.js +42 -8
- package/package.json +1 -1
- package/src/jscommon/umychart.complier.js +46 -0
- package/src/jscommon/umychart.index.data.js +64 -0
- package/src/jscommon/umychart.js +113 -39
- package/src/jscommon/umychart.resource/js/codemirror/javascript.js +6 -2
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +224 -40
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +224 -40
- package/src/jscommon/umychart.wechat/umychart.chartpaint.wechat.js +10 -0
- package/src/jscommon/umychart.wechat/umychart.complier.wechat.js +44 -0
- package/src/jscommon/umychart.wechat/umychart.element.wechart.js +1 -1
- package/src/jscommon/umychart.wechat/umychart.framesplit.wechat.js +2 -0
- package/src/jscommon/umychart.wechat/umychart.version.wechat.js +1 -1
- package/src/jscommon/umychart.wechat/umychart.wechat.3.0.js +1 -0
|
@@ -121,6 +121,7 @@ function JSIndexScript()
|
|
|
121
121
|
['EMPTY', this.EMPTY], //什么都不显示的指标
|
|
122
122
|
['神奇九转', this.NineTurns],
|
|
123
123
|
['EMA', this.EMA3], ['EMA4', this.EMA4], ['EMA5', this.EMA5],['EMA6', this.EMA6],
|
|
124
|
+
["ICHIMOKU",this.ICHIMOKU],["CDP-STD", this.CDP_STD],["TBP-STD",this.TBP_STD],
|
|
124
125
|
|
|
125
126
|
//通达信特色指标
|
|
126
127
|
["散户线", this.ShareholderCount],["NXTS", this.NXTS],["FKX", this.FKX],["两融资金", this.Margin4],
|
|
@@ -4061,6 +4062,69 @@ DRAWTEXT(D9,H*1.010,'9'),COLORGREEN;"
|
|
|
4061
4062
|
return data;
|
|
4062
4063
|
}
|
|
4063
4064
|
|
|
4065
|
+
JSIndexScript.prototype.ICHIMOKU=function()
|
|
4066
|
+
{
|
|
4067
|
+
let data =
|
|
4068
|
+
{
|
|
4069
|
+
Name: 'ICHIMOKU', Description: '一目均衡图', IsMainIndex: true,
|
|
4070
|
+
Args: [{ Name: 'SHORT', Value: 7 },{ Name: 'MID', Value: 22 },{ Name: 'LONG', Value: 44 }],
|
|
4071
|
+
Script: //脚本
|
|
4072
|
+
"转换线:(HHV(H,SHORT)+LLV(L,SHORT))/2,COLORRED,LINETHICK2;\n\
|
|
4073
|
+
基准线:(HHV(H,MID)+LLV(L,MID))/2,COLORFF8040,LINETHICK2;\n\
|
|
4074
|
+
迟行带:REFXV(C,MID),COLORGRAY,LINETHICK2;\n\
|
|
4075
|
+
A:=REF((转换线+基准线)/2,MID);\n\
|
|
4076
|
+
B:=REF((HHV(H,LONG)+LLV(L,LONG))/2,MID);\n\
|
|
4077
|
+
STICKLINE(A<B,A,B,2,1),COLOR339933;\n\
|
|
4078
|
+
STICKLINE(A>=B,A,B,2,1),COLOR0033CC;\n\
|
|
4079
|
+
先行带A:PLOYLINE(1,A),COLORBROWN;\n\
|
|
4080
|
+
先行带B:PLOYLINE(1,B),COLORLIGREEN;"
|
|
4081
|
+
};
|
|
4082
|
+
|
|
4083
|
+
return data;
|
|
4084
|
+
}
|
|
4085
|
+
|
|
4086
|
+
JSIndexScript.prototype.CDP_STD=function()
|
|
4087
|
+
{
|
|
4088
|
+
let data =
|
|
4089
|
+
{
|
|
4090
|
+
Name: 'CDP-STD', Description: '逆势操作', IsMainIndex: true,
|
|
4091
|
+
Script: //脚本
|
|
4092
|
+
"CH:=REF(H,1);\n\
|
|
4093
|
+
CL:=REF(L,1);\n\
|
|
4094
|
+
CC:=REF(C,1);\n\
|
|
4095
|
+
CDP:(CH+CL+CC)/3;\n\
|
|
4096
|
+
AH:2*CDP+CH-2*CL;\n\
|
|
4097
|
+
NH:CDP+CDP-CL;\n\
|
|
4098
|
+
NL:CDP+CDP-CH;\n\
|
|
4099
|
+
AL:2*CDP-2*CH+CL;"
|
|
4100
|
+
};
|
|
4101
|
+
|
|
4102
|
+
return data;
|
|
4103
|
+
}
|
|
4104
|
+
|
|
4105
|
+
JSIndexScript.prototype.TBP_STD=function()
|
|
4106
|
+
{
|
|
4107
|
+
let data =
|
|
4108
|
+
{
|
|
4109
|
+
Name: 'TBP-STD', Description: '趋势平衡点', IsMainIndex: true,
|
|
4110
|
+
Script: //脚本
|
|
4111
|
+
"APX:=(H+L+C)/3;\n\
|
|
4112
|
+
TR0:=MAX(H-L,MAX(ABS(H-REF(C,1)),ABS(L-REF(C,1))));\n\
|
|
4113
|
+
MF0:=C-REF(C,2);\n\
|
|
4114
|
+
MF1:=REF(MF0,1);\n\
|
|
4115
|
+
MF2:=REF(MF0,2);\n\
|
|
4116
|
+
DIRECT1:=BARSLAST(MF0>MF1 AND MF0>MF2);\n\
|
|
4117
|
+
DIRECT2:=BARSLAST(MF0<MF1 AND MF0<MF2);\n\
|
|
4118
|
+
DIRECT0:=IF(DIRECT1<DIRECT2,100,-100);\n\
|
|
4119
|
+
TBP:REF(REF(C,1)+IF(DIRECT0>50,MIN(MF0,MF1),MAX(MF0,MF1)),1);\n\
|
|
4120
|
+
多头获利:REF(IF(DIRECT0>50,APX*2-L,DRAWNULL),1),NODRAW;\n\
|
|
4121
|
+
多头停损:REF(IF(DIRECT0>50,APX-TR0,DRAWNULL),1),NODRAW;\n\
|
|
4122
|
+
空头回补:REF(IF(DIRECT0<-50,APX*2-H,DRAWNULL),1),NODRAW;\n\
|
|
4123
|
+
空头停损:REF(IF(DIRECT0<-50,APX+TR0,DRAWNULL),1),NODRAW;"
|
|
4124
|
+
};
|
|
4125
|
+
|
|
4126
|
+
return data;
|
|
4127
|
+
}
|
|
4064
4128
|
|
|
4065
4129
|
|
|
4066
4130
|
JSIndexScript.prototype.TEST = function ()
|
|
@@ -5310,6 +5374,15 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
5310
5374
|
this.CanvasElement.onmouseleave=(e)=>{ }
|
|
5311
5375
|
}
|
|
5312
5376
|
|
|
5377
|
+
if (option.ExtendChart)
|
|
5378
|
+
{
|
|
5379
|
+
for(var i=0;i<option.ExtendChart.length;++i)
|
|
5380
|
+
{
|
|
5381
|
+
var item=option.ExtendChart[i];
|
|
5382
|
+
chart.CreateExtendChart(item.Name, item);
|
|
5383
|
+
}
|
|
5384
|
+
}
|
|
5385
|
+
|
|
5313
5386
|
return chart;
|
|
5314
5387
|
|
|
5315
5388
|
}
|
|
@@ -29564,57 +29637,122 @@ function ChartKLine()
|
|
|
29564
29637
|
var item=orderFlow.Order[i];
|
|
29565
29638
|
var yPrice=this.GetYFromData(item.Price, false);
|
|
29566
29639
|
if (!item.Vol) continue;
|
|
29567
|
-
if (!IFrameSplitOperator.IsNumber(item.Vol.Value)) continue;
|
|
29568
|
-
|
|
29569
|
-
var barWidth=xKLine.Right-xKLine.Left;
|
|
29570
|
-
var volWidth=barWidth*(item.Vol.Value-min)/(max-min);
|
|
29571
|
-
var rect={ Left:xKLine.Left, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
|
|
29572
|
-
rect.Right=rect.Left+volWidth;
|
|
29573
29640
|
|
|
29574
|
-
if (
|
|
29641
|
+
if (IFrameSplitOperator.IsNonEmptyArray(item.AryVol))
|
|
29575
29642
|
{
|
|
29576
|
-
|
|
29577
|
-
}
|
|
29643
|
+
var barWidth=xKLine.Right-xKLine.Left;
|
|
29578
29644
|
|
|
29579
|
-
|
|
29580
|
-
|
|
29581
|
-
|
|
29582
|
-
|
|
29583
|
-
|
|
29584
|
-
|
|
29585
|
-
|
|
29586
|
-
|
|
29645
|
+
var xVolLeft=xKLine.Left;
|
|
29646
|
+
var xVolRight=xVolLeft;
|
|
29647
|
+
var totalVol=0;
|
|
29648
|
+
var rtDraw={ Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
|
|
29649
|
+
for(var j=0;j<item.AryVol.length;++j)
|
|
29650
|
+
{
|
|
29651
|
+
var itemVol=item.AryVol[j];
|
|
29652
|
+
if (!IFrameSplitOperator.IsNumber(itemVol.Value)) continue;
|
|
29653
|
+
totalVol+=itemVol.Value;
|
|
29654
|
+
xVolRight=barWidth*(totalVol-min)/(max-min)+xKLine.Left;
|
|
29655
|
+
var rtBar={ Left:xVolLeft, Right:xVolRight, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
|
|
29656
|
+
if (preItem && item.Price>preItem.Price)
|
|
29657
|
+
{
|
|
29658
|
+
rtBar.Bottom=preItem.Rect.Top-volBarSpace;
|
|
29659
|
+
}
|
|
29660
|
+
rtBar.Width=rtBar.Right-rtBar.Left;
|
|
29661
|
+
rtBar.Height=rtBar.Bottom-rtBar.Top;
|
|
29587
29662
|
|
|
29588
|
-
|
|
29589
|
-
|
|
29590
|
-
|
|
29591
|
-
|
|
29592
|
-
}
|
|
29663
|
+
rtDraw={ Left:ToFixedRect(rtBar.Left), Top:ToFixedRect(rtBar.Top), Width:ToFixedRect(rtBar.Width), Height:ToFixedRect(rtBar.Height) };
|
|
29664
|
+
rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
|
|
29665
|
+
rtDraw.Right=rtDraw.Left+rtDraw.Width;
|
|
29666
|
+
if (rtDraw.Width<1) rtDraw.Width=1;
|
|
29593
29667
|
|
|
29594
|
-
|
|
29595
|
-
|
|
29596
|
-
|
|
29597
|
-
|
|
29598
|
-
|
|
29668
|
+
if (itemVol.BG) //背景色
|
|
29669
|
+
{
|
|
29670
|
+
this.Canvas.fillStyle=itemVol.BG;
|
|
29671
|
+
this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
|
|
29672
|
+
}
|
|
29599
29673
|
|
|
29600
|
-
|
|
29601
|
-
|
|
29602
|
-
this.Canvas.fillStyle=item.Vol.Color;
|
|
29674
|
+
xVolLeft=rtDraw.Right;
|
|
29675
|
+
}
|
|
29603
29676
|
|
|
29604
|
-
|
|
29677
|
+
rtDraw.Left=xKLine.Left;
|
|
29678
|
+
rtDraw.Width=rtDraw.Right-rtDraw.Left;
|
|
29679
|
+
if (item.Vol.Text && this.IsShowOrderText) //文字
|
|
29605
29680
|
{
|
|
29606
|
-
|
|
29607
|
-
|
|
29608
|
-
|
|
29609
|
-
|
|
29681
|
+
this.Canvas.fillStyle=item.Vol.Color;
|
|
29682
|
+
|
|
29683
|
+
if (item.Vol.Font)
|
|
29684
|
+
{
|
|
29685
|
+
var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
|
|
29686
|
+
this.Canvas.font=itemFont;
|
|
29687
|
+
this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
|
|
29688
|
+
this.Canvas.font=textFont;
|
|
29689
|
+
}
|
|
29690
|
+
else
|
|
29691
|
+
{
|
|
29692
|
+
this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
|
|
29693
|
+
}
|
|
29610
29694
|
}
|
|
29611
|
-
|
|
29695
|
+
|
|
29696
|
+
preItem={ Price: item.Price, Rect:rtDraw };
|
|
29697
|
+
}
|
|
29698
|
+
else if (IFrameSplitOperator.IsNumber(item.Vol.Value))
|
|
29699
|
+
{
|
|
29700
|
+
var barWidth=xKLine.Right-xKLine.Left;
|
|
29701
|
+
var volWidth=barWidth*(item.Vol.Value-min)/(max-min);
|
|
29702
|
+
var rect={ Left:xKLine.Left, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
|
|
29703
|
+
rect.Right=rect.Left+volWidth;
|
|
29704
|
+
|
|
29705
|
+
if (preItem && item.Price>preItem.Price)
|
|
29612
29706
|
{
|
|
29613
|
-
|
|
29707
|
+
rect.Bottom=preItem.Rect.Top-volBarSpace;
|
|
29614
29708
|
}
|
|
29709
|
+
|
|
29710
|
+
rect.Width=rect.Right-rect.Left;
|
|
29711
|
+
rect.Height=rect.Bottom-rect.Top;
|
|
29712
|
+
|
|
29713
|
+
|
|
29714
|
+
var rtDraw={ Left:ToFixedRect(rect.Left), Top:ToFixedRect(rect.Top), Width:ToFixedRect(rect.Width), Height:ToFixedRect(rect.Height) };
|
|
29715
|
+
rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
|
|
29716
|
+
rtDraw.Right=rtDraw.Left+rtDraw.Width;
|
|
29717
|
+
if (rtDraw.Width<1) rtDraw.Width=1;
|
|
29718
|
+
|
|
29719
|
+
if (item.Vol.BG) //背景色
|
|
29720
|
+
{
|
|
29721
|
+
this.Canvas.fillStyle=item.Vol.BG;
|
|
29722
|
+
this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
|
|
29723
|
+
}
|
|
29724
|
+
|
|
29725
|
+
if (item.Vol.BorderColor) //边框
|
|
29726
|
+
{
|
|
29727
|
+
this.Canvas.strokeStyle = item.Vol.BorderColor;
|
|
29728
|
+
this.Canvas.strokeRect(ToFixedPoint(rtDraw.Left), ToFixedPoint(rtDraw.Top), rtDraw.Width, rtDraw.Height);
|
|
29729
|
+
}
|
|
29730
|
+
|
|
29731
|
+
if (item.Vol.Text && this.IsShowOrderText) //文字
|
|
29732
|
+
{
|
|
29733
|
+
this.Canvas.fillStyle=item.Vol.Color;
|
|
29734
|
+
|
|
29735
|
+
if (item.Vol.Font)
|
|
29736
|
+
{
|
|
29737
|
+
var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
|
|
29738
|
+
this.Canvas.font=itemFont;
|
|
29739
|
+
this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
|
|
29740
|
+
this.Canvas.font=textFont;
|
|
29741
|
+
}
|
|
29742
|
+
else
|
|
29743
|
+
{
|
|
29744
|
+
this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
|
|
29745
|
+
}
|
|
29746
|
+
}
|
|
29747
|
+
|
|
29748
|
+
preItem={ Price: item.Price, Rect:rtDraw };
|
|
29615
29749
|
}
|
|
29616
|
-
|
|
29617
|
-
|
|
29750
|
+
else
|
|
29751
|
+
{
|
|
29752
|
+
continue;
|
|
29753
|
+
}
|
|
29754
|
+
|
|
29755
|
+
|
|
29618
29756
|
}
|
|
29619
29757
|
}
|
|
29620
29758
|
}
|
|
@@ -98075,6 +98213,50 @@ function JSAlgorithm(errorHandler,symbolData)
|
|
|
98075
98213
|
return result;
|
|
98076
98214
|
}
|
|
98077
98215
|
|
|
98216
|
+
|
|
98217
|
+
|
|
98218
|
+
//STDDEV(X,N) 返回标准偏差
|
|
98219
|
+
//将标准差除以样本大小N的平方根即可得出标准误差。标准误差 = σ/sqrt(n)
|
|
98220
|
+
this.STDDEV=function(data,n)
|
|
98221
|
+
{
|
|
98222
|
+
var result=[];
|
|
98223
|
+
|
|
98224
|
+
if (!Array.isArray(data)) return result;
|
|
98225
|
+
var nStart=this.GetFirstVaildIndex(data);
|
|
98226
|
+
if (!IFrameSplitOperator.IsNumber(n)) return result;
|
|
98227
|
+
if(nStart+n>data.length || n<1) return result;
|
|
98228
|
+
|
|
98229
|
+
var i=nStart, j=0, bFirst=true, dTotal=0, dAvg=0;
|
|
98230
|
+
for(i+=n-1;i<data.length;++i)
|
|
98231
|
+
{
|
|
98232
|
+
dTotal = 0;
|
|
98233
|
+
if(bFirst)
|
|
98234
|
+
{
|
|
98235
|
+
bFirst = false;
|
|
98236
|
+
for(j=i-n+1;j<=i;++j)
|
|
98237
|
+
{
|
|
98238
|
+
dAvg += data[j];
|
|
98239
|
+
}
|
|
98240
|
+
|
|
98241
|
+
dAvg /= n;
|
|
98242
|
+
}
|
|
98243
|
+
else
|
|
98244
|
+
{
|
|
98245
|
+
dAvg += (data[i]-data[i-n])/n;
|
|
98246
|
+
}
|
|
98247
|
+
|
|
98248
|
+
for(j=i-n+1;j<=i;++j)
|
|
98249
|
+
{
|
|
98250
|
+
dTotal += (data[j]-dAvg)*(data[j]-dAvg);
|
|
98251
|
+
}
|
|
98252
|
+
|
|
98253
|
+
|
|
98254
|
+
result[i] = Math.sqrt(dTotal/(n-1))/Math.sqrt(n);
|
|
98255
|
+
}
|
|
98256
|
+
|
|
98257
|
+
return result;
|
|
98258
|
+
}
|
|
98259
|
+
|
|
98078
98260
|
//平均绝对方差
|
|
98079
98261
|
this.AVEDEV=function(data,n)
|
|
98080
98262
|
{
|
|
@@ -102886,6 +103068,8 @@ function JSAlgorithm(errorHandler,symbolData)
|
|
|
102886
103068
|
return this.AVEDEV(args[0], args[1]);
|
|
102887
103069
|
case 'STD':
|
|
102888
103070
|
return this.STD(args[0], args[1]);
|
|
103071
|
+
case "STDDEV":
|
|
103072
|
+
return this.STDDEV(args[0], args[1]);
|
|
102889
103073
|
case 'IF':
|
|
102890
103074
|
case 'IFF':
|
|
102891
103075
|
case "IFELSE":
|
|
@@ -130199,7 +130383,7 @@ function ScrollBarBGChart()
|
|
|
130199
130383
|
|
|
130200
130384
|
|
|
130201
130385
|
|
|
130202
|
-
var HQCHART_VERSION="1.1.
|
|
130386
|
+
var HQCHART_VERSION="1.1.12673";
|
|
130203
130387
|
|
|
130204
130388
|
function PrintHQChartVersion()
|
|
130205
130389
|
{
|
|
@@ -165,6 +165,7 @@ function JSIndexScript()
|
|
|
165
165
|
['EMPTY', this.EMPTY], //什么都不显示的指标
|
|
166
166
|
['神奇九转', this.NineTurns],
|
|
167
167
|
['EMA', this.EMA3], ['EMA4', this.EMA4], ['EMA5', this.EMA5],['EMA6', this.EMA6],
|
|
168
|
+
["ICHIMOKU",this.ICHIMOKU],["CDP-STD", this.CDP_STD],["TBP-STD",this.TBP_STD],
|
|
168
169
|
|
|
169
170
|
//通达信特色指标
|
|
170
171
|
["散户线", this.ShareholderCount],["NXTS", this.NXTS],["FKX", this.FKX],["两融资金", this.Margin4],
|
|
@@ -4105,6 +4106,69 @@ DRAWTEXT(D9,H*1.010,'9'),COLORGREEN;"
|
|
|
4105
4106
|
return data;
|
|
4106
4107
|
}
|
|
4107
4108
|
|
|
4109
|
+
JSIndexScript.prototype.ICHIMOKU=function()
|
|
4110
|
+
{
|
|
4111
|
+
let data =
|
|
4112
|
+
{
|
|
4113
|
+
Name: 'ICHIMOKU', Description: '一目均衡图', IsMainIndex: true,
|
|
4114
|
+
Args: [{ Name: 'SHORT', Value: 7 },{ Name: 'MID', Value: 22 },{ Name: 'LONG', Value: 44 }],
|
|
4115
|
+
Script: //脚本
|
|
4116
|
+
"转换线:(HHV(H,SHORT)+LLV(L,SHORT))/2,COLORRED,LINETHICK2;\n\
|
|
4117
|
+
基准线:(HHV(H,MID)+LLV(L,MID))/2,COLORFF8040,LINETHICK2;\n\
|
|
4118
|
+
迟行带:REFXV(C,MID),COLORGRAY,LINETHICK2;\n\
|
|
4119
|
+
A:=REF((转换线+基准线)/2,MID);\n\
|
|
4120
|
+
B:=REF((HHV(H,LONG)+LLV(L,LONG))/2,MID);\n\
|
|
4121
|
+
STICKLINE(A<B,A,B,2,1),COLOR339933;\n\
|
|
4122
|
+
STICKLINE(A>=B,A,B,2,1),COLOR0033CC;\n\
|
|
4123
|
+
先行带A:PLOYLINE(1,A),COLORBROWN;\n\
|
|
4124
|
+
先行带B:PLOYLINE(1,B),COLORLIGREEN;"
|
|
4125
|
+
};
|
|
4126
|
+
|
|
4127
|
+
return data;
|
|
4128
|
+
}
|
|
4129
|
+
|
|
4130
|
+
JSIndexScript.prototype.CDP_STD=function()
|
|
4131
|
+
{
|
|
4132
|
+
let data =
|
|
4133
|
+
{
|
|
4134
|
+
Name: 'CDP-STD', Description: '逆势操作', IsMainIndex: true,
|
|
4135
|
+
Script: //脚本
|
|
4136
|
+
"CH:=REF(H,1);\n\
|
|
4137
|
+
CL:=REF(L,1);\n\
|
|
4138
|
+
CC:=REF(C,1);\n\
|
|
4139
|
+
CDP:(CH+CL+CC)/3;\n\
|
|
4140
|
+
AH:2*CDP+CH-2*CL;\n\
|
|
4141
|
+
NH:CDP+CDP-CL;\n\
|
|
4142
|
+
NL:CDP+CDP-CH;\n\
|
|
4143
|
+
AL:2*CDP-2*CH+CL;"
|
|
4144
|
+
};
|
|
4145
|
+
|
|
4146
|
+
return data;
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
JSIndexScript.prototype.TBP_STD=function()
|
|
4150
|
+
{
|
|
4151
|
+
let data =
|
|
4152
|
+
{
|
|
4153
|
+
Name: 'TBP-STD', Description: '趋势平衡点', IsMainIndex: true,
|
|
4154
|
+
Script: //脚本
|
|
4155
|
+
"APX:=(H+L+C)/3;\n\
|
|
4156
|
+
TR0:=MAX(H-L,MAX(ABS(H-REF(C,1)),ABS(L-REF(C,1))));\n\
|
|
4157
|
+
MF0:=C-REF(C,2);\n\
|
|
4158
|
+
MF1:=REF(MF0,1);\n\
|
|
4159
|
+
MF2:=REF(MF0,2);\n\
|
|
4160
|
+
DIRECT1:=BARSLAST(MF0>MF1 AND MF0>MF2);\n\
|
|
4161
|
+
DIRECT2:=BARSLAST(MF0<MF1 AND MF0<MF2);\n\
|
|
4162
|
+
DIRECT0:=IF(DIRECT1<DIRECT2,100,-100);\n\
|
|
4163
|
+
TBP:REF(REF(C,1)+IF(DIRECT0>50,MIN(MF0,MF1),MAX(MF0,MF1)),1);\n\
|
|
4164
|
+
多头获利:REF(IF(DIRECT0>50,APX*2-L,DRAWNULL),1),NODRAW;\n\
|
|
4165
|
+
多头停损:REF(IF(DIRECT0>50,APX-TR0,DRAWNULL),1),NODRAW;\n\
|
|
4166
|
+
空头回补:REF(IF(DIRECT0<-50,APX*2-H,DRAWNULL),1),NODRAW;\n\
|
|
4167
|
+
空头停损:REF(IF(DIRECT0<-50,APX+TR0,DRAWNULL),1),NODRAW;"
|
|
4168
|
+
};
|
|
4169
|
+
|
|
4170
|
+
return data;
|
|
4171
|
+
}
|
|
4108
4172
|
|
|
4109
4173
|
|
|
4110
4174
|
JSIndexScript.prototype.TEST = function ()
|
|
@@ -5354,6 +5418,15 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
5354
5418
|
this.CanvasElement.onmouseleave=(e)=>{ }
|
|
5355
5419
|
}
|
|
5356
5420
|
|
|
5421
|
+
if (option.ExtendChart)
|
|
5422
|
+
{
|
|
5423
|
+
for(var i=0;i<option.ExtendChart.length;++i)
|
|
5424
|
+
{
|
|
5425
|
+
var item=option.ExtendChart[i];
|
|
5426
|
+
chart.CreateExtendChart(item.Name, item);
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
|
|
5357
5430
|
return chart;
|
|
5358
5431
|
|
|
5359
5432
|
}
|
|
@@ -29608,57 +29681,122 @@ function ChartKLine()
|
|
|
29608
29681
|
var item=orderFlow.Order[i];
|
|
29609
29682
|
var yPrice=this.GetYFromData(item.Price, false);
|
|
29610
29683
|
if (!item.Vol) continue;
|
|
29611
|
-
if (!IFrameSplitOperator.IsNumber(item.Vol.Value)) continue;
|
|
29612
|
-
|
|
29613
|
-
var barWidth=xKLine.Right-xKLine.Left;
|
|
29614
|
-
var volWidth=barWidth*(item.Vol.Value-min)/(max-min);
|
|
29615
|
-
var rect={ Left:xKLine.Left, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
|
|
29616
|
-
rect.Right=rect.Left+volWidth;
|
|
29617
29684
|
|
|
29618
|
-
if (
|
|
29685
|
+
if (IFrameSplitOperator.IsNonEmptyArray(item.AryVol))
|
|
29619
29686
|
{
|
|
29620
|
-
|
|
29621
|
-
}
|
|
29687
|
+
var barWidth=xKLine.Right-xKLine.Left;
|
|
29622
29688
|
|
|
29623
|
-
|
|
29624
|
-
|
|
29625
|
-
|
|
29626
|
-
|
|
29627
|
-
|
|
29628
|
-
|
|
29629
|
-
|
|
29630
|
-
|
|
29689
|
+
var xVolLeft=xKLine.Left;
|
|
29690
|
+
var xVolRight=xVolLeft;
|
|
29691
|
+
var totalVol=0;
|
|
29692
|
+
var rtDraw={ Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
|
|
29693
|
+
for(var j=0;j<item.AryVol.length;++j)
|
|
29694
|
+
{
|
|
29695
|
+
var itemVol=item.AryVol[j];
|
|
29696
|
+
if (!IFrameSplitOperator.IsNumber(itemVol.Value)) continue;
|
|
29697
|
+
totalVol+=itemVol.Value;
|
|
29698
|
+
xVolRight=barWidth*(totalVol-min)/(max-min)+xKLine.Left;
|
|
29699
|
+
var rtBar={ Left:xVolLeft, Right:xVolRight, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
|
|
29700
|
+
if (preItem && item.Price>preItem.Price)
|
|
29701
|
+
{
|
|
29702
|
+
rtBar.Bottom=preItem.Rect.Top-volBarSpace;
|
|
29703
|
+
}
|
|
29704
|
+
rtBar.Width=rtBar.Right-rtBar.Left;
|
|
29705
|
+
rtBar.Height=rtBar.Bottom-rtBar.Top;
|
|
29631
29706
|
|
|
29632
|
-
|
|
29633
|
-
|
|
29634
|
-
|
|
29635
|
-
|
|
29636
|
-
}
|
|
29707
|
+
rtDraw={ Left:ToFixedRect(rtBar.Left), Top:ToFixedRect(rtBar.Top), Width:ToFixedRect(rtBar.Width), Height:ToFixedRect(rtBar.Height) };
|
|
29708
|
+
rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
|
|
29709
|
+
rtDraw.Right=rtDraw.Left+rtDraw.Width;
|
|
29710
|
+
if (rtDraw.Width<1) rtDraw.Width=1;
|
|
29637
29711
|
|
|
29638
|
-
|
|
29639
|
-
|
|
29640
|
-
|
|
29641
|
-
|
|
29642
|
-
|
|
29712
|
+
if (itemVol.BG) //背景色
|
|
29713
|
+
{
|
|
29714
|
+
this.Canvas.fillStyle=itemVol.BG;
|
|
29715
|
+
this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
|
|
29716
|
+
}
|
|
29643
29717
|
|
|
29644
|
-
|
|
29645
|
-
|
|
29646
|
-
this.Canvas.fillStyle=item.Vol.Color;
|
|
29718
|
+
xVolLeft=rtDraw.Right;
|
|
29719
|
+
}
|
|
29647
29720
|
|
|
29648
|
-
|
|
29721
|
+
rtDraw.Left=xKLine.Left;
|
|
29722
|
+
rtDraw.Width=rtDraw.Right-rtDraw.Left;
|
|
29723
|
+
if (item.Vol.Text && this.IsShowOrderText) //文字
|
|
29649
29724
|
{
|
|
29650
|
-
|
|
29651
|
-
|
|
29652
|
-
|
|
29653
|
-
|
|
29725
|
+
this.Canvas.fillStyle=item.Vol.Color;
|
|
29726
|
+
|
|
29727
|
+
if (item.Vol.Font)
|
|
29728
|
+
{
|
|
29729
|
+
var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
|
|
29730
|
+
this.Canvas.font=itemFont;
|
|
29731
|
+
this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
|
|
29732
|
+
this.Canvas.font=textFont;
|
|
29733
|
+
}
|
|
29734
|
+
else
|
|
29735
|
+
{
|
|
29736
|
+
this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
|
|
29737
|
+
}
|
|
29654
29738
|
}
|
|
29655
|
-
|
|
29739
|
+
|
|
29740
|
+
preItem={ Price: item.Price, Rect:rtDraw };
|
|
29741
|
+
}
|
|
29742
|
+
else if (IFrameSplitOperator.IsNumber(item.Vol.Value))
|
|
29743
|
+
{
|
|
29744
|
+
var barWidth=xKLine.Right-xKLine.Left;
|
|
29745
|
+
var volWidth=barWidth*(item.Vol.Value-min)/(max-min);
|
|
29746
|
+
var rect={ Left:xKLine.Left, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
|
|
29747
|
+
rect.Right=rect.Left+volWidth;
|
|
29748
|
+
|
|
29749
|
+
if (preItem && item.Price>preItem.Price)
|
|
29656
29750
|
{
|
|
29657
|
-
|
|
29751
|
+
rect.Bottom=preItem.Rect.Top-volBarSpace;
|
|
29658
29752
|
}
|
|
29753
|
+
|
|
29754
|
+
rect.Width=rect.Right-rect.Left;
|
|
29755
|
+
rect.Height=rect.Bottom-rect.Top;
|
|
29756
|
+
|
|
29757
|
+
|
|
29758
|
+
var rtDraw={ Left:ToFixedRect(rect.Left), Top:ToFixedRect(rect.Top), Width:ToFixedRect(rect.Width), Height:ToFixedRect(rect.Height) };
|
|
29759
|
+
rtDraw.Bottom=rtDraw.Top+rtDraw.Height;
|
|
29760
|
+
rtDraw.Right=rtDraw.Left+rtDraw.Width;
|
|
29761
|
+
if (rtDraw.Width<1) rtDraw.Width=1;
|
|
29762
|
+
|
|
29763
|
+
if (item.Vol.BG) //背景色
|
|
29764
|
+
{
|
|
29765
|
+
this.Canvas.fillStyle=item.Vol.BG;
|
|
29766
|
+
this.Canvas.fillRect(rtDraw.Left, rtDraw.Top, rtDraw.Width, rtDraw.Height);
|
|
29767
|
+
}
|
|
29768
|
+
|
|
29769
|
+
if (item.Vol.BorderColor) //边框
|
|
29770
|
+
{
|
|
29771
|
+
this.Canvas.strokeStyle = item.Vol.BorderColor;
|
|
29772
|
+
this.Canvas.strokeRect(ToFixedPoint(rtDraw.Left), ToFixedPoint(rtDraw.Top), rtDraw.Width, rtDraw.Height);
|
|
29773
|
+
}
|
|
29774
|
+
|
|
29775
|
+
if (item.Vol.Text && this.IsShowOrderText) //文字
|
|
29776
|
+
{
|
|
29777
|
+
this.Canvas.fillStyle=item.Vol.Color;
|
|
29778
|
+
|
|
29779
|
+
if (item.Vol.Font)
|
|
29780
|
+
{
|
|
29781
|
+
var itemFont=this.GetDynamicOrderFlowFont(cellHeight, barWidth/2, item.Vol.Font);
|
|
29782
|
+
this.Canvas.font=itemFont;
|
|
29783
|
+
this.Canvas.fillText(text,xKLine.Center+textXOffset,yPrice);
|
|
29784
|
+
this.Canvas.font=textFont;
|
|
29785
|
+
}
|
|
29786
|
+
else
|
|
29787
|
+
{
|
|
29788
|
+
this.Canvas.fillText(item.Vol.Text,rtDraw.Left+2,yPrice);
|
|
29789
|
+
}
|
|
29790
|
+
}
|
|
29791
|
+
|
|
29792
|
+
preItem={ Price: item.Price, Rect:rtDraw };
|
|
29659
29793
|
}
|
|
29660
|
-
|
|
29661
|
-
|
|
29794
|
+
else
|
|
29795
|
+
{
|
|
29796
|
+
continue;
|
|
29797
|
+
}
|
|
29798
|
+
|
|
29799
|
+
|
|
29662
29800
|
}
|
|
29663
29801
|
}
|
|
29664
29802
|
}
|
|
@@ -98119,6 +98257,50 @@ function JSAlgorithm(errorHandler,symbolData)
|
|
|
98119
98257
|
return result;
|
|
98120
98258
|
}
|
|
98121
98259
|
|
|
98260
|
+
|
|
98261
|
+
|
|
98262
|
+
//STDDEV(X,N) 返回标准偏差
|
|
98263
|
+
//将标准差除以样本大小N的平方根即可得出标准误差。标准误差 = σ/sqrt(n)
|
|
98264
|
+
this.STDDEV=function(data,n)
|
|
98265
|
+
{
|
|
98266
|
+
var result=[];
|
|
98267
|
+
|
|
98268
|
+
if (!Array.isArray(data)) return result;
|
|
98269
|
+
var nStart=this.GetFirstVaildIndex(data);
|
|
98270
|
+
if (!IFrameSplitOperator.IsNumber(n)) return result;
|
|
98271
|
+
if(nStart+n>data.length || n<1) return result;
|
|
98272
|
+
|
|
98273
|
+
var i=nStart, j=0, bFirst=true, dTotal=0, dAvg=0;
|
|
98274
|
+
for(i+=n-1;i<data.length;++i)
|
|
98275
|
+
{
|
|
98276
|
+
dTotal = 0;
|
|
98277
|
+
if(bFirst)
|
|
98278
|
+
{
|
|
98279
|
+
bFirst = false;
|
|
98280
|
+
for(j=i-n+1;j<=i;++j)
|
|
98281
|
+
{
|
|
98282
|
+
dAvg += data[j];
|
|
98283
|
+
}
|
|
98284
|
+
|
|
98285
|
+
dAvg /= n;
|
|
98286
|
+
}
|
|
98287
|
+
else
|
|
98288
|
+
{
|
|
98289
|
+
dAvg += (data[i]-data[i-n])/n;
|
|
98290
|
+
}
|
|
98291
|
+
|
|
98292
|
+
for(j=i-n+1;j<=i;++j)
|
|
98293
|
+
{
|
|
98294
|
+
dTotal += (data[j]-dAvg)*(data[j]-dAvg);
|
|
98295
|
+
}
|
|
98296
|
+
|
|
98297
|
+
|
|
98298
|
+
result[i] = Math.sqrt(dTotal/(n-1))/Math.sqrt(n);
|
|
98299
|
+
}
|
|
98300
|
+
|
|
98301
|
+
return result;
|
|
98302
|
+
}
|
|
98303
|
+
|
|
98122
98304
|
//平均绝对方差
|
|
98123
98305
|
this.AVEDEV=function(data,n)
|
|
98124
98306
|
{
|
|
@@ -102930,6 +103112,8 @@ function JSAlgorithm(errorHandler,symbolData)
|
|
|
102930
103112
|
return this.AVEDEV(args[0], args[1]);
|
|
102931
103113
|
case 'STD':
|
|
102932
103114
|
return this.STD(args[0], args[1]);
|
|
103115
|
+
case "STDDEV":
|
|
103116
|
+
return this.STDDEV(args[0], args[1]);
|
|
102933
103117
|
case 'IF':
|
|
102934
103118
|
case 'IFF':
|
|
102935
103119
|
case "IFELSE":
|
|
@@ -130357,7 +130541,7 @@ function HQChartScriptWorker()
|
|
|
130357
130541
|
|
|
130358
130542
|
|
|
130359
130543
|
|
|
130360
|
-
var HQCHART_VERSION="1.1.
|
|
130544
|
+
var HQCHART_VERSION="1.1.12673";
|
|
130361
130545
|
|
|
130362
130546
|
function PrintHQChartVersion()
|
|
130363
130547
|
{
|
|
@@ -8543,6 +8543,7 @@ function ChartCorssCursor()
|
|
|
8543
8543
|
|
|
8544
8544
|
this.IsShow = true; //是否显示
|
|
8545
8545
|
this.ShowTextMode = { Left: 1, Right: 1, Bottom: 1 }; //0=不显示 1=显示在框架外 2=显示在框架内
|
|
8546
|
+
this.TextFormat= { Right:0 }; //0=默认 1=价格显示(分时图才有用)
|
|
8546
8547
|
this.IsShowCorss = true; //是否显示十字光标
|
|
8547
8548
|
this.IsShowClose = false; //Y轴始终显示收盘价
|
|
8548
8549
|
this.IsFixXLastTime=false; //是否修正X轴,超出当前时间的,X轴调整到当前最后的时间.
|
|
@@ -8726,6 +8727,15 @@ function ChartCorssCursor()
|
|
|
8726
8727
|
this.Canvas.fillText(text, left + 2, y, textWidth);
|
|
8727
8728
|
}
|
|
8728
8729
|
|
|
8730
|
+
if (this.StringFormatY.PercentageText)
|
|
8731
|
+
{
|
|
8732
|
+
if (this.TextFormat.Right==0)
|
|
8733
|
+
{
|
|
8734
|
+
text=this.StringFormatY.PercentageText+'%';
|
|
8735
|
+
var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
|
|
8736
|
+
}
|
|
8737
|
+
}
|
|
8738
|
+
|
|
8729
8739
|
if (this.StringFormatY.RText)
|
|
8730
8740
|
{
|
|
8731
8741
|
text = this.StringFormatY.RText;
|