請版主幫忙解決一下程序信號閃爍的問題
作者:開拓者 TB 來源:cxh99.com 發布時間:2016年02月28日
- 咨詢內容:
Params
Numeric notaft(14.58);
Vars
Numericseries High5(0);//
Numericseries Low5(0);//
Numeric Value1;//
Numericseries ennight;//
Numericseries enday;//
begin
Value1=Average(Close,10);
if (time>=0.210000 && time<=0.21045959)
{
High5=Highest(High,5);
Low5=Lowest(Low,5);
}
PlotNumeric("5分鐘高點",High5,0,White);
PlotNumeric("5分鐘低點",Low5,0,White);
//開倉//程序化交易
if(date!=date[1])
{
ennight=0;
enday=0;
}
if(MarketPosition==0 and Close>High5 and Low<=High5 )
if(time>0.1600 and Time<0.2400 && ennight<1)
{
buy(1,Close);
ennight= ennight[1]+1;
}else if ( time>0.0900 and time<0.1500 && enday<1)
{
buy(1,Close);
enday = enday[1]+1;
}
if(MarketPosition==0 and Close<low5 and High>=low5 )
if(time>0.1600 and Time<0.2400 && ennight<1)
{
SellShort(1,Close);
ennight= ennight[1]+1;
}else if ( time>0.0900 and time<0.1500 && enday<1)
{
SellShort (1,Close);
enday = enday[1]+1;
}
//止損
if (MarketPosition==1 and Close<Value1 )
{
sell(1,low);
}
if (MarketPosition==-1 and Close>Value1)
{
BuyToCover(1,High);
}
//收盤平倉
if(Time*100>=notaft and Time<0.1600)
{
if(marketposition==-1)
{
BuyToCover(1,Open);
}
if(marketposition==1)
{
Sell(1,Open);
}
}
End
- TB技術人員:
buy開倉函數不能直接用close,high,low之類的,因為實時數據中bar沒走完這些值是會變化的,open則不會變。