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

[EquisMetaStock Group] Re: Need codes for finding the trough of an oscillator



PureBytes Links

Trading Reference Links

Alm, you could try adding some user inputs to your indicator, and 
simplifying some of the code with the Sum() MS function:

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

{ User inputs }
pds:=Input("Osc trough moving downwards last x periods",1,260,5);
pr1:=Input("ROC 1, %",0,100,14);
pr2:=Input("ROC 2, %",0,100,11);
pds1:=Input("WMA periods",1,260,10);

{ Oscillator }
CP:=Mov(ROC(C,pr1,%)+ROC(C,pr2,%),pds1,W);

{ Oscillator currently in negative zone }
CP<0

{ Osc trough }
{ Osc moving upwards on latest bar }
 AND CP>Ref(CP,-1)

{... and moving downwards in last x periods }
 AND Sum(Ref(CP,-1)<Ref(CP,-2),pds)=pds

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


> {and moving downwards last 6 periods}

Note that your original code looks for a downward movement in only
the previous five bars.


jose '-)
http://metastocktools.com



--- In equismetastock@xxxxxxxxxxxxxxx, "awlaimeng" 
<awlaimeng@xxxx> wrote:
>
> I have the following oscillator and would like to know whether
there 
> is a better way of finding the "trough" (valley) when the
> oscillator moves from the negative zone and starts to move upwards.
> 
> 
> {oscillator}
> CP:=Mov(ROC(C,14,%)+ROC(C,11,%),10,W); 
> 
> {oscillator below zero line - in negative zone}
> CP<0 
> 
> {finding the trough}
> {moving upwards on latest period}
> {and moving downwards last 6 periods}
> AND CP>Ref(CP,-1) AND 
> Ref(CP,-1)<Ref(CP,-2) AND
> Ref(CP,-2)<Ref(CP,-3) AND
> Ref(CP,-3)<Ref(CP,-4) AND
> Ref(CP,-4)<Ref(CP,-5) AND
> Ref(CP,-5)<Ref(CP,-6)
> 
> Any comments on the above codes will be much appreciated.
> 
> Thank you and best regards,
> ALM






------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hs4mumt/M=362343.6886682.7839641.1493532/D=groups/S=1705375617:TM/Y=YAHOO/EXP=1124097720/A=2894354/R=0/SIG=11qvf79s7/*http://http://www.globalgiving.com/cb/cidi/c_darfur.html";>Help Sudanese refugees rebuild their lives through GlobalGiving</a>.</font>
--------------------------------------------------------------------~-> 

 
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/