PureBytes Links
Trading Reference Links
|
Good to see the experimental creativity flowing, Alex. :)
Below is another example.
This indicator signals the start of a profitable month ahead - very
handy if one knows a broker that allows trading hindsight.
================
Hindsight profit
================
---8<-------------------
{ Signals start of profitable month ahead }
{ Buy on start of profitable month's Open,
Sell on Close of last day of month }
{ Last signal is dynamic - * do NOT trade * }
{ No plot? Re-start MetaStock }
{ http://www.metastocktools.com }
{ User input }
plot:=Input("[1]Profitable Month ahead, [2]Monthly Profit",1,2,1);
{ Start of month }
nuMonth:=Month()<>Ref(Month(),-1);
{ End of month }
endMonth:=PeakBars(1,-Zig(nuMonth-.5,1,$),1)=0
OR nuMonth=0 AND Cum(1)=LastValue(Cum(1));
{ Month's % profit }
nuOp:=ValueWhen(1,nuMonth,O);
profit:=ValueWhen(1,endMonth,(C/nuOp-1)*100);
profit:=If(endMonth,profit,0);
{ Signal start of profitable month (!) }
yey:=
PeakBars(1,Zig(nuMonth-(profit>0),1.5,$),1.5)=0;
{ Last dynamic signal }
lastMth:=nuMonth
AND Cum(nuMonth)=LastValue(Cum(nuMonth));
lastProfit:=If(lastMth,
If(LastValue(profit)>0,1,-1),0);
{ Signal start of Bear month (!) }
ney:=nuMonth AND yey<1;
{ Trade signals }
signals:=If(lastMth,lastProfit,yey-ney);
{ Plot in own window }
If(plot=1,signals,profit)
---8<-------------------
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, Alexander Atreides
<alexatreides@xxxx> wrote:
> An XLENT !!! comment from one of the true experts in
> this forum.
>
> Sincere thanks - never much enough. I had never
> thought about this. This may really spark a series of
> "experiments" on MS.
>
> AlexAtreides.
>
> --- Jose <josesilva22@xxxx> wrote:
>
> MetaStock generally reads and processes data from left to right.
>
> MS signals are plotted sequentially in this West-East direction, and
> once any data is plotted on a chart, there is no way to coerce
> MetaStock to go back and erase past signals.
>
> Or is there...?
>
> By nesting a couple of hindsight functions such as
> ZigZag() and Peak(), this is now possible.
>
> One of the holy grails of MetaStock coding has been to be able to
> modify past signals, such as (for pattern-recognition purposes):
> "Plot last Friday only if following Monday's Close is up".
>
> Here is some magic MS code that will do just that:
>
> ---8<-----------------
>
> { Friday signal }
> signal:=DayOfWeek()=5;
>
> { Monday up on Friday's Close }
> confirm:=DayOfWeek()=1 AND C>Ref(C,-1);
>
> { Extend signal & confirmation }
> x:=ValueWhen(1,signal OR confirm,signal-confirm);
>
> { Magic: forget last Friday if Monday is down }
> hindsight:=PeakBars(1,Zig(x,1,$),1)=0;
>
> { Plot in own window }
> hindsight
>
> ---8<-----------------
>
>
> And here is another bit of magic - detecting and plotting true
> end-of-week signals:
>
> ==========
> Week's end
> ==========
> ---8<---------------------
>
> { Signals true end of week:
> confirms signal at start of following week,
> and signals end of week in retrospect }
> { http://www.metastocktools.com }
>
> day:=DayOfWeek();
> WeekStart:=day<Ref(day,-1);
> WeekEnd:=PeakBars(1,-Zig(WeekStart-.5,1,$),1)=0;
>
> WeekEnd
>
> ---8<---------------------
>
>
> jose '-)
> http://www.metastocktools.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/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/
|