- UID
- 2
- 积分
- 2892977
- 威望
- 1396520 布
- 龙e币
- 1496457 刀
- 在线时间
- 13326 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-12-26
|
- inputs: atrLen(10),stopAmtPoints(10.00),offSetAmt(.2),profitObj1(5),endTradeTime(1530);
- vars: atrAmt(0),smallRange(false),canBuy(true),canSell(true),stb(0),sts(0),tkpS(0),tkpL(0),yesTrueRange(0); vars: buysToday(0),sellsToday(0),j(0),longLossPt(0),shortLossPt(0);
- {Plot on 5 minute day session - programmed by George Pruitt}
- {I used the OpenD(),HighD(),LowD(),CloseD() functions to get the prior day’s highs and lows and closes }
- value1 = 0;
- for j = 1 to atrLen begin
- value1 = value1 + maxList(closeD(j+1),highD(j)) - minList(closeD(j+1),lowD(j));
- end;
- atrAmt = value1/atrLen;
- yesTrueRange = maxList(closeD(2),highD(1)) - minList(closeD(2),lowD(1));
- smallRange = yesTrueRange < atrAmt;
- if(date<>date[1]) then // first bar of the day begin
- canBuy = false;
- canSell = false;
- buysToday = 0;
- sellsToday = 0;
- end;
- if marketPosition = 1 then buysToday = 1; // if we already bot then no more buys
- if marketPosition =-1 then sellsToday = 1;
- stb = openD(0) + offSetAmt * atrAmt;
- sts = openD(0) - offSetAmt * atrAmt;
- if(closeD(1)>=closeD(2) and smallRange) then canBuy = true;
- if(closeD(1)<closeD(2) and smallRange) then canSell = true;
- if(canBuy and buysToday = 0 and time < endTradeTime) then buy(“SFOBuy”) 2 contracts next bar stb stop;
- if(canSell and sellsToday = 0 and time < endTradeTime ) then sellShort(“SFOSell”) 2 contracts next bar sts stop;
- if currentContracts = 2 and marketPosition = 1 and highD(0) > entryPrice + profitObj1 then sell(“LongProf1”) 1 contract next bar at highD(0) - 5 stop;
- if currentContracts = 2 and marketPosition =-1 and lowD(0) < entryPrice - profitObj1 then buyToCover(“ShrtProf1”) 1 contract next bar at lowD(0) + 5 stop;
- if currentContracts = 1 then sell(“L-BreakEven”) next bar at entryPrice stop;
- if currentContracts = 1 then buyToCover(“S-BreakEven”) next bar at entryPrice stop;
- if marketPosition = 1 then sell(“MM-L-Out”) next bar at entryPrice - stopAmtPoints stop;
- if marketPosition =-1 then buyToCover(“MM-S-Out”) next bar at entryPrice + stopAmtPoints stop; setExitOnClose;
复制代码 |
|