in Search

MetaStock programming competition!

Last post 12-23-2005, 13:52 by wabbit. 52 replies.
Page 1 of 3 (53 items)   1 2 3 Next >
Sort Posts: Previous Next
  •  12-08-2005, 21:34 12614

    MetaStock programming competition!

    Hey... where did that MetaStock programming competition go? :eek:
    Oh, here it is.


    Ok, let's see who can work it out before Sunday's release of the first line of code! :roll:


    jose '-)
    MetaStockTools.com
  •  12-10-2005, 1:22 12694 in reply to 12614

    We have a winner!

    We have a winner!

    Congratulations to Rodney Platt for his less-than-elegant but workable solution!

    Rodney has chosen the MACDH Divergence kit for his prize.


    This competition has been extended, and we are now looking for a new winner who can code the month's High/Low signals without any PREV functions.

    C'mon guys, it's Xmas - bring out the good code! :)


    jose '-)
    MetaStockTools.com
  •  12-10-2005, 5:25 12711 in reply to 12614

    Re: We have a winner!

    PremiumData, suppliers of quality data (as used by myself), have kindly offered to add the following to the competition's prize pool:

    One year's data subscription plus complete data history to any one of ASX, SGX, US Stocks, Futures or Forex markets, valued at between US$290 and US$440.

    With a choice of five quality prizes to be won, MetaStock code never looked so good! :)


    jose '-)
    MetaStockTools.com
  •  12-10-2005, 6:42 12712 in reply to 12614

    Re: We have a winner!

    Dear Jose,

    I saw the Competition that you put in Metastock Forum.

    I was try yesterday a lot for to write the Formula without Success.

    My problem was, that can't write the Expressions able to Time meaning the Expressions for Days, Months, Years in this contest.

    Anyway, Congratulations from my Side to the Person that win.

    Dear Jose i want to please you to ask that Person and publish in the Forum what is his Profession or if he is a Professional Trader.

    I want also to please you, to make as Mandatory in the New Competitions, to say the Winner which is her/his Profession or if she/he is a Professional Trader.

    Kind Regards,

    George K.
  •  12-10-2005, 10:13 12716 in reply to 12614

    Re: We have a winner!

    George, personal details are not relevant to this competition.


    jose '-)
    MetaStockTools.com
  •  12-10-2005, 11:15 12718 in reply to 12614

    Re: We have a winner!

    George, personal details are not relevant to this competition.

    Or to anything else on the forum either. Per the membership rules and disclaimer, no assumptions are made regarding the quality of any post or member qualifications. This is after all a public forum. Take what you can and discard the rest. Professional advice is by definition a paid service.
    Traders' Consortium
  •  12-10-2005, 11:18 12719 in reply to 12614

    Re: We have a winner!

    Congratulations Ripfree! :D
    Traders' Consortium
  •  12-11-2005, 0:39 12735 in reply to 12614

    1st hint

    The first of eight lines of code has now been posted here.

    The next hint? Watch for it this coming Wed 14th Dec!


    jose '-)
    MetaStockTools.com
  •  12-11-2005, 8:22 12754 in reply to 12614

    Re: 1st hint

    Jose,

    What if a stock only trades on one month per year?

    Perhaps something like:

    nuMonth:=Month()<>Ref(Month(),-1) OR (Month()=Ref(Month(),-1) AND Year()<>Ref(Year(),-1)) OR Cum(1)=2 ;

    might be more bullet-proof??


    wabbit :D

    P.S. Nice way to get around the not-counting-the-first-bar-in-the-chart problem!

    "The question of whether a computer can think is no more interesting than the question of whether a submarine can swim."
    Edsgar W. Dijkstra

     

    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC C, 11 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status :
    My SkyPE account : wabbit.com.au

  •  12-11-2005, 12:36 12761 in reply to 12614

    Re: 1st hint

    ...or even

    NM:=Month()<>Ref(Month(),-1) OR (Month()=Ref(Month(),-1) AND Year()<>Ref(Year(),-1));
    nuMonth:=Cum(NM>-1)=1 OR NM;

    does the same job....


    wabbit :D

    "The question of whether a computer can think is no more interesting than the question of whether a submarine can swim."
    Edsgar W. Dijkstra

     

    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC C, 11 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status :
    My SkyPE account : wabbit.com.au

  •  12-11-2005, 13:52 12762 in reply to 12614

    Re: 1st hint

    ... and another quick question before I sit down and try to think this one out....

    What if the monthly hi/lo is reached several times in that month? Does the indicator have to show only one hi/lo per month, or on every occassion it is attained?


    wabbit :D

    P.S. I can see this is going to be using up some of my time when I am supposed to be doing other things!

    "The question of whether a computer can think is no more interesting than the question of whether a submarine can swim."
    Edsgar W. Dijkstra

     

    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC C, 11 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status :
    My SkyPE account : wabbit.com.au

  •  12-11-2005, 17:27 12765 in reply to 12614

    Re: 1st hint

    I can get the previous months high/low plotted, three lines of code each,
    but can't get it to one signal in the correct month...ummmm..

    Here is the code but I may be leading you in the wrong direction.

    mth1:=If((Month()=Ref(Month(),-1)+1) OR
    (Ref(Month(),-1)-Month()=11),1,0);

    H1:=HighestSince(1,mth1=1,H);
    H2 := If((Ref(Month(),-1)<Month()) OR
    (Ref(Month(),-1)-Month()=11),Ref(H1,-1),0);
    H3 := HighestSince(1,(H2<>0),H2);
    H3;

    L1:=LowestSince(1,mth1=1,L);
    L2 := If((Ref(Month(),-1)<Month()) OR
    (Ref(Month(),-1)-Month()=11),Ref(L1,-1),0);
    L3 := HighestSince(1,(L2<>0),L2);
    L3
  •  12-11-2005, 17:30 12766 in reply to 12614

    Re: 1st hint

    When try to put the Creation of Mr Rodney Platt into my Metastock 9.1 Pro for E-Signal, didn't work correctly.

    What i mean?

    I put into the Metastock:

    --->Start--->
    Days:=Cum(1);
    DaysLoaded:=LastValue(Days);
    DaysRemaining:=DaysLoaded-Days;

    StartOfMonth:=(Month()>Ref(Month(),-1))
    OR (Month()=1 AND Ref(Month(),-1)=12);

    Months:=Cum(StartOfMonth);
    MonthsLoaded:=LastValue(Months);
    MonThsRemaining:=MonthsLoaded-Months;

    EndOfMonth:=(Month()<Ref(Month(),1))
    OR (Month()=12 AND Ref(Month(),1)=1);

    HighDaysAgo:=If(EndOfMonth,HighestSinceBars(1,StartOfMonth,HIGH),0);
    LastHigh:=LastValue(HighestSinceBars(1,StartOfMonth,HIGH));
    LowDaysAgo:=If(EndOfMonth,LowestSinceBars(1,StartOfMonth,LOW),0);
    LastLow:=LastValue(LowestSinceBars(1,StartOfMonth,LOW));

    DaysPassed:=BarsSince(StartOfMonth);
    LastDay:=LastValue(DaysPassed);

    DaysLeftInMonth:=If(MonthsRemaining>0,
    LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
    Endofmonth,DaysPassed)),LastDay)-DaysPassed;
    currenthigh:=If(MonthsRemaining>0,
    LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
    EndOfMonth,HighDaysAgo)),LastHigh);
    currentLow:=If(MonthsRemaining>0,
    LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
    EndOfMonth,LowDaysAgo)),LastLow);

    HighDay:=If(DaysLeftInMonth=Currenthigh,1,0);
    LowDay:=If(DaysLeftInMonth=CurrentLow,-1,0);

    HighDay;
    LowDay;
    <---End<---

    But when i put the same Formula without the:

    --->Start--->

    and the

    <---End<---

    into the Metastock, the Formula work!

    Dear Jose what happen?

    George K.
  •  12-11-2005, 18:03 12769 in reply to 12614

    Re: 1st hint

    Hi Jose,
    I send a little contribute from Italy...

    StartOfMonth:=Month()<>Ref(Month(),-1);
    ....
    EndOfMonth:=Month()<>Ref(Month(),1);

    maurice
  •  12-11-2005, 18:58 12770 in reply to 12614

    Re: 1st hint

    Maurice


    Your "EndofMonth" definition prevents any indicator that it's used with from plotting on the last bar of a chart.


    Roy
    MetaStock Tips & Tools
  •  12-11-2005, 23:00 12772 in reply to 12614

    Re: 1st hint

    Wabbit, I'm hoping no one is crazy enough to buy any stock that trades for only one month each year. :)

    I've thought about using the calendar indicator to do this properly, but I'm trying to keep this competition as simple as possible.


    wabbit:
    What if the monthly hi/lo is reached several times in that month? Does the indicator have to show only one hi/lo per month, or on every occassion it is attained?

    Only two signals per month, one for the High, one for the Low. Obviously this can only be done in retrospect.

    BTW, you're expected to do well in this competition, Wabbit. ;)


    jose '-)
    MetaStockTools.com
  •  12-11-2005, 23:23 12774 in reply to 12614

    Re: 1st hint

    johnl:
    I can get the previous months high/low plotted, three lines of code each,
    but can't get it to one signal in the correct month...ummmm..

    Don't give too much away to the competition, John. ;)



    kanellop:
    When try to put the Creation of Mr Rodney Platt into my Metastock 9.1 Pro for E-Signal, didn't work correctly.
    Dear Jose what happen?

    I don't know, George - that indicator plots signals (in its own window!) just fine here, although a bit slow.
    Maybe the Highs & Lows in your charts are missing??? :eek:



    jose '-)
    MetaStockTools.com
  •  12-12-2005, 0:51 12778 in reply to 12614

    Re: 1st hint

    After the dust settles you may want to discuss the pros and cons of "lastvalue", Jose.
    Isn't it cheating as far as a indicator is concerned?
    I like these diversions since they head me off in directions I am not used to.
    For instance.. plot the indicator below..


    mth1:=If((Month()=Ref(Month(),-1)+1) OR
    (Ref(Month(),-1)-Month()=11),1,0);
    mth2:=Cum(mth1);

    H1 :=HighestSince(1,mth1=1,H);
    H2 := If((Ref(Month(),-1)<Month()) OR
    (Ref(Month(),-1)-Month()=11),Ref(H1,-1),0);
    H3 :=HighestSince(1,(H2<>0),H2);

    H4 :=(BarsSince(H1>H3));
    H4

    when the indicator comes off zero, it looks like a pretty good "sell"...
    ....will have to investigate, and also plotting the indicator in my last post gives
    you a "poor man's" bollinger band.
    HeHeHe.
  •  12-12-2005, 1:09 12780 in reply to 12614

    hindsight can be useful

    johnl:
    After the dust settles you may want to discuss the pros and cons of "lastvalue", Jose.

    Hindsight-based functions such as LastValue/ZigZag/Peak/Trough have their place in the scheme of things as visual tools, but should not be used to generate backtesting/trading signals, as these will shift.

    Hindsight is an important component of learning from past experience.

    The "Month's High & Low signals" in this competition is also a visual tool - it facilitates the spotting of month's Highs & Lows, but cannot be used for backtesting because the last signals are always (except on the last day of month) dynamic - i.e., they shift as a new high/low appears.


    jose '-)
    MetaStockTools.com
  •  12-12-2005, 1:39 12781 in reply to 12614

    Re: hindsight can be useful

    Hi Jose,

    I want to take a stab at the formula.After 2 days and several beers I came up with:
    [NUMONTH:= Month()<>Ref(Month(),-1);
    NUMONTH;
    HighestSince(1 ,NUMONTH ,H );
    LowestSince(1,NUMONTH,L);]

    I think this does the job.
    Thanks Ralph.
  •  12-12-2005, 3:02 12783 in reply to 12614

    more beer needed

    I think you'll need some more beer, Sportrider - your code doesn't plot any High/Low signals (only one of each allowed per month) as shown in this sample chart.


    jose '-)
    MetaStockTools.com
  •  12-12-2005, 3:52 12785 in reply to 12614

    Re:

    Jose:
    Wabbit, I'm hoping no one is crazy enough to buy any stock that trades for only one month each year. :)


    Bullet-proof is bullet-proof.

    Jose:
    BTW, you're expected to do well in this competition, Wabbit. ;)


    You get me the time... I'll get you the code!


    69 days to go.


    wabbit :

    "The question of whether a computer can think is no more interesting than the question of whether a submarine can swim."
    Edsgar W. Dijkstra

     

    MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC C, 11 PRO w/QC & MDK
    For custom MetaStock programming : http://www.wabbit.com.au
    My SkyPE status :
    My SkyPE account : wabbit.com.au

  •  12-12-2005, 8:19 12787 in reply to 12614

    Re: Re:

    When i put into my Metastock 9.1 Pro for E-Signal in the Indicator Builder to a New Formula Creation the:

    --->Start--->
    Days:=Cum(1);
    DaysLoaded:=LastValue(Days);
    DaysRemaining:=DaysLoaded-Days;

    StartOfMonth:=(Month()>Ref(Month(),-1))
    OR (Month()=1 AND Ref(Month(),-1)=12);

    Months:=Cum(StartOfMonth);
    MonthsLoaded:=LastValue(Months);
    MonThsRemaining:=MonthsLoaded-Months;

    EndOfMonth:=(Month()<Ref(Month(),1))
    OR (Month()=12 AND Ref(Month(),1)=1);

    HighDaysAgo:=If(EndOfMonth,HighestSinceBars(1,StartOfMonth,HIGH),0);
    LastHigh:=LastValue(HighestSinceBars(1,StartOfMonth,HIGH));
    LowDaysAgo:=If(EndOfMonth,LowestSinceBars(1,StartOfMonth,LOW),0);
    LastLow:=LastValue(LowestSinceBars(1,StartOfMonth,LOW));

    DaysPassed:=BarsSince(StartOfMonth);
    LastDay:=LastValue(DaysPassed);

    DaysLeftInMonth:=If(MonthsRemaining>0,
    LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
    Endofmonth,DaysPassed)),LastDay)-DaysPassed;
    currenthigh:=If(MonthsRemaining>0,
    LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
    EndOfMonth,HighDaysAgo)),LastHigh);
    currentLow:=If(MonthsRemaining>0,
    LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
    EndOfMonth,LowDaysAgo)),LastLow);

    HighDay:=If(DaysLeftInMonth=Currenthigh,1,0);
    LowDay:=If(DaysLeftInMonth=CurrentLow,-1,0);

    HighDay;
    LowDay;
    <---End<---

    I received the Message: This constant is being used incorrectly

    But when put the above Formula in the same Field without the

    --->Start--->

    and

    <---End<---

    meaning:

    Days:=Cum(1);
    DaysLoaded:=LastValue(Days);
    DaysRemaining:=DaysLoaded-Days;

    StartOfMonth:=(Month()>Ref(Month(),-1))
    OR (Month()=1 AND Ref(Month(),-1)=12);

    Months:=Cum(StartOfMonth);
    MonthsLoaded:=LastValue(Months);
    MonThsRemaining:=MonthsLoaded-Months;

    EndOfMonth:=(Month()<Ref(Month(),1))
    OR (Month()=12 AND Ref(Month(),1)=1);

    HighDaysAgo:=If(EndOfMonth,HighestSinceBars(1,StartOfMonth,HIGH),0);
    LastHigh:=LastValue(HighestSinceBars(1,StartOfMonth,HIGH));
    LowDaysAgo:=If(EndOfMonth,LowestSinceBars(1,StartOfMonth,LOW),0);
    LastLow:=LastValue(LowestSinceBars(1,StartOfMonth,LOW));

    DaysPassed:=BarsSince(StartOfMonth);
    LastDay:=LastValue(DaysPassed);

    DaysLeftInMonth:=If(MonthsRemaining>0,
    LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
    Endofmonth,DaysPassed)),LastDay)-DaysPassed;
    currenthigh:=If(MonthsRemaining>0,
    LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
    EndOfMonth,HighDaysAgo)),LastHigh);
    currentLow:=If(MonthsRemaining>0,
    LastValue(ValueWhen(LastValue(MonthsRemaining+PREV-PREV),
    EndOfMonth,LowDaysAgo)),LastLow);

    HighDay:=If(DaysLeftInMonth=Currenthigh,1,0);
    LowDay:=If(DaysLeftInMonth=CurrentLow,-1,0);

    HighDay;
    LowDay;

    work well.

    Do you have opinion for that?

    George K.
  •  12-12-2005, 12:39 12791 in reply to 12614

    Re: Re:

    kanellop:
    But when put the above Formula in the same Field without the
    --->Start--->
    and
    <---End<---
    work well.

    Do you have opinion for that?


    Yes, George, I do.

    "--->Start--->" and "<---End<---" are not valid MetaStock code lines. I'm glad that you have worked it out.


    jose '-)
    MetaStockTools.com
  •  12-12-2005, 13:30 12793 in reply to 12614

    MESSAGE.

    Dear Jose,

    I received your Message.

    I appreciate your answer.

    Now, i understand!

    The Formula is Valid without the

    --->Start--->

    and

    <---End<---

    George K.
Page 1 of 3 (53 items)   1 2 3 Next >
View as RSS news feed in XML