温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,汇文网负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
网站客服:3074922707
rrquantC47
MC
inputs:
Length1( 5 ),
Length2( 20 ),
M_HL( 10 ),
Fund( 20000 );
Vars:
Var1( 0 ),
TR( 0 ),
ATR( 0 ),
MA1( 0 ),
MA2( 0 ),
N_BuyK( 0 ),
N_SellK( 0 ),
ATR_BuyK( 0 ),
ATR_SellK( 0 ),
Price_BuyK( 0 ),
Price_SellK( 0 ),
Price_BuyAK( 0 ),
Price_SellAK( 0 ),
Price_SellS( 0 ),
Price_BuyS( 0 ),
Price_SellY( 0 ),
Price_BuyY( 0 ),
BuyPK( false ),
SellPK( false ),
BuyAK( false ),
SellAK( false ),
BuyA( false ),
SellA( false ),
BuyS( false ),
SellS( false ),
BuyY( false ),
SellY( false );
Var1=maxlist(1,IntPortion(Fund/(O*bigpointvalue*0.1)));
TR=maxlist(Maxlist((High-Low),absvalue(Close[1]-High)),absvalue(Close[1]-Low));
ATR=Average(TR,Length2);
MA1=Average(Close,Length1);
MA2=Average(Close,Length2);
N_BuyK=BarsSinceEntry+1;
N_SellK=BarsSinceEntry+1;
BuyPK=High>=Highest(High,Length1) and MA1>MA2;
SellPK=Low<=Lowest(Low,Length1) and MA1<MA2;
BuyAK=Close>Price_BuyAK;
SellAK=Close<Price_SellAK;
SellS=Close<=Price_SellS;
BuyS=Close>=Price_BuyS;
SellY=Close>Price_BuyK+ATR_BuyK and Close<=Price_SellY;
BuyY=Close<Price_SellK-ATR_SellK and Close>=Price_BuyY;
Price_SellY=Lowest(Low,M_HL)+N_BuyK*0.05*ATR;
Price_BuyY=Highest(High,M_HL)-N_SellK*0.05*ATR;
if (CurrentBar>Length2) then
begin
If MarketPosition<=0 and BuyPK then
begin
buy ("BPK") Var1 shares next bar market;
ATR_BuyK=ATR;
Price_BuyK=Open;
Price_BuyAK=Price_BuyK+ATR;
Price_SellS=Price_BuyK-2*ATR;
BuyA=false;
end;
If MarketPosition>=0 and SellPK then
begin
sellshort ("SPK") Var1 shares next bar market;
ATR_SellK=ATR;
Price_SellK=Open;
Price_SellAK=Price_SellK-ATR;
Price_BuyS=Price_SellK+2*ATR;
SellA=false;
end;
if (BarsSinceEntry>1) then
begin
If MarketPosition>0 then
begin
if (BuyA=false and BuyAK) then
begin
buy ("BAK") Var1 shares next bar market;
BuyA=True;
end;
If SellS then sell ("SS")next bar market;
If SellY then sell ("SY")next bar market;
end;
If MarketPosition>0 then
begin
if (SellA=false and SellAK) then
begin
sellshort ("SAK") Var1 shares next bar market;
SellA=True;
end;
If BuyS then buytocover ("BS")next bar market;
If BuyY then buytocover ("BY")next bar market;
end;
end;
end;