突破昨天最高價最低價今天開盤價運算出的上下軌日內交易策略[開拓者公式]
突破昨天最高價最低價今天開盤價運算出的上下軌日內交易策略
源碼:
Params
Numeric PercentOfRange(0.8);//突破參數N
Numeric ExitOnCloseMins(14.55);//平倉時間
Numeric MinRange(0.2);//最小Range
Numeric LastTradeMins(14.00);//最后交易時間
Numeric BeginTradeMins(9.00);
Numeric Lots(1);
Numeric Stoplossset(1);
Vars
NumericSeries DayOpen;
NumericSeries preDayRange;
NumericSeries HigherAfterEntry;
NumericSeries LowerAfterEntry;
Numeric preDayHigh;
Numeric preDayLow;
Numeric UpperBand;
Numeric LowerBand;
Numeric MyPrice;
Numeric StopLine;
Begin
DayOpen=OpenD(0);
preDayHigh=HighD(1);
preDayLow=LowD(1);
preDayRange=HighD(1)-LowD(1);
UpperBand=DayOpen+preDayRange*PercentOfRange;
LowerBand=Dayopen-preDayRange*PercentOfRange;
If(BarsSinceEntry==1)
{
HigherAfterEntry=AvgEntryPrice;
LowerAfterEntry=HigherAfterEntry;
}Else If(BarsSinceEntry>1)
{
HigherAfterEntry=max (HigherAfterEntry[1],High[1]);
LowerAfterEntry=min(LowerAfterEntry[1],Low[1]);
}// www.kzuj.com.cn
If(Date!=Date[1])
{DayOpen=Open;
preDayRange=preDayHigh-preDayLow;
If(preDayRange<Open*MinRange*0.01)
PreDayRange=Open*MinRange*0.01;
}Else
{
DayOpen=DayOpen[1];
preDayRange=preDayRange[1];
}
If(MarketPosition!=1&&High>=UpperBand&&Time<LastTradeMins/100)
{
Myprice=UpperBand;
If(Open>Myprice)Myprice=Open;
Buy(1,Myprice);
Return;
}
If(MarketPosition!=1&&Low<=LowerBand&&Time<LastTradeMins/100)
{
Myprice=LowerBand;
If(Open<Myprice)Myprice=Open;
Sellshort(1,Myprice);
Return;
}
If(MarketPosition==1)
{
StopLine=UpperBand-DayOpen*StopLossSet*0.01;
If(Low<=StopLine)
{
MyPrice=StopLine;
If(Open<MyPrice)MyPrice=Open;
BuyToCover(Lots,MyPrice);
}
}
//收盤平倉
If(Time>=ExitOnCloseMins/100)
{
Sell(1,Open);
BuyToCover(1,Open);
}
SetExitOncLOSE;
End
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 1145508240 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容