Quote from dougcs:
Input: EndBOTime(10), StartTradBars(1), XDayofWk(1), admin(0.00), hys(0.00), TrinLimit(0.00), MaxSDBORange(2.00), datanum(99), XTime(120);
var: hi(0), lo(0), btime(0), trin(0), stime(0), lx(0), sx(0), borange(0), tcount(0), fricount(0), goshort(false);
var: x1(0), sumx(0), sumy(0), sumxy(0), ix(0), in(0), top1(0), btm1(0), var1(0), sd(0), xt(0), permission(true), golong(false);
array: bkoutrange[1000](0);
DefineDLLFunc: "PUSHPOP.DLL", DOUBLE, "POP", LONG, LONG, LONG;
value1=pop(datanum,date,time);
trin = c data2;
if currentbar = 1 then begin
permission=true;
golong = false;
goshort=false;
btime = calctime(0830, endbotime*barinterval);
stime = calctime(btime, starttradbars*barinterval);
xt = calctime(btime, xtime);
end;
if date>date[1] then begin
permission = true;
hi=h;lo=l;
end;
if time <=btime then begin
hi = maxlist(hi,high);
lo = minlist(lo,low);
lx = (hi+lo)/2;
end;
condition0 = dayofweek(date)<>xdayofwk and borange<=maxsdborange and time>=stime and marketposition=0 and time>=btime and time <=1430 and permission;
if condition0 then begin
condition2= ((trin<1-trinlimit and value1>admin) or value1>0.05);
if condition2 then buy 500 shares next bar at hi + hys stop;
condition3 = trin>1 + trinlimit and value1<-admin;
if condition3 then sell short 500 shares next bar at lo - hys stop;
end;
if marketposition<>0 then begin
permission=false;
sell next bar at lo - hys stop;
buy to cover next bar at hi + hys stop;
end;
if barstoclose<=1 then begin
sell this bar at the close;
buy to cover this bar at the close;
end;
I use the pushpop dll to feed ADV/(ADV+DEC) -0.5 data to this as well as other studies I trade. So to set up your chart, use 15 minutes using IWM as data1 (I trade it and ER2 depending on various portfolio factors but I've found they are fairly interchangeable. ) You would need $TRINQ as data2, $ADVQ as data3 and $DECLQ as data 4. You would then substitute value1= (c data3/(c data3 + c data4))-0.5 for the "POP" statement.
DS
Hi dougcs,
Thanks for the code but I am using TS8.1 which has slightly different version of Easylanguage I think. Is it possible for you to change the above to a format suitable for TS8.1? And, if possible, can you please change the instrument to ER2, as I would be more familiar with that instrument and also possible for me to compare with Sidinuk's system.
Thanks a lot.