编写代码,在副图显示布林线,需带K线,但是设置之后,只显示上中下轨,没显示K线,请问该怎么调整?
时间日期参数呢?没有这个怎么画?
怎么添加
//------------------------------------------------------------------------
// 简称: BOLLX
// 名称: 布林通道
// 类别: 策略应用
// 类型: 内建应用
//------------------------------------------------------------------------
Params
Numeric Length(20); //周期
Numeric Offset(2); //标准差倍数
Vars
Numeric UpLine; //上轨
Numeric DownLine; //下轨
Series<Numeric> MidLine; //中间线
Numeric Band;
Plot plt;
Bar myBar;
Events
OnReady()
{
SetBackBarMaxCount(1+Length);
Range[0:DataSourceSize() - 1]
{
setPlotOption("MidLine", "begin-bar", Length);
setPlotOption("UpLine", "begin-bar", Length);
setPlotOption("DownLine", "begin-bar", Length);
}
plt.figure();
plt.setOption("x-format","time");//K线不需要显示设置
}
OnBar(ArrayRef<Integer> indexs)
{
Range[0:DataSourceSize() - 1]
{
MidLine = AverageFC(Close,Length);
Band = StandardDev(Close,Length,2);
UpLine = MidLine + Offset * Band;
DownLine = MidLine - Offset * Band;
PlotNumeric("UpLine",UpLine);
PlotNumeric("DownLine",DownLine);
PlotNumeric("MidLine",MidLine);
myBar.open=Open();
myBar.high=High();
myBar.low=Low();
myBar.close=Close();
myBar.volume=Vol();
myBar.openInt=OpenInt();
myBar.turnOver=turnOver();
plt.kline("kline",myBar);
}
}
//------------------------------------------------------------------------
// 编译版本 GS2010.12.08
// 版权所有 TradeBlazer Software 2003-2025
// 更改声明 TradeBlazer Software保留对TradeBlazer平
// 台每一版本的TradeBlazer公式修改和重写的权利
//------------------------------------------------------------------------
怎么是这种状态
这是案例给的代码
这是你给的代码。
你不觉得你少了一行吗?
一定要说得这么详细吗??
加上了,显示这种,没有上中下轨道?
//------------------------------------------------------------------------
// 简称: BOLLX
// 名称: 布林通道
// 类别: 策略应用
// 类型: 内建应用
//------------------------------------------------------------------------
Params
Numeric Length(20); //周期
Numeric Offset(2); //标准差倍数
Vars
Numeric UpLine; //上轨
Numeric DownLine; //下轨
Series<Numeric> MidLine; //中间线
Numeric Band;
Plot plt;
Bar myBar;
Events
OnReady()
{
SetBackBarMaxCount(1+Length);
Range[0:DataSourceSize() - 1]
{
setPlotOption("MidLine", "begin-bar", Length);
setPlotOption("UpLine", "begin-bar", Length);
setPlotOption("DownLine", "begin-bar", Length);
}
plt.figure();
plt.setOption("x-format","time");//K线不需要显示设置
}
OnBar(ArrayRef<Integer> indexs)
{
Range[0:DataSourceSize() - 1]
{
MidLine = AverageFC(Close,Length);
Band = StandardDev(Close,Length,2);
UpLine = MidLine + Offset * Band;
DownLine = MidLine - Offset * Band;
PlotNumeric("UpLine",UpLine);
PlotNumeric("DownLine",DownLine);
PlotNumeric("MidLine",MidLine);
myBar.dateTime=date+time;
myBar.open=Open();
myBar.high=High();
myBar.low=Low();
myBar.close=Close();
myBar.volume=Vol();
myBar.openInt=OpenInt();
myBar.turnOver=turnOver();
plt.kline("kline",myBar);
}
}
//------------------------------------------------------------------------
// 编译版本 GS2010.12.08
// 版权所有 TradeBlazer Software 2003-2025
// 更改声明 TradeBlazer Software保留对TradeBlazer平
// 台每一版本的TradeBlazer公式修改和重写的权利
//------------------------------------------------------------------------
怎么分成两个副图了
用一个画笔画
boll也用 plt.line
//------------------------------------------------------------------------
// 简称: BOLLX
// 名称: 布林通道
// 类别: 策略应用
// 类型: 内建应用
//------------------------------------------------------------------------
Params
Numeric Length(20); //周期
Numeric Offset(2); //标准差倍数
Vars
Numeric UpLine; //上轨
Numeric DownLine; //下轨
Series<Numeric> MidLine; //中间线
Numeric Band;
Plot plt;
Bar myBar;
Events
OnReady()
{
SetBackBarMaxCount(1+Length);
Range[0:DataSourceSize() - 1]
{
setPlotOption("MidLine", "begin-bar", Length);
setPlotOption("UpLine", "begin-bar", Length);
setPlotOption("DownLine", "begin-bar", Length);
}
}
OnBar(ArrayRef<Integer> indexs)
{
Range[0:DataSourceSize() - 1]
{
MidLine = AverageFC(Close,Length);
Band = StandardDev(Close,Length,2);
UpLine = MidLine + Offset * Band;
DownLine = MidLine - Offset * Band;
PlotNumeric("UpLine",UpLine);
PlotNumeric("DownLine",DownLine);
PlotNumeric("MidLine",MidLine);
myBar.open=Open();
myBar.high=High();
myBar.low=Low();
myBar.close=Close();
myBar.volume=Vol();
myBar.openInt=OpenInt();
myBar.turnOver=turnOver();
plt.kline("kline",myBar);
}
}
//------------------------------------------------------------------------
// 编译版本 GS2010.12.08
// 版权所有 TradeBlazer Software 2003-2025
// 更改声明 TradeBlazer Software保留对TradeBlazer平
// 台每一版本的TradeBlazer公式修改和重写的权利
//------------------------------------------------------------------------