in Search

How to format your formula-containing posts

Last post 08-15-2006, 11:35 by jjstein. 25 replies.
Page 1 of 2 (26 items)   1 2 Next >
Sort Posts: Previous Next
  •  08-01-2006, 12:28 19715

    How to format your formula-containing posts

    I used the bold and underline buttons to format "Code:".
    Or you can do <b><u>Code:</u></b> in html mode (that tab is at the bottom of the "Post a New Message" or edit windows).

    I then used the indent right button on the toolbar to format the code.

    However, in html mode, much better formatting is possible, see the example below.

    Code:
    Max(H, Ref(C,-1));
    Min(H, Ref(C,-1));

    Second example done in HTML mode; however, average user won't be able to do this well.


    Code:
    Max(H, Ref(C,-1));
    Max(H, Ref(C,-1));



     The following example was done in HTML mode too, using the following markup:

    <BLOCKQUOTE>

    <DIV><STRONG>Code:</STRONG></DIV>
    <DIV>Insert your code here </DIV>

    </BLOCKQUOTE>

     

    Code:
    Insert your code here
  •  08-02-2006, 7:12 19754 in reply to 19715

    [|-)] [|-)] Re: How to format your formula-containing posts

    MetaStock code operators (<>) are likely to be messed up by HTML code. And it would be nice to be able to post without needing to be a HTML programmer...

    Is there any simple solution other than using HTML tags, such as "code buttons" or the old code tags?

    And how about giving the "all posts read" function some priority? Without this working properly, most new posts will be lost/skipped in the 3,785 existing posts.

    And, is there any way to remove the silly beer/idea buttons from the post signature below?


    jose '-)
    MetaStockTools.com
  •  08-02-2006, 8:17 19757 in reply to 19754

    Re: How to format your formula-containing posts

    Jose,

    You can use HTML and/or bbCode in your signature...

    and you can still use the bbCode "code" function to post your code...

    {test}
    x:=1;
    y:=2;
    z:=x+y;
    z;




    [edit]
    and if you put it inside the bbCode "quote" block it should look reasonable?

    {test}
    x:=1;
    y:=2;
    z:=x+y;
    z;


    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

  •  08-02-2006, 8:23 19759 in reply to 19757

    Re: How to format your formula-containing posts

    Wabbit, I do use bbCode in my signature, but I've got no idea where the "beer" & "idea" buttons came from.


    Code test:

    x:=1;
    y:=2;
    x&lt;&gt;y

    Nope, greater-than & less-than MetaStock operators don't work within bbCode "code" tags.


    jose '-)
    MetaStockTools.com
  •  08-02-2006, 8:30 19761 in reply to 19759

    Re: How to format your formula-containing posts

    try vanilla HTML in your signature...

    ... and I see what you mean about the gt and lt ....  d'oh :(

    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

  •  08-02-2006, 10:23 19776 in reply to 19754

    Re: How to format your formula-containing posts

    Jose:
    Is there any simple solution other than using HTML tags, such as "code buttons" or the old code tags?

    It seems to be an obvious oversight, but there is no CODE tag in CS.  It is NOT BBcode compliant (and I'm told they don't want it to be.)  I knew this would be an issue, and it isn't surprising that you are the first to raise it, so I saved this beta-forum thread to let you know what I know.  IMO, right now the easiest solution will be to post all formulas as plain text between your familiar start and stop tags.  For example:

    ---8<---------------------------

    { Nightcrawler sleep cycles and the price of gold }
    { ©Copyright 2006 Jose Silva }
    { http://www.metastocktools.com }

    pds:=Input("Sleep time",1,50,21);
    .
    .
    .

    ---8<---------------------------

    Jose:
    And how about giving the "all posts read" function some priority?

    See related post in this forum.  Bottom line, we are waiting on Telligent to add this to the CS feature list.  Perhaps v3.0?? I understand it won't be v2.1 or v2.2.

    Jose:
    And, is there any way to remove the silly beer/idea buttons from the post signature

    I saw that last night and thought you had too much beer to drink when you updated your profile! Tongue Tied [:S]  Now, after reading this, I think we'll chalk it up to another migration glitch.  Easy fix.

    Thanks so much for this useful feedback.  Please keep it coming.  Even if I can't get it changed or fixed or whatever, I can hound people pretty good.  Of course, you already know that! Wink [;)]


    Traders' Consortium
  •  08-02-2006, 19:08 19814 in reply to 19776

    Re: How to format your formula-containing posts

    Thanks G - your patience is a real virtue. :)

    StorkBite:
    IMO, right now the easiest solution will be to post all formulas as plain text between your familiar start and stop tags.  For example:


    ---8

    { Nightcrawler sleep cycles and the price of gold }
    { ©Copyright 2006 Jose Silva }
    { http://www.metastocktools.com }

    pds:=Input("Sleep time",1,50,21);
    .
    .
    .


    ---8



    This is a real problem - without HTML tags, "<>" code operators just don't post:

    ---8
    { 5 is less than 6 }

    5
    ---8
    Even the cut-and-paste lines refuse to display.

    Without a simple way to post code reliably, we are dead in the water...


    jose '-)
    MetaStockTools.com
  •  08-02-2006, 21:32 19824 in reply to 19814

    Re: How to format your formula-containing posts

    hey g...... what are yall talking about.... are you having trouble with <>.....h

    ---------------
    6>5
    --------------


    tema

    pds1:=Input("short moving average",1,100,12);

    pds2:=Input("long moving average ",1,200,26);

    pds3:=Input("signal moving average",1,200,9);

    pds4:=Input("tema periods",2,50,14);

    0;

    x:= Tema(C ,pds4 ) ;

    a:=Mov(x ,pds1 ,E )- Mov(x ,pds2 ,E );

    b:=Mov(a,pds3,E);

    d:=If((a-b)>Ref((a-b),-1),a-b,0);
    dd:=If((a-b)<Ref((a-b),-1),a-b,0);

    b;

    d*2;

    dd*2;

    a;

  •  08-02-2006, 21:34 19825 in reply to 19814

    Re: How to format your formula-containing posts

    Jose:
    Without a simple way to post code reliably, we are dead in the water...

    Agreed. Let's try to figure out what'll work, then see if I can get a button made to automate it.

    The following examples were entered as plain text in "Design" mode, not "HTML" mode:

    ---8<---------------------------

    is 5<6?

    is 5<6

    is 5< 6

    is 5 <6

    is 5 < 6

    is 5 < 6 < 7

    is 5<6 or 6>5

    ---8<---------------------------

    The following examples were entered as plain text in "Design" mode, not "HTML" mode.  Next, I highlighted all of the text and hit the Indent Button from the toolbar.  It surrounded the text with the frame.

    ---8<---------------------------

    is 5<6?

    is 5<6

    is 5< 6

    is 5 <6

    is 5 < 6

    is 5 < 6 < 7

    is 5<6 or 6>5

    ---8<---------------------------

     


    Traders' Consortium
  •  08-02-2006, 21:50 19827 in reply to 19825

    Re: How to format your formula-containing posts

    yall must be doing something different than me.... can't see the issue....h



     
     
    MetaStock -> Tools -> Indicator Builder -> New
    Copy and paste formula below.
    
    
    ===================
    EMA, cycle-adaptive
    ===================
    ---8<---------------------------
    
    { Cycle-adaptive Exponential Moving Avg v1.1 }
    { EMA periodicity determined by historical
      price cycle based on ZigZag cycles }
    { ©Copyright 2004 Jose Silva }
    { http://www.metastocktools.com }
    
    pr:=Input("ZigZag cycle reversal %",0,100,5);
    choose:=Input("EMA periods based on:  [1]Cycle,  [2]Cycle Avg",1,2,1);
    multi:=Input("EMA periodicity:  Cycle/Avg length x",.1,100,2);
    x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,6);
    shift:=1+Input("EMA vertical shift %",
     -100,100,0)/100;
    plot:=Input("[1]EMA [2]Signals [3]Cycle [4]CyAvg [5]CyStdDev",1,6,1);
    
    x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
    zz:=Zig(x,pr,%);
    zzpk:=Ref(zz,-1)>zz AND Ref(zz,-1)>Ref(zz,-2);
    zztr:=Ref(zz,-1)<zz AND Ref(zz,-1)<Ref(zz,-2);
    PkTr:=zzpk OR zztr;
    CycleLen:=PkTr*(Ref(BarsSince(PkTr),-1)+1);
    CycleCount:=Cum(PkTr)-1;
    CycleCount:=If(CycleCount=0,.000001,CycleCount);
    CycleLenAvg:=Cum(CycleLen)/CycleCount;
    
    pds:=If(choose=1,ValueWhen(1,CycleLen>0
     AND CycleCount>0,CycleLen),CycleLenAvg)*multi;
    Init:=CycleCount=1 AND Alert(CycleCount<1,2);
    pds:=
     If(pds>BarsSince(Init),BarsSince(Init),pds);
    pds:=If(pds<1,1,pds);
    Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
    Ema:=Ema*shift;
    signals:=Cross(x,Ema)-Cross(Ema,x);
    
    If(plot=1,Ema,If(plot=2,signals,
     If(plot=3,CycleLen,
     If(plot=4,CycleLenAvg,
     If(plot=5,Stdev(CycleLen,21),pds)))))
    
    ---8<---------------------------
    
    
    http://www.metastocktools.com
    
    
  •  08-02-2006, 22:21 19832 in reply to 19827

    Re: How to format your formula-containing posts

    I think we are looking at the problem of not having a feature comparable to the bbcode CODE tags.  It seems like plain text is all that we have (for the moment).  I want to get this resolved 100% to Jose's satisfaction.  Whatever we need to do, I'll find the person to help make it happen.
    Traders' Consortium
  •  08-03-2006, 0:09 19836 in reply to 19832

    Re: How to format your formula-containing posts

    Thanks G.

    Test:

    { x greater than y }

    x>y

    { x less than y }

    x

    Damn... the "less than y" is not posting - the board thinks it's part of an incomplete HTML tag. How can I switch HTML posting off? Will this stop posting links?

    Could this be because I'm posting from a Win98 machine? If so, I'll try again with XP later.


    jose '-)
    MetaStockTools.com
  •  08-03-2006, 10:33 19849 in reply to 19836

    Re: How to format your formula-containing posts

    x<y

    x< y

    x <y

    X<Y

    X< Y

    X <Y

    I will look into your HTML question.  I think we might be able to mod the forum and accomplish that request.


    Traders' Consortium
  •  08-04-2006, 2:19 19886 in reply to 19849

    Re: How to format your formula-containing posts

    This is not a solution, but an explanation.  Using the RichText Editor is problematic for Opera users.  The only current alternatives are 1) don't use Opera, or 2) use HTML formatting.  I purposely left off option 3.

    Are you using Opera? If so, then that is why you are not seeing the more feature filled post editor. Most Rich Text / WYSIWYG editors do not work with Opera because Opera does not support a built-in HTML editing library like IE and FireFox/Mozilla do.

    The defeault editor in CS is FreeTextBox which renders a plain small box in Opera. A plain textbox editor (where you enter any HTML you want to use manually) is also included. You will probably want to change your editor to that.

    1. Edit your profile by clicking on your username in the top-right of the screen.

    2. Click on the SiteOptions tab.

    3. Change the Content editor dropdown value from Rich Editor to DefaultTextEditor (which is the plain textbox).

    4. Click the Save Changes button.


    Traders' Consortium
  •  08-04-2006, 11:36 19897 in reply to 19886

    For what it's worth...

    TinyMCE, has been introduced in CS 2.1 beta.  It looks awesome and appears to be customizable too. Perhaps this Content Editor upgrade will be what the doctor ordered?

    Can any of you Opera users verify that javascript will work better for you than rich content?

    http://tinymce.moxiecode.com/example_full.php?example=true


    Traders' Consortium
  •  08-04-2006, 17:16 19910 in reply to 19897

    Opera news

    Update:

    Actually I have good news in the Opera department!

    CS 1.x and 2.0 were shipped with FreeTextBox as the default rich text editor and it did not work (or work well) with Opera and some other less widely used browsers.

    CS 2.1 will have an all new default editor named TinyMCE which is lighter weight and works in more browsers, including Opera 9!  In fact I am writing this post in Opera 9.01 and the post editor works great. The only caveat is that older versions of Opera will need to be upgraded to 9.0x to use the editor.


    Traders' Consortium
  •  08-09-2006, 0:49 20142 in reply to 19910

    Another small step

    We've been trying to come up with an alternative solution to simulate the old code tags.  What we've come up with is this: Surround your code in these tags (no brackets and no spaces) 

     * code *

    Insert code here...

     * /code *

    Should look like this:

    Code:

    ---8<---------------------------

    { Cycle-adaptive Exponential Moving Avg v1.1 }
    { EMA periodicity determined by historical
      price cycle based on ZigZag cycles }
    { ©Copyright 2004 Jose Silva }
    { http://www.metastocktools.com }

    pr:=Input("ZigZag cycle reversal %",0,100,5);
    choose:=Input("EMA periods based on:  [1]Cycle,  [2]Cycle Avg",1,2,1);
    multi:=Input("EMA periodicity:  Cycle/Avg length x",.1,100,2);
    x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 P=6",1,6,6);
    shift:=1+Input("EMA vertical shift %",
    -100,100,0)/100;
    plot:=Input("[1]EMA [2]Signals [3]Cycle [4]CyAvg [5]CyStdDev",1,6,1);

    x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,P,C)))));
    zz:=Zig(x,pr,%);
    zzpk:=Ref(zz,-1)>zz AND Ref(zz,-1)>Ref(zz,-2);
    zztr:=Ref(zz,-1)<zz AND Ref(zz,-1)<Ref(zz,-2);
    PkTr:=zzpk OR zztr;
    CycleLen:=PkTr*(Ref(BarsSince(PkTr),-1)+1);
    CycleCount:=Cum(PkTr)-1;
    CycleCount:=If(CycleCount=0,.000001,CycleCount);
    CycleLenAvg:=Cum(CycleLen)/CycleCount;

    pds:=If(choose=1,ValueWhen(1,CycleLen>0
    AND CycleCount>0,CycleLen),CycleLenAvg)*multi;
    Init:=CycleCount=1 AND Alert(CycleCount<1,2);
    pds:=
    If(pds>BarsSince(Init),BarsSince(Init),pds);
    pds:=If(pds<1,1,pds);
    Ema:=x*2/(pds+1)+PREV*(1-2/(pds+1));
    Ema:=Ema*shift;
    signals:=Cross(x,Ema)-Cross(Ema,x);

    If(plot=1,Ema,If(plot=2,signals,
    If(plot=3,CycleLen,
    If(plot=4,CycleLenAvg,
    If(plot=5,Stdev(CycleLen,21),pds)))))

    ---8<---------------------------

    Note: this does not show the custom format in the Preview Window.  Just post it and it'll show up.


    Traders' Consortium
  •  08-09-2006, 4:47 20144 in reply to 20142

    Re: Another small step

    Test for posting code with Opera browser v9.01:

    Code:

    ===========================
    Holy Grail MkIV Long system
    ===========================
    ---8
    { Holy Grail Long MkIV system signals v7.5 }
    { Warning: Xperimental only - *Do Not Trade!* }

    { Ignore all signals without matching
    MkIV Money Management module!
    Enter Long = +1 (Close)
    Exit Long = -1 (Close)
    For JSE markets only.}

    { ©Copyright 2005 Jose Silva }
    { http://www.metastocktools.com }

    pds:=Input("Avg trade frequency",2,500,21);
    pdsN:=Input("Fibonator normalizing periods (1=none)",1,260,1);
    vFilter:=Input("Inactivity filter? [1]Yes, [0]No",0,1,1);
    delay:=Input("Entry and Exit delay",0,5,0);
    plot:=Input("[1]Signals, [2]Trade binary",1,2,1);

    vFilter:=If(vFilter=1,HHV(C,pds)>LLV(C,pds)*1.05,1);
    FibSeriesSum:=1+1/1+1/2+1/3+1/5+1/8+1/13+1/21+1/34+1/55+1/89+1/144+1/233+1/377+1/610;
    FibSeriesSumVal:=Frac(FibSeriesSum+LastValue(DPO(pds)+PREV-PREV)-FibSeriesSum);
    FibSeriesSumValNorm:=(FibSeriesSumVal-LLV(FibSeriesSumVal,pds))/(HHV(FibSeriesSumVal,pds)-LLV(FibSeriesSumVal,pds)+.000001)*100;
    avg:=Cum(FibSeriesSumValNorm)/Cum(IsDefined(FibSeriesSumValNorm));
    pk:=Ref(FibSeriesSumValNorm,-1)=HHV(FibSeriesSumValNorm,3) AND Ref(FibSeriesSumValNorm,-1)>avg;
    pkVal:=ValueWhen(1,pk,Ref(FibSeriesSumValNorm,-1));
    pkAvg:=Cum(pkVal)/Cum(IsDefined(pkVal));
    tr:=Ref(FibSeriesSumValNorm,-1)=LLV(FibSeriesSumValNorm,3) AND Ref(FibSeriesSumValNorm,-1)trVal:=ValueWhen(1,tr,Ref(FibSeriesSumValNorm,-1));
    trAvg:=Cum(trVal)/Cum(IsDefined(trVal));
    entryLong:=Cross(FibSeriesSumValNorm,trAvg) AND vFilter;
    exitLong:=Cross(FibSeriesSumValNorm,pkAvg);
    InitSequence:=Cum(IsDefined(entryLong+exitLong))=1;
    x:=ValueWhen(1,entryLong-exitLong<>0,entryLong-exitLong);
    entryLong:=x=1 AND (Alert(x<>1,2) OR InitSequence);
    exitLong:=x=-1 AND (Alert(x<>-1,2) OR InitSequence);
    binary:=ValueWhen(1,entryLong-exitLong<>0,entryLong-exitLong);

    { Plot in own window }
    Ref(If(plot=1,entryLong-exitLong,binary),-delay)

    ---8



    Code:

    Close



    The code tags seem to work Ok without any spaces between the asterisks. Unfortunately some code inside the code box is still treated as HTML (e.g., less-than operator).


    jose '-)
    MetaStockTools.com
  •  08-09-2006, 10:13 20154 in reply to 20144

    Re: Another small step

    Yes, you have to use * code * and * /code * without the spaces after the *.

    Which line exactly, has the < problem?
  •  08-09-2006, 11:23 20157 in reply to 20154

    Re: Another small step

    To simplify it:

    Code:

    { x is less than y, no space }
    x
    { x is less than y, 1 space }
    x
    { x is less than y, 2 spaces }
    x

    MetaStockTools.com
  •  08-14-2006, 20:06 20297 in reply to 20157

    How to post code?

    I'm trying to post some MS formula code, but it's not displaying right...
    --Johnathan
  •  08-14-2006, 20:14 20302 in reply to 20157

    Re: How to post code?

    Code without equality indicators can just be posted as text...

    otherwise, put your code between * code* and */ code* tags (without any spaces....)

    Code:

    TEST




    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

  •  08-15-2006, 9:19 20325 in reply to 20157

    Re: How to post code?

    What broswer are you using? Are you posting it in Design mode or HTML mode?
    Traders' Consortium
  •  08-15-2006, 11:09 20330 in reply to 20325

    Re: How to post code?

    Using IE 6, WinXP, with all SP's and critical updates. Mode: Whatever the default mode is. Don't know how to post in a specific mode; there doesn't seem to be an option for it. I'll see if a "mode" shows up when I "edit" the post. NOPE, don't see any mode. Tell me where it is, and I'll try it.

    Code:
    Periods:=Input("Periods",10,500,250); buy:=If(Cross(C,Mov(C,Periods,E)),1,0); sell:=If(Cross(Mov(C,Periods,E),C),1,0); init:=Cum(buy+sell>-1)=1; Bull:=BarsSince(Init OR Buy)> BarsSince(Init OR Sell); Bear:=BarsSince(Init OR Buy)< BarsSince(Init OR Sell); If(Bull,-1,If(Bear,1,0));

    OK, I've switch the editor back to "Rich text", let's try again:

    Code:

    Periods:=Input("Periods",10,500,250);
    buy:=If(Cross(C,Mov(C,Periods,E)),1,0);
    sell:=If(Cross(Mov(C,Periods,E),C),1,0);
    init:=Cum(buy+sell>-1)=1;

    Bull:=BarsSince(Init OR Buy)>
          BarsSince(Init OR Sell);
    Bear:=BarsSince(Init OR Buy)<
          BarsSince(Init OR Sell);

    If(Bull,-1,If(Bear,1,0));


    --Johnathan