Example Trading System

Discussion in 'Strategy Building' started by sidinuk, Jan 17, 2005.

  1. sidinuk

    sidinuk

    Thank you Patrick205, I am fortunate that nobody in my family was involved but, of course, all our thoughts are with those that have lost loved ones.
     
    #241     Jul 8, 2005
  2. God Bless you Sid... the USA and Israel (both of whom are experts in fighting Evil) will undoubtedly offer you all available assistance in hunting down and killing the Evil Doers who so callously attacked your great city... Amen
     
    #242     Jul 8, 2005
  3. Please be advised,I dissociate myself completely and entirely from all and everything Candletrader writes on these boards. Patrick
     
    #243     Jul 8, 2005
  4. Whimsy

    Whimsy Guest

    Since your question was your first post I won't tell you to do a search this time. From Dougcs' earlier post in this thread - as he said!

    Hope you understand Easylanguage:

    Input: EndBOTime(10), StartTradBars(1), XDayofWk(1), admin(0.00), hys(0.00), TrinLimit(0.00);
    var: hi(0), lo(0), btime(0), trin(0), stime(0);

    DefineDLLFunc: "PUSHPOP.DLL", DOUBLE, "POP", LONG, LONG, LONG;

    value1=pop(99,date,time);

    if dayofweek(date) <> xdayofwk then begin
    trin = c data2;
    if currentbar = 1 then begin
    btime = calctime(0830, endbotime*barinterval);

    stime = calctime(btime, starttradbars*barinterval);
    end;

    if date>date[1] then begin
    hi=h;lo=l;
    end;
    if time <=btime then begin
    hi = maxlist(hi,high);
    lo = minlist(lo,low);
    end;

    if time>=stime and marketposition=0 and time>=btime and time <=1430 then begin
    if trin<1-trinlimit and value1>admin then buy (20000/c) shares next bar at hi + hys stop;
    if trin>1 + trinlimit and value1<-admin then sell short (20000/c) shares next bar at lo - hys stop;
    end;

    if marketposition<>0 then begin
    sell next bar at lo - hys stop;
    buy to cover next bar at hi + hys stop;
    end;

    if time = 1500 then begin
    sell this bar at the close;
    buy to cover this bar at the close;
    end;

    end;

    Data1 is IWM
    Data2 is $TRINQ

    the dll reads adv/(adv+decl) which I use in a number of other studies.

    Substitute:

    data3 = $adv
    data4=$decl
    adv = c data3
    dec = c data4

    then ,
    value1 = iff(adv+dec>0 ,adv/(adv+dec), 0);

    DS
     
    #244     Jul 8, 2005
  5. That's the ticket fellows.

    Over and out.
     
    #245     Jul 8, 2005
  6. Hi dougcs,

    May I know what is the average winning and losing trade?

    Also, can you post the modifications again but modified again to be used on ER2? The earlier version cannot be used on ER2. I am hopeless with Easylanguage so maybe I have missed something. I ran Sidinuk's system no problem but cannot get the modified version to run on ER2.

    Thanks.
     
    #246     Jul 9, 2005
  7. 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
     
    #247     Jul 9, 2005
  8. Here is an EXCEL file of the results based on 500 shares of IWM per trade:
     
    #248     Jul 9, 2005


  9. I am using TS 8.1 and it somehow does not seem to recognize "barstoclose". Would anyone know the equivalent term for this in TS 8.1.

    Thanks in advance for any help.
     
    #249     Jul 9, 2005
  10. Doug,

    What version of TS is that?

    I haven't seen a Performance Summary Report since TS4. Its amazing the number of additional statistics on it now.

    Brooks
     
    #250     Jul 9, 2005