龙听期货论坛's Archiver

龙听 发表于 2023-12-8 13:45

我们的 "涡轮增压罗素日间交易系统 "需要调整吗?【原文+程式码】

**** Hidden Message *****

我爱期货 发表于 2023-12-11 09:49

11

明铭明铭 发表于 2023-12-15 23:44

学习!

龙听 发表于 2024-1-5 11:46

[code]
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;
[/code]

页: [1]