Decoding help please!

Discussion in 'Strategy Development' started by TheoCap, Feb 25, 2008.

  1. TheoCap

    TheoCap

    hey all, I'm currently re-reading all of Acrary's posts and came across a dummy system he devolped to measure traders against. attached is the code. However, my one semester of Scheme experience isn't helping me out with understanding this format. If anyone has the time/inclination, Would someone mind decoding it for me into english? If so, thank you in advance!
     
  2. oTzt

    oTzt

    variables: hh(0),ll(0),tgt(0);
    if date <> date[1] then begin
    if dayofweekfix(date) = 1 then begin
    hh = 0;
    ll = 99999;
    end;
    tgt = (highd(1) - lowd(1) + highd(2) - lowd(2) + highd(3) - lowd(3))/15;
    end;
    if high[1] > hh then hh = high[1];
    if low[1] < ll then ll = low[1];
    if adx(14) > 25 then begin
    sell 1 contract next bar at hh limit;
    buy 1 contract next bar at ll limit;
    end;
    exitlong at hh + tgt limit;
    exitshort at ll - tgt limit;


    Hi,

    It seems to do nothing extraordinary.
    I don't know wich langage is used, but by googling "dayofweekfix", it seems that it shall be Tradestation's.
    The names of the variables are pretty clear.

    So, in short :

    1) If the current date is different from the one of the previous loop, and if we're on monday :
    reset memorised highest high ("hh") and lowest low ("LL") to a default value ;

    2) If the current date is different from the one of the previous loop (but whatever be the day)
    compute a target ("tgt") as 6.66% of the sums of the diferences of the 3 previous days opens and closes
    (6.66% of the sum of the ranges of the 3 previous days).

    3) every day :
    update the memorised highest high and lowest low if needed ;
    If the 14 days ADX rises above 25 then try to open two positions ;
    Allways set two stops, one for each of the openned positions. The one for the long side at the entry price + the previously computed target (tgt), and the other logically inversed.

    As variables are resetted each monday, then the highes thigh and lowest low should be weekly highs and lows (unless there are holes in the datas).

    Hope this may serve as a basis : My knowledge of TS's language is worth than my knowledge of english...

    Sheers,
    Olivier.
     
  3. TheoCap

    TheoCap

    thanks a ton oliver. I really appreciate it.

    I got the same gist you did, i just got thrown off by the rolling date-setting method used.

    Overall, you're right it's not anything special (although i've found my results come from simple strategies), but it was only developed as a "competitor" to compete/compare yourself against.

    my guess is in theory, the system makes a little bit of money (by having a solid set of entry rules) but does not cut losses short and let winners ride, the main component many traders attribute to successful trading talent. so if you can do that, you should beat this system hands down.

    Regardless, thanks for your time, I really appreciate it.
     
  4. oTzt

    oTzt

    You're welcome...
    (In fact it did interest me : I appreciate a lot ACrary's posts, but never saw this piece of code hence... thanks in turn for the discovery)
    Olivier.
     
  5. No, the formula is this: 0,2 x average range of the past three days

    tgt = (highd(1) - lowd(1) + highd(2) - lowd(2) + highd(3) - lowd(3))/15;

    you can view it this way: (range(1)+range(2)+range(3)) / (3*5) = avg_range(3) / 5 or 20% of the avgrng(3)


    The system buys at the current low of the week and sells at the high of the week as long as ADX > 25, and exits with profit target of "tgt".

    I think the problem with the system is that it has small profit target (thus win percentage will be very high) but has no stop, thus the downside potential is unlimited. It will get beaten with large non-normal (fat-tail) moves against the trades.

    The other issue might be with ADX > 25 precondition, as higher ADX values indicate directional movement and possible breakouts, while the system does the opposite - it fades the breakouts. It would probably work better with ADX < 25 precondition, or with reversed directions of the trades.
     
  6. TheoCap

    TheoCap

    Thanks for the clarification. My only question is what does the system look at if it is monday(or does it not look at anything)? I really need to buckle down and learn some EasyLanguage.

    I think your'e exactly right re: the ADX component.

    So summing it up the strategy is fading an attempt to break support/resistance with a low ADX and with an infinitely low R:R (limited reward/unlimited risk).

    The surprising thing is according to Acrary, it actually made a little bit of money. The only thing I could think of attributing the very marginable success to would be it's entry spot (the weekly low/high).

    Therefore, just for fun, I think you could convert this into a decent system in either to ways.


    1) flip the ADX criteria, remove the targets, and add a money management/position sizing technique.

    2) flip the entry (buy the high, sell the low) with the ADX component left unchanged, remove the targets, and add a money management/position sizing technique.

    Interesting nonetheless.
     
  7. If it's Monday, the system takes high and low of the previous day, i.e. high and low of Friday. Here's simple explanation:

    "if dayofweekfix(date) = 1 then begin
    hh = 0;
    ll = 99999;
    end;"

    hh - highest high
    ll - lowest low
    if it's Monday, then the hh and ll values are reset (lowest low is set to this high value because any other value it would be compared to will be smaller)

    Next...

    "if high[1] > hh then hh = high[1];
    if low[1] < ll then ll = low[1];"

    high[1] and low[1] are high and low of yesterday (index "1" marks 1 day before today), so on Monday it's Friday.
    EasyLanguage is in fact easy and intuitive. I have never programmed in this language and don't even own TS. But the syntax and semantics are almost the same as in universal programming languages like C or JAVA.

    I bet you meant "high ADX" there.

    It could have made some money, but I think it had massive drawdowns. Also I don't see any other exit besides profit target, and a new entry could be made any day every day, so the system can build up a massive position. It waits forever until profit targets are hit, but in reality it will hit margin call sooner or later.