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

[amibroker] Solution: Projection Oscillator//Signal does not fire on test?



PureBytes Links

Trading Reference Links

For those old pro's please bear with what is probably an easy 
question from a first timer.

Here is the code I am working with (simple Full Stoch two days in 
the up direction creates a "Buy" signal and the convers for a "Sell" 
signal:

O5Pds1 = Optimize("O5pds1", 16,   5,  20, 1);
O5Pds2 = Optimize("O5pds2",  5,   2,  10, 1);
O5Pds3 = Optimize("O5pds3",  8,   2,  10, 1); 

pds = O5Pds1; /*Periods */
slw = O5Pds2; /*Slowing for Full Stoch%K*/
slwd = O5Pds3; /*Slowing for Full Stoch%D*/

FSK = 100*(C-LLV(L,pds))/(HHV(H,pds)-LLV(L,pds)); // FASTSTOCHK
FLSK = MA( FSK, slw ); // FULLSTOCHK
FLSD = MA( FLSK, slwd ); // FULLSTOCHD

His=FLSK; 

O5Up = IIf(Ref(His,-3)>=Ref(His,-2) AND Ref(His,-2)<=Ref(His,-1) AND 
Ref(His,-1)<His, 1,0);
O5Dn = IIf(Ref(His,-3)<=Ref(His,-2) AND Ref(His,-2)>=Ref(His,-1) AND 
Ref(His,-1)>His,-1,0);

O5UpDn = O5Up + O5Dn

Buy =  O5Up > 0;
Sell = O5Dn < 0;
Short = Sell; 
Cover = Buy;

What I want to do is to be able to plot O5UpDn.  But!

The problem I have now is I get a spike to "1" when I have two 
updays in a row on the Full Stocastic, then the value goes to "0" as 
soon as there are not two up days in a row.  

Ditto on the converse with two down days in a row.

So if:

Day 1 is up on Full Sto, then O5Up = 0
Day 2 is up on Full Sto, then O5Up = 1
Day 3 is up on Full Sto, then O5Up = 1
Day 4 is down on Full Sto, then O5Up = 0
Day 5 is up on Full Sto, then O5Up = 0
Day 6 is up on Full Sto, then O5Up = 1

How do I hold the "1" for a plot?


Thanx,

Phil



Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

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

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