下列程序代码编译通不过,可能是其中的买卖语句有问题,请帮忙修改一下在MC上编译能通过 [MC]
-
MC用户求助:
If (HH - LC) >= (HC - LL) Then Begin
BuyRange = HH - LC;
End Else Begin
BuyRange = HC - LL;
End;
BuyTrig = K1*BuyRange;
SellTrig = K2*SellRange;
If MarketPosition = 0 Then Begin
Buy at Open of next bar + BuyTrig Stop;
Sell at Open of next bar - SellTrig Stop;
End;
If MarketPosition = -1 Then Begin
Buy at Open of next bar + Buytrig Stop;
End;
If MarketPosition = 1 Then Begin
Sell at Open of next bar - SellTrig Stop;
End;
End;
-
MC回复讨论一:
Inputs: K1(.5),K2(.5),Mday(1),Nday(1);
Vars: BuyRange(0), SellRange(0);
Vars: BuyTrig(0),SellTrig(0);
Vars: HH(0),LL(0),HC(0),LC(0);
If CurrentBar > 1 Then Begin
HH = Highest(High,Mday);
HC = Highest(Close,Mday);
LL = Lowest(Low,Mday);
LC = Lowest(Close,Mday);
If (HH - LC) >= (HC - LL) Then Begin
SellRange = HH - LC;
End Else Begin
SellRange = HC - LL;
End;
HH = Highest(High,Nday);
HC = Highest(Close,Nday);
LL = Lowest(Low,Nday);
LC = Lowest(Close,Nday);
If (HH - LC) >= (HC - LL) Then Begin
BuyRange = HH - LC;
End Else Begin
BuyRange = HC - LL;
End;
BuyTrig = K1*BuyRange;
SellTrig = K2*SellRange;
If MarketPosition = 0 Then Begin
Buy at Open of next bar + BuyTrig Stop;
Sell at Open of next bar - SellTrig Stop;
End;
If MarketPosition = -1 Then Begin
Buy at Open of next bar + Buytrig Stop;
End;
If MarketPosition = 1 Then Begin
Sell at Open of next bar - SellTrig Stop;
End;
End;
<!-- [if !supportLineBreakNewLine]-->
<!--[endif]--> -
MC回复讨论二:
Inputs: K1(.5),K2(.5),Mday(1),Nday(1);
Vars: BuyRange(0), SellRange(0);
Vars: BuyTrig(0),SellTrig(0);
Vars: HH(0),LL(0),HC(0),LC(0);
If CurrentBar > 1 Then Begin
HH = Highest(High,Mday);
HC = Highest(Close,Mday);
LL = Lowest(Low,Mday);
LC = Lowest(Close,Mday);
If (HH - LC) >= (HC - LL) Then Begin
SellRange = HH - LC;
End Else Begin
SellRange = HC - LL;
End;
HH = Highest(High,Nday);
HC = Highest(Close,Nday);
LL = Lowest(Low,Nday);
LC = Lowest(Close,Nday);
If (HH - LC) >= (HC - LL) Then Begin
BuyRange = HH - LC;
End Else Begin
BuyRange = HC - LL;
End;
BuyTrig = K1*BuyRange;
SellTrig = K2*SellRange;
If MarketPosition = 0 Then Begin
//Buy at Open of next bar + BuyTrig Stop;
buy next bar at open next bar +buytrig stop;
//Sell at Open of next bar - SellTrig Stop;
sell next bar at open next bar -selltrig stop;
End;
If MarketPosition = -1 Then Begin
//Buy at Open of next bar + Buytrig Stop;
buy next bar at open next bar+buytrig stop;
End;
If MarketPosition = 1 Then Begin
//Sell at Open of next bar - SellTrig Stop;
sell next bar at open next bar -selltrig stop;
End;
End;
特别说明:您的编译的问题在于使用委托单的语句不当导致的,您可以看一下帖子https://forum.multicharts.cn/forum/cat/0/thread/33
另外,open next bar-selltrig,这个数值实际是下一根bar的开盘价与selltrig的差。
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容