[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Re: Buy and Hold System Test



PureBytes Links

Trading Reference Links

Pablo, the code just provides an entry signal at the beginning of your 
chart and an exit signal at the end.

Using these signals, one can simulate a Buy & Hold strategy, useful 
for comparison to other strategies.
http://www.metastocktools.com/URSC/sysdev.htm
http://www.metastocktools.com/URSC/sysdev2.htm

Below is a Buy & Hold profit % example, using the basic profit curve 
indicator from MetaStockTools.com:


==============================
Profit Long % Buy & Hold basic
==============================
---8<----------------------------------

{ Buy & Hold Profit Long % curve - v2.2
 
 ©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 }

{* Entry Long on first chart bar *}
entry:=Cum(1)=1;

{* Exit Long on last chart bar *}
exit:=Cum(1)=LastValue(Cum(1));

{ User inputs }
cost:=Input("Total Transaction costs (Brokerage + Slippage) %:",0,100
,.2)/200;
plot:=Input("plot:  [1]%Profit curve,  [2]Trade signals",1,2,1);

{ 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<----------------------------------


jose '-)
http://www.metastocktools.com





--- In equismetastock@xxxxxxxxxxxxxxx, Paolo <italoarg76@xxx> wrote:
>
> Hola José,
>           I really do not understand what is the purpuse of your
> code (of course because I'm a beginner as you know)
> Also, I've no documentation of "Lastvalue()" function :|
> Could you explain me your code, please ? :)
> Saludos,
>         Pablo
> 
>
>
> { Buy & Hold: }
> 
> { 1 for the first record load ELSE 0 }
> Buy:=Cum(1)=1;
> { 1 if it is the LAST record loaded ???}
> Sell:=Cum(1)=LastValue(Cum(1));
> 
> JS> jose '-)
> JS> http://www.metastocktools.com
> 
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "maxwell_holder" 
> <maxwell_holder@> wrote:
>
> Does anyone know a code for a buy and hold system test. 
> 
> Thanks for your help






------------------------ Yahoo! Groups Sponsor --------------------~--> 
You can search right from your browser? It's easy and it's free.  See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/