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

Re: [amibroker] coding a particular day



PureBytes Links

Trading Reference Links









<span lang=EN-AU
>I have come across this myself in the past when you
can get days together of zero change. Perhaps you need to either use a loop, or
something like this

<span lang=EN-AU
> 

<font size=2 color=black
face="Courier New">FSKdenom = <font size=2 color=blue
face="Courier New">IIf<font size=2 color=black
face="Courier New">(<span
lang=EN-AU >HHV<font size=2 color=black
face="Courier New">(<span
lang=EN-AU >H<span
lang=EN-AU >,pds)==<font
size=2 color=blue face="Courier New">LLV<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">L<font
size=2 color=black face="Courier New">,pds), <font size=2
color=blue face="Courier New">ValueWhen<font
size=2 color=black face="Courier New">( <font size=2
color=blue face="Courier New">HHV<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">H<font
size=2 color=black face="Courier New">,pds)!=<font size=2
color=blue face="Courier New">LLV<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">L<font
size=2 color=black face="Courier New">,pds), <font size=2
color=blue face="Courier New">HHV<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">H<font
size=2 color=black face="Courier New">,pds)-<font size=2
color=blue face="Courier New">LLV<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">L<font
size=2 color=black face="Courier New">,pds) ),  <font
size=2 color=blue face="Courier New">HHV<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">H<font
size=2 color=black face="Courier New">,pds)-<font size=2
color=blue face="Courier New">LLV<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">L<font
size=2 color=black face="Courier New">,pds) );

<font size=2 color=black
face="Courier New">FSKnom = <font size=2 color=blue
face="Courier New">IIf<font size=2 color=black
face="Courier New">(<span
lang=EN-AU >C<span
lang=EN-AU >==<font
size=2 color=blue face="Courier New">LLV<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">L<font
size=2 color=black face="Courier New">,pds), <font size=2
color=blue face="Courier New">ValueWhen<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">C<font
size=2 color=black face="Courier New">!=<font size=2
color=blue face="Courier New">LLV<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">L<font
size=2 color=black face="Courier New">,pds), <font size=2
color=red face="Courier New">C<font
size=2 color=black face="Courier New">-<font size=2
color=blue face="Courier New">LLV<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">L<font
size=2 color=black face="Courier New">,pds)) , <font size=2
color=red face="Courier New">C<font
size=2 color=black face="Courier New">-<font size=2
color=blue face="Courier New">LLV<font
size=2 color=black face="Courier New">(<font size=2
color=red face="Courier New">L<font
size=2 color=black face="Courier New">,pds) ); 

<span
lang=EN-AU >FSK =
FSKnom / FSKdenom * <font size=2 color=fuchsia
face="Courier New">100<font size=2 color=black
face="Courier New">;

<span lang=EN-AU
> 

<span lang=EN-AU
>Hope this is right, only checked the syntax for errors

<span lang=EN-AU
> 

<span lang=EN-AU
>Cheers,

<span lang=EN-AU
>Graham

<span lang=EN-AU
>http://e-wire.net.au/~eb_kavan/

<span lang=EN-AU
> 

-----Original
Message-----
From: Phil [mailto:KDSnyder96@xxxxxxxxxxxxxx] 
Sent: Monday, March 15, 2004 8:57 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Some Help Please

<span lang=EN-AU
> 

<span lang=EN-AU
>For those old pro's please bear with what is probably
an easy 

<span lang=EN-AU
>question from a first timer.

<span lang=EN-AU
> 

<span lang=EN-AU
>Here is the code I am working with (simple Full Stoch
two days in 

<span lang=EN-AU
>the up direction creates a "Buy" signal and
the convers for a "Sell" 

<span lang=EN-AU
>signal:

<span lang=EN-AU
> 

<span lang=EN-AU
>O5Pds1 = Optimize("O5pds1", 16,  
5,  20, 1);

<span lang=EN-AU
>O5Pds2 = Optimize("O5pds2", 
5,   2,  10, 1);

<span lang=EN-AU
>O5Pds3 = Optimize("O5pds3", 
8,   2,  10, 1); 

<span lang=EN-AU
> 

<span lang=EN-AU
>pds = O5Pds1; /*Periods */

<span lang=EN-AU
>slw = O5Pds2; /*Slowing for Full Stoch%K*/

<span lang=EN-AU
>slwd = O5Pds3; /*Slowing for Full Stoch%D*/

<span lang=EN-AU
> 

<span lang=EN-AU
>FSK = 100*(C-LLV(L,pds))/(HHV(H,pds)-LLV(L,pds)); //
FASTSTOCHK

<span lang=EN-AU
>FLSK = MA( FSK, slw ); // FULLSTOCHK

<span lang=EN-AU
>FLSD = MA( FLSK, slwd ); // FULLSTOCHD

<span lang=EN-AU
> 

<span lang=EN-AU
>His=FLSK; 

<span lang=EN-AU
> 

<span lang=EN-AU
>O5Up = IIf(Ref(His,-3)>=Ref(His,-2) AND
Ref(His,-2)<=Ref(His,-1) AND 

<span lang=EN-AU
>Ref(His,-1)<His, 1,0);

<span lang=EN-AU
>O5Dn = IIf(Ref(His,-3)<=Ref(His,-2) AND
Ref(His,-2)>=Ref(His,-1) AND 

<span lang=EN-AU
>Ref(His,-1)>His,-1,0);

<span lang=EN-AU
> 

<span lang=EN-AU
>O5UpDn = O5Up + O5Dn

<span lang=EN-AU
> 

<span lang=EN-AU
>Buy =  O5Up > 0;

<span lang=EN-AU
>Sell = O5Dn < 0;

<span lang=EN-AU
>Short = Sell; 

<span lang=EN-AU
>Cover = Buy;

<span lang=EN-AU
> 

<span lang=EN-AU
>What I want to do is to be able to plot O5UpDn. 
But!

<span lang=EN-AU
> 

<span lang=EN-AU
>The problem I have now is I get a spike to
"1" when I have two 

<span lang=EN-AU
>updays in a row on the Full Stocastic, then the value
goes to "0" as 

<span lang=EN-AU
>soon as there are not two up days in a row.  

<span lang=EN-AU
> 

<span lang=EN-AU
>Ditto on the converse with two down days in a row.

<span lang=EN-AU
> 

<span lang=EN-AU
>So if:

<span lang=EN-AU
> 

<span lang=EN-AU
>Day 1 is up on Full Sto, then O5Up = 0

<span lang=EN-AU
>Day 2 is up on Full Sto, then O5Up = 1

<span lang=EN-AU
>Day 3 is up on Full Sto, then O5Up = 1

<span lang=EN-AU
>Day 4 is down on Full Sto, then O5Up = 0

<span lang=EN-AU
>Day 5 is up on Full Sto, then O5Up = 0

<span lang=EN-AU
>Day 6 is up on Full Sto, then O5Up = 1

<span lang=EN-AU
> 

<span lang=EN-AU
>How do I hold the "1" for a plot?

<span lang=EN-AU
> 

<span lang=EN-AU
> 

<span lang=EN-AU
>Thanx,

<span lang=EN-AU
> 

<span lang=EN-AU
>Phil

<span lang=EN-AU
> 

<span lang=EN-AU
> 

<span lang=EN-AU
> 

<span lang=EN-AU
>Send BUG REPORTS to bugs@xxxxxxxxxxxxx

<span lang=EN-AU
>Send SUGGESTIONS to suggest@xxxxxxxxxxxxx

<span lang=EN-AU
>-----------------------------------------

<span lang=EN-AU
>Post AmiQuote-related messages ONLY to:
amiquote@xxxxxxxxxxxxxxx 

<span lang=EN-AU
>(Web page:
http://groups.yahoo.com/group/amiquote/messages/)

<span lang=EN-AU
>--------------------------------------------

<span lang=EN-AU
>Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

<span lang=EN-AU
>Yahoo! Groups Links

<span lang=EN-AU
> 

<span lang=EN-AU
><*> To visit your group on the web, go to:

<span lang=EN-AU
>    
http://groups.yahoo.com/group/amibroker/

<span lang=EN-AU
> 

<span lang=EN-AU
><*> To unsubscribe from this group, send an
email to:

<span lang=EN-AU
>    
amibroker-unsubscribe@xxxxxxxxxxxxxxx

<span lang=EN-AU
> 

<span lang=EN-AU
><*> Your use of Yahoo! Groups is subject to:

<span lang=EN-AU
>    
http://docs.yahoo.com/info/terms/

<span lang=EN-AU
> 






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 Sponsor


  ADVERTISEMENT 












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 the Yahoo! Terms of Service.