提交 64a8bd0d 编写于 作者: J jones

ver 3941

上级 ba6412e5
......@@ -78,7 +78,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
'COST':FUNCTION_NAME,'WINNER':FUNCTION_NAME,'COUNT':FUNCTION_NAME,'FORCAST':FUNCTION_NAME,'STDP':FUNCTION_NAME,'VAR':FUNCTION_NAME,
'VARP':FUNCTION_NAME,'NDAY':FUNCTION_NAME,'UPNDAY':FUNCTION_NAME,'DOWNNDAY':FUNCTION_NAME,'LONGCROSS':FUNCTION_NAME,'EXISTR':FUNCTION_NAME,
'RELATE':FUNCTION_NAME,'COVAR':FUNCTION_NAME,'HHVBARS':FUNCTION_NAME,'LLVBARS':FUNCTION_NAME,'BETA':FUNCTION_NAME,
'DRAWKLINE_IF':FUNCTION_NAME,'BACKSET':FUNCTION_NAME,
'DRAWKLINE_IF':FUNCTION_NAME,'BACKSET':FUNCTION_NAME,'SARTURN':FUNCTION_NAME,'SAR':FUNCTION_NAME,'REVERSE':FUNCTION_NAME,'SUMBARS':FUNCTION_NAME,
'MEMA':FUNCTION_NAME,'WMA':FUNCTION_NAME,
//动态行情函数
"DYNAINFO":FUNCTION_NAME,
......
//API默认地址
var g_JSComplierResource=
{
Domain : "https://opensource.zealink.com", //API域名
CacheDomain : "https://opensourcecache.zealink.com" //缓存域名
}
var Messages = {
BadGetterArity: 'Getter must not have any formal parameters',
BadSetterArity: 'Setter must have exactly one formal parameter',
......@@ -5285,12 +5292,12 @@ function JSSymbolData(ast,option,jsExecute)
this.Right=0; //复权
this.DataType=0; //默认K线数据 2=分钟走势图数据
this.KLineApiUrl="https://opensource.zealink.com/API/KLine2"; //日线
this.MinuteKLineApiUrl='https://opensource.zealink.com/API/KLine3'; //分钟K线
this.RealtimeApiUrl='https://opensource.zealink.com/API/stock'; //实时行情
this.StockHistoryDayApiUrl='https://opensource.zealink.com/API/StockHistoryDay'; //历史财务数据
this.StockHistoryDay3ApiUrl='https://opensource.zealink.com/API/StockHistoryDay3'; //历史财务数据
this.StockNewsAnalysisApiUrl='https://opensourcecache.zealink.com/cache/newsanalyze'; //新闻分析数据
this.KLineApiUrl= g_JSComplierResource.Domain+"/API/KLine2"; //日线
this.MinuteKLineApiUrl= g_JSComplierResource.Domain+'/API/KLine3'; //分钟K线
this.RealtimeApiUrl= g_JSComplierResource.Domain+'/API/stock'; //实时行情
this.StockHistoryDayApiUrl= g_JSComplierResource.Domain+'/API/StockHistoryDay'; //历史财务数据
this.StockHistoryDay3ApiUrl= g_JSComplierResource.Domain+'/API/StockHistoryDay3'; //历史财务数据
this.StockNewsAnalysisApiUrl= g_JSComplierResource.CacheDomain+'/cache/newsanalyze'; //新闻分析数据
this.MaxReqeustDataCount=1000;
this.MaxRequestMinuteDayCount=5;
......@@ -7498,6 +7505,13 @@ JSComplier.Execute=function(code,option,errorCallback)
}
JSComplier.SetDomain = function (domain, cacheDomain) //修改API地址
{
if (domain) g_JSComplierResource.Domain = domain;
if (cacheDomain) g_JSComplierResource.CacheDomain = cacheDomain;
}
//脚本指标
//name=指标名字 args=参数名字 参数值
function ScriptIndex(name,script,args,option)
......@@ -7509,6 +7523,8 @@ function ScriptIndex(name,script,args,option)
this.Script=script;
this.Arguments=[];
this.OutVar=[];
this.ID;
if (option && option.ID) this.ID=option.ID;
//指标上锁配置信息
this.IsLocked=false; //是否锁住指标
......
......@@ -52,6 +52,7 @@ JSIndexScript.prototype.Get=function(id)
['放心股-操盘BS点',this.FXG_BSPoint],
['放心股-涨停多空线',this.FXG_INDEX],
['放心股-涨停吸筹区',this.FXG_INDEX2],
['放心股-量能黄金点',this.FXG_INDEX3],
//五彩K线(函数COLOR_开头)
['五彩K线-十字星',this.COLOR_KSTAR1],['五彩K线-早晨之星',this.COLOR_KSTAR2],['五彩K线-黄昏之星',this.COLOR_KSTAR3],['五彩K线-长十字',this.COLOR_SHI1],
......@@ -1916,11 +1917,11 @@ JSIndexScript.prototype.FXG_INDEX=function()
Name: '涨停多空线', Description: '涨停多空线', IsMainIndex: false,
Args: [],
Script: //脚本
'做多能量线: SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,5,1)-8,COLORRED,LINETHICK3;\n\
做空能量线: SMA((HHV(HIGH,36)-CLOSE)/(HHV(HIGH,36)-LLV(LOW,36))*100,2,1),COLORGREEN,LINETHICK3;\n\
20,POINTDOT,COLORF00FF0;\n\
50,POINTDOT,COLORGREEN;\n\
80,POINTDOT,COLORLIBLUE;'
'做多能量线: SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,5,1)-8,COLORRED,LINETHICK3;\n\
做空能量线: SMA((HHV(HIGH,36)-CLOSE)/(HHV(HIGH,36)-LLV(LOW,36))*100,2,1),COLORGREEN,LINETHICK3;\n\
20,POINTDOT,COLORF00FF0;\n\
50,POINTDOT,COLORGREEN;\n\
80,POINTDOT,COLORLIBLUE;'
};
return data;
......@@ -1933,37 +1934,68 @@ JSIndexScript.prototype.FXG_INDEX2=function()
Name: '涨停吸筹区', Description: '涨停吸筹区', IsMainIndex: false,
Args: [],
Script: //脚本
'VAR0:=EMA(HHV(HIGH,500),21); \n\
VAR1:=EMA(HHV(HIGH,250),21);\n\
VAR2:=EMA(HHV(HIGH,90),21); \n\
VAR3:=EMA(LLV(LOW,500),21); \n\
VAR4:=EMA(LLV(LOW,250),21); \n\
VAR5:=EMA(LLV(LOW,90),21);\n\
\n\
VAR6:=EMA((VAR3*0.96+VAR4*0.96+VAR5*0.96+VAR0*0.558+VAR1*0.558+VAR2*0.558)/6,21); \n\
VAR7:=EMA((VAR3*1.25+VAR4*1.23+VAR5*1.2+VAR0*0.55+VAR1*0.55+VAR2*0.65)/6,21); \n\
VAR8:=EMA((VAR3*1.3+VAR4*1.3+VAR5*1.3+VAR0*0.68+VAR1*0.68+VAR2*0.68)/6,21); \n\
VAR9:=EMA((VAR6*3+VAR7*2+VAR8)/6*1.738,21); \n\
VAR10:=REF(LOW,1); \n\
VAR11:=SMA(ABS(LOW-VAR10),3,1)/SMA(MAX(LOW-VAR10,0),3,1)*100; \n\
VAR12:=EMA(IFF(CLOSE*1.35<=VAR9,VAR11*10,VAR11/10),3); \n\
VAR13:=LLV(LOW,30); \n\
VAR14:=HHV(VAR12,30); \n\
VAR15:=IFF(MA(CLOSE,58),1,0); \n\
VAR16:=EMA(IFF(LOW<=VAR13,(VAR12+VAR14*2)/2,0),3)/618*VAR15;\n\
\n\
资金入场:IFF(VAR16>0,VAR16,0),LINETHICK,LINETHICK2, COLORFF0000; \n\
\n\
A1:IFF(资金入场>0,资金入场*1.2,0),STICK,LINETHICK5, COLORFF0000;\n\
A2:IFF(资金入场>0,资金入场*0.8,0),STICK,LINETHICK5, COLORFF6600;\n\
A3:IFF(资金入场>0,资金入场*0.6,0),STICK,LINETHICK5, COLORFF9900;\n\
A4:IFF(资金入场>0,资金入场*0.4,0) ,STICK,LINETHICK5,COLORFFCC00;\n\
A5:IFF(资金入场>0,资金入场*0.2,0) ,STICK,LINETHICK5,COLORFFFF00;'
'VAR0:=EMA(HHV(HIGH,500),21); \n\
VAR1:=EMA(HHV(HIGH,250),21);\n\
VAR2:=EMA(HHV(HIGH,90),21); \n\
VAR3:=EMA(LLV(LOW,500),21); \n\
VAR4:=EMA(LLV(LOW,250),21); \n\
VAR5:=EMA(LLV(LOW,90),21);\n\
\n\
VAR6:=EMA((VAR3*0.96+VAR4*0.96+VAR5*0.96+VAR0*0.558+VAR1*0.558+VAR2*0.558)/6,21); \n\
VAR7:=EMA((VAR3*1.25+VAR4*1.23+VAR5*1.2+VAR0*0.55+VAR1*0.55+VAR2*0.65)/6,21); \n\
VAR8:=EMA((VAR3*1.3+VAR4*1.3+VAR5*1.3+VAR0*0.68+VAR1*0.68+VAR2*0.68)/6,21); \n\
VAR9:=EMA((VAR6*3+VAR7*2+VAR8)/6*1.738,21); \n\
VAR10:=REF(LOW,1); \n\
VAR11:=SMA(ABS(LOW-VAR10),3,1)/SMA(MAX(LOW-VAR10,0),3,1)*100; \n\
VAR12:=EMA(IFF(CLOSE*1.35<=VAR9,VAR11*10,VAR11/10),3); \n\
VAR13:=LLV(LOW,30); \n\
VAR14:=HHV(VAR12,30); \n\
VAR15:=IFF(MA(CLOSE,58),1,0); \n\
VAR16:=EMA(IFF(LOW<=VAR13,(VAR12+VAR14*2)/2,0),3)/618*VAR15;\n\
\n\
资金入场:IFF(VAR16>0,VAR16,0),LINETHICK,LINETHICK2, COLORFF0000; \n\
\n\
A1:IFF(资金入场>0,资金入场*1.2,0),STICK,LINETHICK5, COLORFF0000;\n\
A2:IFF(资金入场>0,资金入场*0.8,0),STICK,LINETHICK5, COLORFF6600;\n\
A3:IFF(资金入场>0,资金入场*0.6,0),STICK,LINETHICK5, COLORFF9900;\n\
A4:IFF(资金入场>0,资金入场*0.4,0) ,STICK,LINETHICK5,COLORFFCC00;\n\
A5:IFF(资金入场>0,资金入场*0.2,0) ,STICK,LINETHICK5,COLORFFFF00;'
};
return data;
}
JSIndexScript.prototype.FXG_INDEX3=function()
{
let data =
{
Name: '量能黄金点', Description: '量能黄金点', IsMainIndex: false,
Args: [],
Script: //脚本
'A:=IFF((CLOSE>126.32),VOL,VOL); \n\
主力:=MA(A,4),COLORRED;\n\
游资:=MA(A,8),COLORYELLOW;\n\
大户:=MA(A,16),COLORF0F000;\n\
散户:=MA(A,32),COLOR00FF00;\n\
主比:=ABS(((主力)/(主力 + 游资 + 大户 + 散户))*(100)),LINESTICK,COLORRED;\n\
游比:=ABS(((游资)/(主力 + 游资 + 大户 + 散户))*(100)),LINESTICK,COLORYELLOW;\n\
大比:=ABS(((大户)/(主力 + 游资 + 大户 + 散户))*(100)),LINESTICK,COLORF0F000;\n\
散比:=ABS(((散户)/(主力 + 游资 + 大户 + 散户))*(100)),LINESTICK,COLOR00FF00;\n\
警戒线:MA(A,180),COLORFF66FF;\n\
STICKLINE((主力 > 0),0,主力,2.5,0),COLOR1020BB;\n\
STICKLINE((主力 > 0),0,主力,0.7,0),COLORRED;\n\
STICKLINE((游资 > 0),0,游资,2.5,0),COLOR009CFF;\n\
STICKLINE((游资 > 0),0,游资,0.7,0),COLORYELLOW;\n\
STICKLINE((大户 > 0),0,大户,2.5,0),COLORFF8800;\n\
STICKLINE((大户 > 0),0,大户,0.7,0),COLORLIBLUE;\n\
STICKLINE((散户 > 0),0,散户,2.5,0),COLOR00CA00;\n\
STICKLINE((散户 > 0),0,散户,0.7,0),COLORGREEN;'
};
return data;
}
JSIndexScript.prototype.NewsNegative=function()
{
let data=
......
......@@ -129,6 +129,7 @@ function JSChart(divElement)
for(var i in option.Frame)
{
var item=option.Frame[i];
if (!chart.Frame.SubFrame[i]) continue;
if (item.SplitCount) chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;
if (item.StringFormat) chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;
}
......@@ -186,6 +187,7 @@ function JSChart(divElement)
if (!indexInfo) continue;
if (item.Lock) indexInfo.Lock=item.Lock;
indexInfo.ID=item.Index;
chart.WindowIndex[i] = new ScriptIndex(indexInfo.Name, indexInfo.Script, indexInfo.Args,indexInfo); //脚本执行
}
......@@ -696,25 +698,33 @@ function JSChart(divElement)
this.ChangeScriptIndex=function(windowIndex,indexData)
{
if (this.JSChartContainer && typeof(this.JSChartContainer.ChangeScriptIndex)=='function')
this.JSChartContainer.ChangeScriptIndex(windowIndex,indexData);
this.JSChartContainer.ChangeScriptIndex(windowIndex,indexData);
}
this.ChangeInstructionIndex=function(indexName)
this.GetIndexInfo=function()
{
if (this.JSChartContainer && typeof(this.JSChartContainer.GetIndexInfo)=='function')
return this.JSChartContainer.GetIndexInfo();
else
return [];
}
this.ChangeInstructionIndex=function(indexName)
{
if (this.JSChartContainer && typeof(this.JSChartContainer.ChangeInstructionIndex)=='function')
this.JSChartContainer.ChangeInstructionIndex(indexName);
this.JSChartContainer.ChangeInstructionIndex(indexName);
}
this.ChangeInstructionScriptIndex=function(indexData)
{
if (this.JSChartContainer && typeof(this.JSChartContainer.ChangeInstructionIndex)=='function')
this.JSChartContainer.ChangeInstructionScriptIndex(indexData);
this.JSChartContainer.ChangeInstructionScriptIndex(indexData);
}
this.CancelInstructionIndex=function()
{
if (this.JSChartContainer && typeof(this.JSChartContainer.CancelInstructionIndex)=='function')
this.JSChartContainer.CancelInstructionIndex();
this.JSChartContainer.CancelInstructionIndex();
}
//K线周期切换
......@@ -6552,7 +6562,8 @@ function ChartSingleText()
var isArrayText=Array.isArray(this.Text);
var text;
this.TextFont=this.GetDynamicFont(dataWidth);
var pixelTatio = GetDevicePixelRatio();
this.TextFont=this.GetDynamicFont(dataWidth*pixelTatio);
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
{
var value=this.Data.Data[i];
......@@ -7863,6 +7874,81 @@ function IFrameSplitOperator()
return true;
}
this.Filter = function (aryInfo)
{
if (this.SplitCount <= 0 || aryInfo.length <= 0 || aryInfo.length < this.SplitCount) return aryInfo;
//分割线比预设的多, 过掉一些
var filter = parseInt(aryInfo.length / this.SplitCount);
if (filter <= 1) filter = 2;
var data = [];
for (var i = 0; i < aryInfo.length; i += filter)
{
if (i + filter >= aryInfo.length && i != aryInfo.length - 1) //最后一个数据放进去
{
data.push(aryInfo[aryInfo.length - 1]);
}
else
{
data.push(aryInfo[i]);
}
}
return data;
}
this.RemoveZero = function (aryInfo) //移除小数后面多余的0
{
//所有的数字小数点后面都0,才会去掉
var isAllZero = [true, true];
for (var i in aryInfo)
{
var item = aryInfo[i];
var message = item.Message[0];
if (!message) isAllZero[0] = false;
else if (!this.IsDecimalZeroEnd(message)) isAllZero[0] = false;
var message = item.Message[1];
if (!message) isAllZero[1] = false;
else if (!this.IsDecimalZeroEnd(message)) isAllZero[1] = false;
}
if (isAllZero[0] == false && isAllZero[1] == false) return;
for (var i in aryInfo)
{
var item = aryInfo[i];
if (isAllZero[0])
{
var message = item.Message[0];
item.Message[0] = message.replace(/[.][0]+/g, '');
}
if (isAllZero[1])
{
var message = item.Message[1];
item.Message[1] = message.replace(/[.][0]+/g, '');
}
}
}
this.IsDecimalZeroEnd = function (text) //是否是0结尾的小数
{
if (!text) return false;
if (text == '0') return true;
var pos = text.search(/[.]/);
if (pos < 0) return false;
for (var i = pos + 1; i < text.length; ++i)
{
var char = text.charAt(i);
if (char >= '1' && char <= '9') return false;
}
return true;
}
}
//字符串格式化 千分位分割
......@@ -8047,27 +8133,7 @@ function FrameSplitKLinePriceY()
//this.Frame.HorizontalInfo[i].LineColor="rgb(220,220,220)";
}
if (this.SplitCount>0 && splitData.Count>this.SplitCount)
{
var filter=parseInt(splitData.Count/this.SplitCount);
if (filter<=1) filter=2;
var data=[];
for(var i=0; i<this.Frame.HorizontalInfo.length; i+=filter)
{
if (i+filter>=this.Frame.HorizontalInfo.length && i!=this.Frame.HorizontalInfo.length-1) //最后一个数据放进去
{
data.push(this.Frame.HorizontalInfo[this.Frame.HorizontalInfo.length-1]);
}
else
{
data.push(this.Frame.HorizontalInfo[i]);
}
}
this.Frame.HorizontalInfo=data;
}
this.Frame.HorizontalInfo = this.Filter(this.Frame.HorizontalInfo);
this.Frame.HorizontalMax=splitData.Max;
this.Frame.HorizontalMin=splitData.Min;
}
......@@ -8121,6 +8187,8 @@ function FrameSplitY()
//this.Frame.HorizontalInfo[i].LineColor="rgb(220,220,220)";
}
this.Frame.HorizontalInfo = this.Filter(this.Frame.HorizontalInfo);
this.RemoveZero(this.Frame.HorizontalInfo);
this.Frame.HorizontalMax=splitData.Max;
this.Frame.HorizontalMin=splitData.Min;
}
......@@ -11452,11 +11520,11 @@ function KLineChartContainer(uielement)
this.KLineDrawType=0;
this.ScriptErrorCallback; //脚本执行错误回调
//this.KLineApiUrl="http://opensource.zealink.com/API/KLine2"; //历史K线api地址
this.KLineApiUrl="https://opensource.zealink.com/API/KLine2"; //历史K线api地址
this.MinuteKLineApiUrl='https://opensource.zealink.com/API/KLine3'; //历史分钟数据
this.RealtimeApiUrl="https://opensource.zealink.com/API/Stock"; //实时行情api地址
this.KLineMatchUrl="https://opensource.zealink.com/API/KLineMatch"; //形态匹配
//this.KLineApiUrl="http://opensource.zealink.com/API/KLine2"; //历史K线api地址
this.KLineApiUrl=g_JSChartResource.Domain+"/API/KLine2"; //历史K线api地址
this.MinuteKLineApiUrl=g_JSChartResource.Domain+'/API/KLine3'; //历史分钟数据
this.RealtimeApiUrl=g_JSChartResource.Domain+"/API/Stock"; //实时行情api地址
this.KLineMatchUrl=g_JSChartResource.Domain+"/API/KLineMatch"; //形态匹配
this.MinuteDialog; //双击历史K线 弹出分钟走势图
this.RightMenu; //右键菜单
......@@ -11822,7 +11890,7 @@ function KLineChartContainer(uielement)
this.BindMainData(bindData,this.PageSize);
this.BindInstructionIndexData(bindData); //执行指示脚本
for(var i=0; i<this.Frame.SubFrame.length; ++i)
{
this.BindIndexData(i,bindData);
......@@ -12055,7 +12123,7 @@ function KLineChartContainer(uielement)
{
if (windowIndex == 0) windowIndex = 1; //幅图指标,不能再主图显示
}
let indexData = { Name: indexInfo.Name, Script: indexInfo.Script, Args: indexInfo.Args };
let indexData = { Name: indexInfo.Name, Script: indexInfo.Script, Args: indexInfo.Args, ID:indexName };
return this.ChangeScriptIndex(windowIndex, indexData);
}
......@@ -12100,6 +12168,21 @@ function KLineChartContainer(uielement)
this.Draw();
}
//获取当天的显示的指标
this.GetIndexInfo=function()
{
var aryIndex=[];
for(var i in this.WindowIndex)
{
var item=this.WindowIndex[i];
var info={Name:item.Name};
if (item.ID) info.ID=item.ID;
aryIndex.push(info);
}
return aryIndex;
}
//锁|解锁指标 { Index:指标名字,IsLocked:是否要锁上,Callback:回调 }
this.LockIndex=function(lockData)
{
......@@ -13938,7 +14021,7 @@ function CustomKLineChartContainer(uielement)
delete this.newMethod;
this.ClassName='CustomKLineChartContainer';
this.CustomKLineApiUrl="https://opensource.zealink.com/API/IndexCalculate"; //自定义指数计算地址
this.CustomKLineApiUrl=g_JSChartResource.Domain+"/API/IndexCalculate"; //自定义指数计算地址
this.CustomStock; //成分
this.QueryDate={Start:20180101,End:20180627} ; //计算时间区间
......
//API默认地址
var g_JSComplierResource=
{
Domain : "https://opensource.zealink.com", //API域名
CacheDomain : "https://opensourcecache.zealink.com" //缓存域名
}
var Messages = {
BadGetterArity: 'Getter must not have any formal parameters',
BadSetterArity: 'Setter must have exactly one formal parameter',
......@@ -5285,12 +5292,12 @@ function JSSymbolData(ast,option,jsExecute)
this.Right=0; //复权
this.DataType=0; //默认K线数据 2=分钟走势图数据
this.KLineApiUrl="https://opensource.zealink.com/API/KLine2"; //日线
this.MinuteKLineApiUrl='https://opensource.zealink.com/API/KLine3'; //分钟K线
this.RealtimeApiUrl='https://opensource.zealink.com/API/stock'; //实时行情
this.StockHistoryDayApiUrl='https://opensource.zealink.com/API/StockHistoryDay'; //历史财务数据
this.StockHistoryDay3ApiUrl='https://opensource.zealink.com/API/StockHistoryDay3'; //历史财务数据
this.StockNewsAnalysisApiUrl='https://opensourcecache.zealink.com/cache/newsanalyze'; //新闻分析数据
this.KLineApiUrl= g_JSComplierResource.Domain+"/API/KLine2"; //日线
this.MinuteKLineApiUrl= g_JSComplierResource.Domain+'/API/KLine3'; //分钟K线
this.RealtimeApiUrl= g_JSComplierResource.Domain+'/API/stock'; //实时行情
this.StockHistoryDayApiUrl= g_JSComplierResource.Domain+'/API/StockHistoryDay'; //历史财务数据
this.StockHistoryDay3ApiUrl= g_JSComplierResource.Domain+'/API/StockHistoryDay3'; //历史财务数据
this.StockNewsAnalysisApiUrl= g_JSComplierResource.CacheDomain+'/cache/newsanalyze'; //新闻分析数据
this.MaxReqeustDataCount=1000;
this.MaxRequestMinuteDayCount=5;
......@@ -7498,6 +7505,13 @@ JSComplier.Execute=function(code,option,errorCallback)
}
JSComplier.SetDomain = function (domain, cacheDomain) //修改API地址
{
if (domain) g_JSComplierResource.Domain = domain;
if (cacheDomain) g_JSComplierResource.CacheDomain = cacheDomain;
}
//脚本指标
//name=指标名字 args=参数名字 参数值
function ScriptIndex(name,script,args,option)
......@@ -7509,6 +7523,8 @@ function ScriptIndex(name,script,args,option)
this.Script=script;
this.Arguments=[];
this.OutVar=[];
this.ID;
if (option && option.ID) this.ID=option.ID;
//指标上锁配置信息
this.IsLocked=false; //是否锁住指标
......
......@@ -52,6 +52,7 @@ JSIndexScript.prototype.Get=function(id)
['放心股-操盘BS点',this.FXG_BSPoint],
['放心股-涨停多空线',this.FXG_INDEX],
['放心股-涨停吸筹区',this.FXG_INDEX2],
['放心股-量能黄金点',this.FXG_INDEX3],
//五彩K线(函数COLOR_开头)
['五彩K线-十字星',this.COLOR_KSTAR1],['五彩K线-早晨之星',this.COLOR_KSTAR2],['五彩K线-黄昏之星',this.COLOR_KSTAR3],['五彩K线-长十字',this.COLOR_SHI1],
......@@ -1916,11 +1917,11 @@ JSIndexScript.prototype.FXG_INDEX=function()
Name: '涨停多空线', Description: '涨停多空线', IsMainIndex: false,
Args: [],
Script: //脚本
'做多能量线: SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,5,1)-8,COLORRED,LINETHICK3;\n\
做空能量线: SMA((HHV(HIGH,36)-CLOSE)/(HHV(HIGH,36)-LLV(LOW,36))*100,2,1),COLORGREEN,LINETHICK3;\n\
20,POINTDOT,COLORF00FF0;\n\
50,POINTDOT,COLORGREEN;\n\
80,POINTDOT,COLORLIBLUE;'
'做多能量线: SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,5,1)-8,COLORRED,LINETHICK3;\n\
做空能量线: SMA((HHV(HIGH,36)-CLOSE)/(HHV(HIGH,36)-LLV(LOW,36))*100,2,1),COLORGREEN,LINETHICK3;\n\
20,POINTDOT,COLORF00FF0;\n\
50,POINTDOT,COLORGREEN;\n\
80,POINTDOT,COLORLIBLUE;'
};
return data;
......@@ -1933,37 +1934,68 @@ JSIndexScript.prototype.FXG_INDEX2=function()
Name: '涨停吸筹区', Description: '涨停吸筹区', IsMainIndex: false,
Args: [],
Script: //脚本
'VAR0:=EMA(HHV(HIGH,500),21); \n\
VAR1:=EMA(HHV(HIGH,250),21);\n\
VAR2:=EMA(HHV(HIGH,90),21); \n\
VAR3:=EMA(LLV(LOW,500),21); \n\
VAR4:=EMA(LLV(LOW,250),21); \n\
VAR5:=EMA(LLV(LOW,90),21);\n\
\n\
VAR6:=EMA((VAR3*0.96+VAR4*0.96+VAR5*0.96+VAR0*0.558+VAR1*0.558+VAR2*0.558)/6,21); \n\
VAR7:=EMA((VAR3*1.25+VAR4*1.23+VAR5*1.2+VAR0*0.55+VAR1*0.55+VAR2*0.65)/6,21); \n\
VAR8:=EMA((VAR3*1.3+VAR4*1.3+VAR5*1.3+VAR0*0.68+VAR1*0.68+VAR2*0.68)/6,21); \n\
VAR9:=EMA((VAR6*3+VAR7*2+VAR8)/6*1.738,21); \n\
VAR10:=REF(LOW,1); \n\
VAR11:=SMA(ABS(LOW-VAR10),3,1)/SMA(MAX(LOW-VAR10,0),3,1)*100; \n\
VAR12:=EMA(IFF(CLOSE*1.35<=VAR9,VAR11*10,VAR11/10),3); \n\
VAR13:=LLV(LOW,30); \n\
VAR14:=HHV(VAR12,30); \n\
VAR15:=IFF(MA(CLOSE,58),1,0); \n\
VAR16:=EMA(IFF(LOW<=VAR13,(VAR12+VAR14*2)/2,0),3)/618*VAR15;\n\
\n\
资金入场:IFF(VAR16>0,VAR16,0),LINETHICK,LINETHICK2, COLORFF0000; \n\
\n\
A1:IFF(资金入场>0,资金入场*1.2,0),STICK,LINETHICK5, COLORFF0000;\n\
A2:IFF(资金入场>0,资金入场*0.8,0),STICK,LINETHICK5, COLORFF6600;\n\
A3:IFF(资金入场>0,资金入场*0.6,0),STICK,LINETHICK5, COLORFF9900;\n\
A4:IFF(资金入场>0,资金入场*0.4,0) ,STICK,LINETHICK5,COLORFFCC00;\n\
A5:IFF(资金入场>0,资金入场*0.2,0) ,STICK,LINETHICK5,COLORFFFF00;'
'VAR0:=EMA(HHV(HIGH,500),21); \n\
VAR1:=EMA(HHV(HIGH,250),21);\n\
VAR2:=EMA(HHV(HIGH,90),21); \n\
VAR3:=EMA(LLV(LOW,500),21); \n\
VAR4:=EMA(LLV(LOW,250),21); \n\
VAR5:=EMA(LLV(LOW,90),21);\n\
\n\
VAR6:=EMA((VAR3*0.96+VAR4*0.96+VAR5*0.96+VAR0*0.558+VAR1*0.558+VAR2*0.558)/6,21); \n\
VAR7:=EMA((VAR3*1.25+VAR4*1.23+VAR5*1.2+VAR0*0.55+VAR1*0.55+VAR2*0.65)/6,21); \n\
VAR8:=EMA((VAR3*1.3+VAR4*1.3+VAR5*1.3+VAR0*0.68+VAR1*0.68+VAR2*0.68)/6,21); \n\
VAR9:=EMA((VAR6*3+VAR7*2+VAR8)/6*1.738,21); \n\
VAR10:=REF(LOW,1); \n\
VAR11:=SMA(ABS(LOW-VAR10),3,1)/SMA(MAX(LOW-VAR10,0),3,1)*100; \n\
VAR12:=EMA(IFF(CLOSE*1.35<=VAR9,VAR11*10,VAR11/10),3); \n\
VAR13:=LLV(LOW,30); \n\
VAR14:=HHV(VAR12,30); \n\
VAR15:=IFF(MA(CLOSE,58),1,0); \n\
VAR16:=EMA(IFF(LOW<=VAR13,(VAR12+VAR14*2)/2,0),3)/618*VAR15;\n\
\n\
资金入场:IFF(VAR16>0,VAR16,0),LINETHICK,LINETHICK2, COLORFF0000; \n\
\n\
A1:IFF(资金入场>0,资金入场*1.2,0),STICK,LINETHICK5, COLORFF0000;\n\
A2:IFF(资金入场>0,资金入场*0.8,0),STICK,LINETHICK5, COLORFF6600;\n\
A3:IFF(资金入场>0,资金入场*0.6,0),STICK,LINETHICK5, COLORFF9900;\n\
A4:IFF(资金入场>0,资金入场*0.4,0) ,STICK,LINETHICK5,COLORFFCC00;\n\
A5:IFF(资金入场>0,资金入场*0.2,0) ,STICK,LINETHICK5,COLORFFFF00;'
};
return data;
}
JSIndexScript.prototype.FXG_INDEX3=function()
{
let data =
{
Name: '量能黄金点', Description: '量能黄金点', IsMainIndex: false,
Args: [],
Script: //脚本
'A:=IFF((CLOSE>126.32),VOL,VOL); \n\
主力:=MA(A,4),COLORRED;\n\
游资:=MA(A,8),COLORYELLOW;\n\
大户:=MA(A,16),COLORF0F000;\n\
散户:=MA(A,32),COLOR00FF00;\n\
主比:=ABS(((主力)/(主力 + 游资 + 大户 + 散户))*(100)),LINESTICK,COLORRED;\n\
游比:=ABS(((游资)/(主力 + 游资 + 大户 + 散户))*(100)),LINESTICK,COLORYELLOW;\n\
大比:=ABS(((大户)/(主力 + 游资 + 大户 + 散户))*(100)),LINESTICK,COLORF0F000;\n\
散比:=ABS(((散户)/(主力 + 游资 + 大户 + 散户))*(100)),LINESTICK,COLOR00FF00;\n\
警戒线:MA(A,180),COLORFF66FF;\n\
STICKLINE((主力 > 0),0,主力,2.5,0),COLOR1020BB;\n\
STICKLINE((主力 > 0),0,主力,0.7,0),COLORRED;\n\
STICKLINE((游资 > 0),0,游资,2.5,0),COLOR009CFF;\n\
STICKLINE((游资 > 0),0,游资,0.7,0),COLORYELLOW;\n\
STICKLINE((大户 > 0),0,大户,2.5,0),COLORFF8800;\n\
STICKLINE((大户 > 0),0,大户,0.7,0),COLORLIBLUE;\n\
STICKLINE((散户 > 0),0,散户,2.5,0),COLOR00CA00;\n\
STICKLINE((散户 > 0),0,散户,0.7,0),COLORGREEN;'
};
return data;
}
JSIndexScript.prototype.NewsNegative=function()
{
let data=
......
......@@ -129,6 +129,7 @@ function JSChart(divElement)
for(var i in option.Frame)
{
var item=option.Frame[i];
if (!chart.Frame.SubFrame[i]) continue;
if (item.SplitCount) chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;
if (item.StringFormat) chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;
}
......@@ -186,6 +187,7 @@ function JSChart(divElement)
if (!indexInfo) continue;
if (item.Lock) indexInfo.Lock=item.Lock;
indexInfo.ID=item.Index;
chart.WindowIndex[i] = new ScriptIndex(indexInfo.Name, indexInfo.Script, indexInfo.Args,indexInfo); //脚本执行
}
......@@ -696,25 +698,33 @@ function JSChart(divElement)
this.ChangeScriptIndex=function(windowIndex,indexData)
{
if (this.JSChartContainer && typeof(this.JSChartContainer.ChangeScriptIndex)=='function')
this.JSChartContainer.ChangeScriptIndex(windowIndex,indexData);
this.JSChartContainer.ChangeScriptIndex(windowIndex,indexData);
}
this.ChangeInstructionIndex=function(indexName)
this.GetIndexInfo=function()
{
if (this.JSChartContainer && typeof(this.JSChartContainer.GetIndexInfo)=='function')
return this.JSChartContainer.GetIndexInfo();
else
return [];
}
this.ChangeInstructionIndex=function(indexName)
{
if (this.JSChartContainer && typeof(this.JSChartContainer.ChangeInstructionIndex)=='function')
this.JSChartContainer.ChangeInstructionIndex(indexName);
this.JSChartContainer.ChangeInstructionIndex(indexName);
}
this.ChangeInstructionScriptIndex=function(indexData)
{
if (this.JSChartContainer && typeof(this.JSChartContainer.ChangeInstructionIndex)=='function')
this.JSChartContainer.ChangeInstructionScriptIndex(indexData);
this.JSChartContainer.ChangeInstructionScriptIndex(indexData);
}
this.CancelInstructionIndex=function()
{
if (this.JSChartContainer && typeof(this.JSChartContainer.CancelInstructionIndex)=='function')
this.JSChartContainer.CancelInstructionIndex();
this.JSChartContainer.CancelInstructionIndex();
}
//K线周期切换
......@@ -6552,7 +6562,8 @@ function ChartSingleText()
var isArrayText=Array.isArray(this.Text);
var text;
this.TextFont=this.GetDynamicFont(dataWidth);
var pixelTatio = GetDevicePixelRatio();
this.TextFont=this.GetDynamicFont(dataWidth*pixelTatio);
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
{
var value=this.Data.Data[i];
......@@ -7863,6 +7874,81 @@ function IFrameSplitOperator()
return true;
}
this.Filter = function (aryInfo)
{
if (this.SplitCount <= 0 || aryInfo.length <= 0 || aryInfo.length < this.SplitCount) return aryInfo;
//分割线比预设的多, 过掉一些
var filter = parseInt(aryInfo.length / this.SplitCount);
if (filter <= 1) filter = 2;
var data = [];
for (var i = 0; i < aryInfo.length; i += filter)
{
if (i + filter >= aryInfo.length && i != aryInfo.length - 1) //最后一个数据放进去
{
data.push(aryInfo[aryInfo.length - 1]);
}
else
{
data.push(aryInfo[i]);
}
}
return data;
}
this.RemoveZero = function (aryInfo) //移除小数后面多余的0
{
//所有的数字小数点后面都0,才会去掉
var isAllZero = [true, true];
for (var i in aryInfo)
{
var item = aryInfo[i];
var message = item.Message[0];
if (!message) isAllZero[0] = false;
else if (!this.IsDecimalZeroEnd(message)) isAllZero[0] = false;
var message = item.Message[1];
if (!message) isAllZero[1] = false;
else if (!this.IsDecimalZeroEnd(message)) isAllZero[1] = false;
}
if (isAllZero[0] == false && isAllZero[1] == false) return;
for (var i in aryInfo)
{
var item = aryInfo[i];
if (isAllZero[0])
{
var message = item.Message[0];
item.Message[0] = message.replace(/[.][0]+/g, '');
}
if (isAllZero[1])
{
var message = item.Message[1];
item.Message[1] = message.replace(/[.][0]+/g, '');
}
}
}
this.IsDecimalZeroEnd = function (text) //是否是0结尾的小数
{
if (!text) return false;
if (text == '0') return true;
var pos = text.search(/[.]/);
if (pos < 0) return false;
for (var i = pos + 1; i < text.length; ++i)
{
var char = text.charAt(i);
if (char >= '1' && char <= '9') return false;
}
return true;
}
}
//字符串格式化 千分位分割
......@@ -8047,27 +8133,7 @@ function FrameSplitKLinePriceY()
//this.Frame.HorizontalInfo[i].LineColor="rgb(220,220,220)";
}
if (this.SplitCount>0 && splitData.Count>this.SplitCount)
{
var filter=parseInt(splitData.Count/this.SplitCount);
if (filter<=1) filter=2;
var data=[];
for(var i=0; i<this.Frame.HorizontalInfo.length; i+=filter)
{
if (i+filter>=this.Frame.HorizontalInfo.length && i!=this.Frame.HorizontalInfo.length-1) //最后一个数据放进去
{
data.push(this.Frame.HorizontalInfo[this.Frame.HorizontalInfo.length-1]);
}
else
{
data.push(this.Frame.HorizontalInfo[i]);
}
}
this.Frame.HorizontalInfo=data;
}
this.Frame.HorizontalInfo = this.Filter(this.Frame.HorizontalInfo);
this.Frame.HorizontalMax=splitData.Max;
this.Frame.HorizontalMin=splitData.Min;
}
......@@ -8121,6 +8187,8 @@ function FrameSplitY()
//this.Frame.HorizontalInfo[i].LineColor="rgb(220,220,220)";
}
this.Frame.HorizontalInfo = this.Filter(this.Frame.HorizontalInfo);
this.RemoveZero(this.Frame.HorizontalInfo);
this.Frame.HorizontalMax=splitData.Max;
this.Frame.HorizontalMin=splitData.Min;
}
......@@ -11452,11 +11520,11 @@ function KLineChartContainer(uielement)
this.KLineDrawType=0;
this.ScriptErrorCallback; //脚本执行错误回调
//this.KLineApiUrl="http://opensource.zealink.com/API/KLine2"; //历史K线api地址
this.KLineApiUrl="https://opensource.zealink.com/API/KLine2"; //历史K线api地址
this.MinuteKLineApiUrl='https://opensource.zealink.com/API/KLine3'; //历史分钟数据
this.RealtimeApiUrl="https://opensource.zealink.com/API/Stock"; //实时行情api地址
this.KLineMatchUrl="https://opensource.zealink.com/API/KLineMatch"; //形态匹配
//this.KLineApiUrl="http://opensource.zealink.com/API/KLine2"; //历史K线api地址
this.KLineApiUrl=g_JSChartResource.Domain+"/API/KLine2"; //历史K线api地址
this.MinuteKLineApiUrl=g_JSChartResource.Domain+'/API/KLine3'; //历史分钟数据
this.RealtimeApiUrl=g_JSChartResource.Domain+"/API/Stock"; //实时行情api地址
this.KLineMatchUrl=g_JSChartResource.Domain+"/API/KLineMatch"; //形态匹配
this.MinuteDialog; //双击历史K线 弹出分钟走势图
this.RightMenu; //右键菜单
......@@ -11822,7 +11890,7 @@ function KLineChartContainer(uielement)
this.BindMainData(bindData,this.PageSize);
this.BindInstructionIndexData(bindData); //执行指示脚本
for(var i=0; i<this.Frame.SubFrame.length; ++i)
{
this.BindIndexData(i,bindData);
......@@ -12055,7 +12123,7 @@ function KLineChartContainer(uielement)
{
if (windowIndex == 0) windowIndex = 1; //幅图指标,不能再主图显示
}
let indexData = { Name: indexInfo.Name, Script: indexInfo.Script, Args: indexInfo.Args };
let indexData = { Name: indexInfo.Name, Script: indexInfo.Script, Args: indexInfo.Args, ID:indexName };
return this.ChangeScriptIndex(windowIndex, indexData);
}
......@@ -12100,6 +12168,21 @@ function KLineChartContainer(uielement)
this.Draw();
}
//获取当天的显示的指标
this.GetIndexInfo=function()
{
var aryIndex=[];
for(var i in this.WindowIndex)
{
var item=this.WindowIndex[i];
var info={Name:item.Name};
if (item.ID) info.ID=item.ID;
aryIndex.push(info);
}
return aryIndex;
}
//锁|解锁指标 { Index:指标名字,IsLocked:是否要锁上,Callback:回调 }
this.LockIndex=function(lockData)
{
......@@ -13938,7 +14021,7 @@ function CustomKLineChartContainer(uielement)
delete this.newMethod;
this.ClassName='CustomKLineChartContainer';
this.CustomKLineApiUrl="https://opensource.zealink.com/API/IndexCalculate"; //自定义指数计算地址
this.CustomKLineApiUrl=g_JSChartResource.Domain+"/API/IndexCalculate"; //自定义指数计算地址
this.CustomStock; //成分
this.QueryDate={Start:20180101,End:20180627} ; //计算时间区间
......
......@@ -52,7 +52,7 @@ JSIndexScript.prototype.Get=function(id)
['飞龙四式', this.Dragon4_Main], ['飞龙四式-附图', this.Dragon4_Fig],
['资金分析', this.FundsAnalysis], ['融资占比', this.MarginProportion],
['负面新闻', this.NewsNegative],['机构调研', this.NewsResearch],['互动易',this.NewsInteract],
['负面新闻', this.NewsNegative], ['机构调研', this.NewsResearch], ['董秘连线',this.NewsInteract],
//五彩K线(函数COLOR_开头)
['五彩K线-十字星', this.COLOR_KSTAR1], ['五彩K线-早晨之星', this.COLOR_KSTAR2], ['五彩K线-黄昏之星', this.COLOR_KSTAR3], ['五彩K线-长十字', this.COLOR_SHI1],
......@@ -1955,7 +1955,7 @@ JSIndexScript.prototype.NewsResearch = function () {
JSIndexScript.prototype.NewsInteract = function () {
let data =
{
Name: '互动易', Description: '互动易统计', IsMainIndex: false,
Name: '董秘连线', Description: '互动易统计', IsMainIndex: false,
Args: [{ Name: 'N', Value: 5 }, { Name: 'N2', Value: 10 }],
Script: //脚本
'个数:NEWS(3);\n\
......
......@@ -156,6 +156,7 @@ function JSChart(element) {
if (!indexInfo) continue;
if (item.Lock) indexInfo.Lock = item.Lock;
indexInfo.ID = item.Index;
chart.WindowIndex[i] = new ScriptIndex(indexInfo.Name, indexInfo.Script, indexInfo.Args, indexInfo); //脚本执行
}
}
......@@ -541,6 +542,15 @@ function JSChart(element) {
this.JSChartContainer.ChangeScriptIndex(windowIndex, indexData);
}
//获取当前显示的指标信息
this.GetIndexInfo = function ()
{
if (this.JSChartContainer && typeof (this.JSChartContainer.GetIndexInfo) == 'function')
return this.JSChartContainer.GetIndexInfo();
else
return [];
}
//K线周期切换
this.ChangePeriod = function (period) {
if (this.JSChartContainer && typeof (this.JSChartContainer.ChangePeriod) == 'function')
......@@ -10158,7 +10168,7 @@ function KLineChartContainer(uielement) {
else {
if (windowIndex == 0) windowIndex = 1; //幅图指标,不能再主图显示
}
let indexData = { Name: indexInfo.Name, Script: indexInfo.Script, Args: indexInfo.Args };
let indexData = { Name: indexInfo.Name, Script: indexInfo.Script, Args: indexInfo.Args, ID: indexName };
return this.ChangeScriptIndex(windowIndex, indexData);
}
......@@ -10199,6 +10209,21 @@ function KLineChartContainer(uielement) {
this.Draw();
}
//获取当天的显示的指标
this.GetIndexInfo = function ()
{
var aryIndex = [];
for (var i in this.WindowIndex)
{
var item = this.WindowIndex[i];
var info = { Name: item.Name };
if (item.ID) info.ID = item.ID;
aryIndex.push(info);
}
return aryIndex;
}
//锁|解锁指标 { Index:指标名字,IsLocked:是否要锁上,Callback:回调 }
this.LockIndex = function (lockData) {
if (!lockData) return;
......@@ -12957,6 +12982,8 @@ function ScriptIndex(name, script, args, option)
this.Script = script;
this.Arguments = [];
this.OutVar = [];
this.ID; //指标ID
if (option && option.ID) this.ID = option.ID;
this.KLineType = null;
if (option && option.KLineType) this.KLineType = option.KLineType;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册