Seasonal Profit Indicators

  •  06-10-2006, 2:45

    Seasonal Profit Indicators

    MetaStock -> Tools -> Indicator Builder -> New
    -> Copy and paste two formulae below.

    Code:

    ===========================
    Seasonal Profit % - May-Oct
    ===========================
    ---8<------------------------------------------

    { Seasonal Buy & Hold.
    Long: May to Oct.

    System Profit Long % - fixed trade size - v2.2
    Basic code - Entry/Exit on Close of signal.

    ©Copyright 2005~2006 Jose Silva.
    The grant of this license is for personal use
    only - no resale or repackaging allowed.
    All code remains the property of Jose Silva.
    http://www.metastocktools.com }

    { User inputs }
    start:=Input("Start trading at start of Nth month [1-12]",1,12,5);
    end:=Input("End trading at end of Nth month [1-12]",1,12,10);
    cost:=Input("Total Transaction costs (Brokerage + Slippage) %:",0,100,.2)/200;
    plot:=Input("plot: [1]%Profit curve, [2]Trade signals",1,2,1);

    { Trade Long period }
    trade:=((Month()>=start)-(Month()<=end))<>0;
    trade:=If(start>end,trade,1-trade);

    { Entry Long }
    entry:=trade;

    { Exit Long }
    exit:=trade=0;

    { Trade Binary & clean Entry/Exit signals }
    init:=Cum(IsDefined(entry+exit))=1;
    flag:=ValueWhen(1,entry-exit<>0 OR init,entry);
    entry:=flag*(Alert(flag=0,2)
    OR entry*Cum(entry)=1);
    exit:=(flag=0)*(Alert(flag,2)
    OR exit*Cum(exit)=1);

    { Profit % curve }
    EntryVal:=ValueWhen(1,entry,C*(1+cost));
    Profit:=C*(1-cost)/EntryVal-1;
    ProfitPer:=(flag*Profit+Cum(exit*Profit))*100;

    { Plot in own window below chart }
    If(plot=1,ProfitPer,entry-exit)

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



    =============================
    Seasonal Profit % - Nov-April
    =============================
    ---8<------------------------------------------

    { Seasonal Buy & Hold.
    Long: November to April.

    System Profit Long % - fixed trade size - v2.2
    Basic code - Entry/Exit on Close of signal.

    ©Copyright 2005~2006 Jose Silva.
    The grant of this license is for personal use
    only - no resale or repackaging allowed.
    All code remains the property of Jose Silva.
    http://www.metastocktools.com }

    { User inputs }
    start:=Input("Start trading at start of Nth month [1-12]",1,12,11);
    end:=Input("End trading at end of Nth month [1-12]",1,12,4);
    cost:=Input("Total Transaction costs (Brokerage + Slippage) %:",0,100,.2)/200;
    plot:=Input("plot: [1]%Profit curve, [2]Trade signals",1,2,1);

    { Trade Long period }
    trade:=((Month()>=start)-(Month()<=end))<>0;
    trade:=If(start>end,trade,1-trade);

    { Entry Long }
    entry:=trade;

    { Exit Long }
    exit:=trade=0;

    { Trade Binary & clean Entry/Exit signals }
    init:=Cum(IsDefined(entry+exit))=1;
    flag:=ValueWhen(1,entry-exit<>0 OR init,entry);
    entry:=flag*(Alert(flag=0,2)
    OR entry*Cum(entry)=1);
    exit:=(flag=0)*(Alert(flag,2)
    OR exit*Cum(exit)=1);

    { Profit % curve }
    EntryVal:=ValueWhen(1,entry,C*(1+cost));
    Profit:=C*(1-cost)/EntryVal-1;
    ProfitPer:=(flag*Profit+Cum(exit*Profit))*100;

    { Plot in own window below chart }
    If(plot=1,ProfitPer,entry-exit)

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


    MetaStockTools.com
View Complete Thread