in Search

UPDATED LATCH AND RANDOM FUNCTIONS COMPLETE [RESOLVED]

Last post 02-26-2007, 3:46 by wabbit. 15 replies.
Sort Posts: Previous Next
  •  04-12-2006, 0:33 16370

    UPDATED LATCH AND RANDOM FUNCTIONS COMPLETE [RESOLVED]

    Hi all,

    Taking a quick break from my study (again!)...

    I have been re-thinking the logic of the latch. Although I think Patrick did an awesome job to get this function out as quickly as he did, and I like his code; I think the logic needs a little tweaking. To this end I have created a logic map for the function, and posted it on my ISP at http://members.iinet.net.au/~wabbit/ms/Latch Return Table.xls

    The table is also below for you to peruse....

    What I need from y'all is to complete the logic of the table! i.e. define what value the latch returns in different scenarios of LE,LX,SE,LX given the previous value of the latch.

    Now the previous bar has FOUR values:
    NA if the 1st bar on the chart (yesterday didnt exist!),
    0, there was no trade open
    1 a long trade was open
    -1 a short trade was open

    The LE and SE each have two values:
    0 do nothing
    1 open a trade in the direction

    The LX and SX each have two values:
    0 do nothing
    1 conclude the trade in the direction

    The LATCH itself returns one of three values:
    0, no trade
    1, long
    -1 short


    You can see using the table below I have 64 permutations to consider. I have made my first stab at the logic, but I got to thinking this is how I (a risk adverse investor) would use the latch (and I never short!) How would a trader use the latch? If a trader was long and received a SE signal, what do they do? etc etc Can yuo see these questions now?

    Please look at the table below, or download it from the link given previously, make any changes you think pertinent, explain whatever you like and get it back to me, via email, snail mail, carrier pigeon or forum post and I will consolidate the returns for final approval before amending the .dll file.


    (Boy this is a long post!)

    [LOGIC TABLE REMOVED - it wasn't right anyway!]

    If something doesnt make sense, its becuase I am crazy!


    wabbit :D

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

  •  04-12-2006, 2:38 16372 in reply to 16370

    Re: UPDATED LATCH AND RANDOM FUNCTIONS COMPLETE [RESOLVED]

    Having procrastinated about studies a little longer I have methematically solved the logic table with the exception of the following circumstances:


    Previous LE LX SE SX Latch
    1 0 0 1 0 ????
    1 1 1 1 0 ????
    -1 1 0 0 0 ????
    -1 1 0 1 1 ????
    NA 1 0 1 0 ????
    0 1 0 1 0 ????
    1 1 0 1 0 ????
    -1 1 0 1 0 ????



    Any traders want to gove some advice here?

    PLEASE.


    wabbit :D

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

  •  04-12-2006, 9:36 16379 in reply to 16370

    UPDATED LATCH AND RANDOM FUNCTIONS COMPLETE - TESTERS REQ

    DONE!


    Truth table:
    Prev SE SX LE LX (SE-SX) (LE-LX) i_S LATCH
    NA 0 1 0 1 -1 -1 -2 0
    0 0 1 0 1 -1 -1 -2 0
    1 0 1 0 1 -1 -1 -2 0
    -1 0 1 0 1 -1 -1 -2 0
    NA 0 1 0 0 -1 0 -1 0
    NA 0 1 1 1 -1 0 -1 0
    NA 0 0 0 1 0 -1 -1 0
    NA 1 1 0 1 0 -1 -1 0
    0 0 1 0 0 -1 0 -1 0
    0 0 1 1 1 -1 0 -1 0
    0 0 0 0 1 0 -1 -1 0
    0 1 1 0 1 0 -1 -1 0
    1 0 1 0 0 -1 0 -1 1
    1 0 1 1 1 -1 0 -1 0
    1 0 0 0 1 0 -1 -1 0
    1 1 1 0 1 0 -1 -1 0
    -1 0 1 0 0 -1 0 -1 0
    -1 0 1 1 1 -1 0 -1 0
    -1 1 1 0 1 0 -1 -1 0
    -1 0 0 0 1 0 -1 -1 -1
    NA 1 0 0 1 1 -1 0 -1
    0 1 0 0 1 1 -1 0 -1
    1 1 0 0 1 1 -1 0 -1
    -1 1 0 0 1 1 -1 0 -1
    NA 0 1 1 0 -1 1 0 1
    0 0 1 1 0 -1 1 0 1
    1 0 1 1 0 -1 1 0 1
    -1 0 1 1 0 -1 1 0 1
    NA 0 0 0 0 0 0 0 0
    NA 1 1 0 0 0 0 0 0
    NA 0 0 1 1 0 0 0 0
    NA 1 1 1 1 0 0 0 0
    0 0 0 0 0 0 0 0 0
    0 1 1 0 0 0 0 0 0
    0 0 0 1 1 0 0 0 0
    0 1 1 1 1 0 0 0 0
    1 0 0 0 0 0 0 0 1
    1 1 1 0 0 0 0 0 1
    1 0 0 1 1 0 0 0 1
    1 1 1 1 1 0 0 0 1
    -1 0 0 0 0 0 0 0 -1
    -1 1 1 0 0 0 0 0 -1
    -1 0 0 1 1 0 0 0 -1
    -1 1 1 1 1 0 0 0 -1
    NA 0 0 1 0 0 1 1 1
    NA 1 1 1 0 0 1 1 1
    NA 1 0 0 0 1 0 1 -1
    NA 1 0 1 1 1 0 1 -1
    0 0 0 1 0 0 1 1 1
    0 1 1 1 0 0 1 1 1
    0 1 0 0 0 1 0 1 -1
    0 1 0 1 1 1 0 1 -1
    1 0 0 1 0 0 1 1 1
    1 1 1 1 0 0 1 1 1
    1 1 0 0 0 1 0 1 1
    1 1 0 1 1 1 0 1 1
    -1 0 0 1 0 0 1 1 -1
    -1 1 1 1 0 0 1 1 -1
    -1 1 0 0 0 1 0 1 -1
    -1 1 0 1 1 1 0 1 -1
    NA 1 0 1 0 1 1 2 0
    0 1 0 1 0 1 1 2 0
    1 1 0 1 0 1 1 2 1
    -1 1 0 1 0 1 1 2 -1


    also posted at previous link (in first post)


    Anyone game enough to try it out !!!! COME ON!!! Let me know how you go?


    Download the new dll file, [FILE REMOVED - - see below]


    wabbit :D

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

  •  04-12-2006, 12:02 16382 in reply to 16370

    crash test dummies

    hey wabbit.... running it through the mill now..... will let ya how she turns out...... thanks. .....h
  •  04-12-2006, 16:38 16387 in reply to 16370

    Re: crash test dummies

    I'll check it out too... won't be until tomorrow though. Thanks for keeping it all alive. DOn't forget that Patrick has a revision near ready now... he says it'll be his last, but I don't know... hmm...
    Traders' Consortium
  •  04-13-2006, 16:14 16435 in reply to 16370

    latch

    hey wabbit.... ran the latch through the mill, no problems of any type seen...... downloaded your newest dll, will look at the ma tonite..... and will holler back.... thanks.....h
  •  04-13-2006, 20:24 16439 in reply to 16370

    Re: latch

    I agree with H... looks like it performs in accordance with your logic table. Good job!
    Traders' Consortium
  •  04-14-2006, 2:21 16445 in reply to 16370

    Latch function of FORUM Dll and your Dll

    Wabbit,

    Are there any differences to expect in the working of Latch function of FORUM Dll and your Dll? Or we should test for similarity between the two?

    Regards

    SMG
  •  04-14-2006, 3:03 16449 in reply to 16370

    Re: Latch function of FORUM Dll and your Dll

    There are a lot of differences....

    If you plot something like:

    {Latch tests based on prime numbers}
    LE:=Mod(Cum(1),7)=0;
    LX:=Mod(Cum(1),13)=0;
    SE:=Mod(Cum(1),17)=0;
    SX:=Mod(Cum(1),23)=0;

    2*ExtFml("ForumDll.Latch",LE,LX,SE,SX);
    ExtFml("myDll.Latch",LE,LX,SE,SX);


    You will see the differences.

    The Forum Latch is scaled to -2, 2 to be discernable from myLatch -1,1


    wabbit :D

    P.S. I suppose I could build the ForumDll truth table to be able to demonstrate the differences too.... I think I will. Standby a little later for this!

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

  •  04-14-2006, 7:15 16453 in reply to 16370

    Re: Latch function of FORUM Dll and your Dll

    Here is the comparison Truth Table between the ForumDll.Latch and myDll.Latch to show where the two are different.


    Prev SE SX LE LX Forum myLatch
    NA 1 0 0 1 0 -1
    NA 0 1 1 0 0 1
    NA 1 0 0 0 0 -1
    NA 1 0 1 1 0 -1
    NA 0 0 1 0 0 1
    NA 1 1 1 0 0 1
    0 1 0 0 1 0 -1
    0 0 1 1 0 0 1
    0 1 0 0 0 0 -1
    0 1 0 1 1 0 -1
    0 0 0 1 0 0 1
    0 1 1 1 0 0 1
    1 1 1 0 1 -1 0
    1 0 1 1 1 1 0
    1 1 1 0 0 -1 1
    1 1 0 0 0 -1 1
    -1 1 1 0 1 -1 0
    -1 0 1 1 1 1 0
    -1 0 0 1 1 1 -1
    -1 1 1 1 1 1 -1
    -1 1 0 1 1 1 -1
    -1 0 0 1 0 1 -1
    -1 1 1 1 0 1 -1
    -1 1 0 1 0 1 -1


    As this is just code that derives these values, it is possible to code ANY scenario, you just have to be able to create a table like these one that demonstrate what values you want the function to return in EVERY possible permutation.

    Hope this helps.


    wabbit :D

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

  •  04-14-2006, 11:38 16464 in reply to 16370

    Test Results

    Wabbit,

    I created four Indicators:

    {Wabbit LE}
    LE:=Mod(Cum(1),7)=0;
    LE;

    {Wabbit LX}
    LX:=Mod(Cum(1),13)=0;
    LX;

    {Wabbit SE}
    SE:=Mod(Cum(1),17)=0;
    SE;

    {Wabbit SX}
    SX:=Mod(Cum(1),23)=0;
    SE;

    and plotted these indicators in two separate inner windows along with your Latch Function and Classic Latch function. The inference that I get from the chart seems to be that while the Classic Latch will exit a Long position on a Short Entry Signal even if a Long Exit Signal NOT been triggerred in between. Your Latch function will exit a long position ONLY if a Long Exit Signal has triggerred - reverse for Short positions.

    So it seems that we have to be a little more cautious while we use any of the Latch functions and be aware how they are working internally.

    Wabbit, am I right here? Thanks for taking us on the internal tour of the latch function.

    Regards

    SMG
  •  04-14-2006, 11:48 16467 in reply to 16370

    Re:

    smg:
    The inference that I get from the chart seems to be that while the Classic Latch will exit a Long position on a Short Entry Signal even if a Long Exit Signal NOT been triggerred in between. Your Latch function will exit a long position ONLY if a Long Exit Signal has triggerred - reverse for Short positions.


    wabbit:


    Prev SE SX LE LX Forum myLatch
    1 1 1 0 1 -1 0
    1 0 1 1 1 1 0
    1 1 1 0 0 -1 1
    1 1 0 0 0 -1 1



    These are the tables of the DIFFERENCES between the two latches, if already in a LONG trade.....

    Reading from the top of the table:
    if SE=1 and SX=1 and LE=0 and LX=1, the forum latch will enter the short trade, myDll latch will exit the long
    if SE=0 and SX=1 and LE=1 and LX=1, the forum latch will enter a long trade, myDll latch will exit the long
    if SE=1 and SX=1 and LE=0 and LX=0, the forum latch will enter the short trade, myDll latch will stay in the long trade
    if SE=1 and SX=0 and LE=0 and LX=0, the forum latch will enter the short trade, myDll latch will stay in the long trade


    Hope that clears it up for you.

    wabbit :D

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

  •  04-17-2006, 2:55 16564 in reply to 16370

    Re: Re:

    ... on second thoughts, if you want a copy of the dll as a TESTER then please PM me....


    wabbit :D

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

  •  04-20-2006, 11:24 16644 in reply to 16370

    file?

    Where to download the file?

    -PLAS
    A Swaminathan
    aswaminathan_a@yahoo.co.uk
  •  04-20-2006, 12:44 16647 in reply to 16370

    wabbits dll

    hey plas..... wabbit pulled it from the open market..... drop him a pm for it now....

    noticed your earlier post.... i don't have 9.2 or the mdk so theres no way for me to check.... just shootin from the hip here, if the two are not compatiable it should be a easy fix....

    as long as the dll was reinstalled, can't imagine much more than a version name issue and hard to imagine that..... wabbit would know best.....h
  •  02-26-2007, 3:46 23114 in reply to 16647

    Re: wabbits dll

    For anybody that is using the revised Latch in the Forum.dll please be aware there is a logic aberration that is listed in the truth table (above).  I will let you figure out where the aberration lies.  (If anyone wants to re-map the logic table, you will easily see where the instance occurs.)  Please note: it is not an error nor a bug, it is an irregularity.

    I will not change the free-ware version as no-one has complained about it, and the results are exactly as posted in the table above (Although I wrote it, I no longer agree with the table.)


    Hope this helps.

    wabbit Big Smile [:D]



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

View as RSS news feed in XML