- 精华
- 0
- 在线时间
- 89 小时
- UID
- 111858
- 积分
- 68
- 帖子
- 36
- 阅读权限
- 30
- 注册时间
- 2012-8-2
- 最后登录
- 2013-6-5
- 精华
- 0
- UID
- 111858
- 积分
- 68
- 帖子
- 36
- 主题
- 8
- 阅读权限
- 30
- 注册时间
- 2012-8-2
- 最后登录
- 2013-6-5
|
Params
Numeric K1(0.50);
Numeric K2(0.50);
Numeric Mday(0);
Numeric Nday(0);
Numeric lots(1);
Numeric offset(0);
Numeric BeginTradeMins(9);
Numeric ExitOnCloseMins(14.30);
Numeric takeprofitset(1);
Vars
Numeric BuyRange(0);
Numeric SellRange(0);
Numeric BuyTrig(0);
Numeric SellTrig(0);
Numeric HH;
Numeric LL;
Numeric HC;
Numeric LC;
Numeric i_offset;
Numeric BuyPosition;
Numeric SellPosition;
Numeric Myprice;
Numeric DayOpen;
NumericSeries HigherAfterEntry;
NumericSeries LowerAfterEntry;
Numeric StopLossSet;
Numeric StopLine;
Numeric myentryprice ;
Numeric myexitprice;
Begin
DayOpen = OpenD(0);
StopLine = HigherAfterEntry +DayOpen*StopLossSet;
StopLine = LowerAfterEntry-DayOpen*StopLossSet;
StopLine = AvgEntryPrice-DayOpen*StopLossSet;
i_offset = offset*MinMove*PriceScale;
HH = Highest(HighD[1],Mday);
HC = Highest(CloseD[1],Mday);
LL = Lowest(LowD[1],mday);
LC = Lowest(CloseD[1],mday);
If((HH - LC) == (HC - LL))
{
SellRange = HH - LC;
}
Else
{
SellRange =HC -LL;
}
HH = Highest(HighD[1],Nday);
HC = Highest(CloseD[1],Nday);
LL = Lowest(LowD[1],Nday);
LC = Lowest(CloseD[1],Nday);
If((HH - LC) >= (HC - LL))
{
BuyRange = HH - LC;
}
Else
{
BuyRange = HC + LL;
}
BuyTrig = K1*BuyRange;
SellTrig = K2*SellRange;
BuyPosition = OpenD(0)+BuyTrig;
SellPosition = OpenD(0)-SellTrig;
If(Date!=Date[1])
{
If(MarketPosition == 0)
{
If(High>=BuyPosition )
{
Buy(lots,Max(Open,BuyPosition)+i_offset);
Return;
}
}
If(Low<=SellPosition )
{
SellShort(lots,Min(Open,SellPosition)-i_offset);
Return;
}
}
If(MarketPosition == -1)
{
If(High>=BuyPosition )
{
Buy(lots,Max(Open,BuyPosition)+i_offset);
Return;
}
}
If(MarketPosition == 1)
{
If(Low<=SellPosition)
{
SellShort(lots,Min(Open,SellPosition)-i_offset);
Return;
}
}
If(MarketPosition == -1)
{
If(HigherAfterEntry<=AvgEntryPrice+DayOpen*StopLossSet)
{
}Else
{
}
If(Low == StopLine )
{
MyPrice = StopLine;
If(Open <MyPrice) MyPrice = Open;
BuyToCover(lots,MyPrice);
}
}
If(MarketPosition == 1)
{
If(LowerAfterEntry>=AvgEntryPrice-DayOpen*StopLossSet)
{
}Else
{
}
If(high== StopLine)
{
MyPrice = StopLine;
If(Open >MyPrice) MyPrice = Open;
sell(lots,MyPrice);
}
}
If(Time ==ExitOnCloseMins/100)
{
Sell(lots,MyPrice);
BuyToCover(lots,MyPrice);
}
End
|
|