海龜法則策略源碼
作者:MC 來源:cxh99.com 發布時間:2014年08月23日
- 海龜法則源碼
variables: n(0),tr(0),pnd(0),dv(0),accountbalance(0),unit(0),var1(0),var2(0);
tr=maxlist(h-l,h-c[1],c[1]-l);
pnd=AvgTrueRange(20);
n=(19*pnd+tr)/20 ;
dv=n*bigpointvalue;
var1=currentbid;
condition5=currentbid>highest(h,55)[1];
condition6=currentbid>highest(h,20)[1];
condition7=currentbid<lowest(l,55)[1];
condition8=currentbid<lowest(l,20)[1];
{//55}
if condition5 then;
buy next bar var1 or higher;
if condition5 and var1=currentbid+0.5*n then
buy next bar var1 or higher;// cxh99.com
if condition5 and var1=currentbid+1*n then
buy next bar var1 or higher;
if condition5 and var1=currentbid+1.5*n then
buy next bar var1 or higher;// www.tumamayizhan.com
if condition6 then
sell next bar market;
if condition7 then
sellshort next bar var1 or lower;
if condition7 and var1=currentbid[1]-0.5*n then
sellshort next bar var1 or lower;
if condition7 and var1=currentbid[1]-1*n then
sellshort next bar var1 or lower;
if condition7 and var1=currentbid[1]-1.5*n then
sellshort next bar var1 or lower;// cxh99.com
if condition8 then
buytocover next bar market;