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

RE: [amibroker] Creating an artifical security.



PureBytes Links

Trading Reference Links










Thanks for that Tomasz, I only spent a few
minutes on it this morning in between trading, so did not think to investigate
alternative last bar formulae.

 





<span
>Cheers,

<span
 >Graham





 

<span
>-----Original Message-----
From: Tomasz Janeczko
[mailto:amibroker@xxxxxx] 
Sent: Wednesday, 5 February 2003
4:45 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Creating
an artifical security.

<font size=3
face="Times New Roman"> 



<font size=2
face="Times New Roman">Graham,





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">By the way
DateNum()==LastValue(DateNum())





<font size=2
face="Times New Roman">works good for
EOD only databases.





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">To make it work for all
databases (including intraday) you would either use





<font size=2
face="Times New Roman">Cum(1) == LastValue(
Cum(1) )





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">or (in newer versions):





<font size=2
face="Times New Roman">DateTime() ==
LastValue(DateTime())





<font size=2
face="Times New Roman"> 





<font size=2
face="Times New Roman">or 





<font size=2
face="Times New Roman">BarIndex() ==
LastValue(BarIndex()) 





<font size=2
face="Times New Roman">
Best regards,
Tomasz Janeczko
amibroker.com







<span
>----- Original Message ----- 





<font
size=2 face=Arial>From: <a href=""
title="gkavanag@xxxxxxxxxxxxxx">Graham 





<span
>To:<font
size=2 face=Arial> <a
href="" title="amibroker@xxxxxxxxxxxxxxx">amibroker@xxxxxxxxxxxxxxx






<span
>Sent:<font
size=2 face=Arial> Wednesday,
February 05, 2003 9:30 AM





<span
>Subject:<font
size=2 face=Arial> RE:
[amibroker] Creating an artifical security.





<font size=2
face="Times New Roman"> 



<span
lang=EN-AU >Thanks for the compliment Tomasz

<span
lang=EN-AU >Have been thinking about this one myself
today and considered it unnecessary to produce the composite unless needed for
some reason. I have simplified the code a bit, and then made more complex with
adding the trading tick and the available range of modifying the last price
values J

<span
> 

<font size=2 color=green
face="Courier New">//allow for minimum trading ticks

<font size=2 color=black
face="Courier New">tick = <span
lang=EN-AU >0.5<font
size=2 color=black face="Courier New">;

<font size=3
face="Times New Roman"> 

<font size=2 color=black
face="Courier New">xo = <span
lang=EN-AU >LastValue<font
size=2 color=black face="Courier New">(<font size=2 color=red
face="Courier New">O<span
lang=EN-AU >);

<font size=2 color=black
face="Courier New">do = <span
lang=EN-AU >round<font
size=2 color=black face="Courier New">(xo*<font size=2
color=fuchsia face="Courier New">0.2<font size=2
color=black face="Courier New">);

<font size=2 color=red
face="Courier New">O<span
lang=EN-AU > = <font
size=2 color=blue face="Courier New">IIf<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">DateNum<span
lang=EN-AU >()==<font
size=2 color=blue face="Courier New">LastValue<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">DateNum<span
lang=EN-AU >()),<font
size=2 color=blue face="Courier New">Param<font size=2
color=black face="Courier New">(<font size=2
color="#cc4466" face="Courier New">"O"<font
size=2 color=black face="Courier New">,xo,xo-do,xo+do,tick),<font
size=2 color=blue face="Courier New">Ref<font size=2
color=black face="Courier New">(<font size=2 color=red
face="Courier New">O<span
lang=EN-AU >,<font
size=2 color=fuchsia face="Courier New">1<font size=2
color=black face="Courier New">));

<font size=2 color=black
face="Courier New">xh = <span
lang=EN-AU >LastValue<font
size=2 color=black face="Courier New">(<font size=2 color=red
face="Courier New">H<span
lang=EN-AU >);

<font size=2 color=black
face="Courier New">dh = <span
lang=EN-AU >round<font
size=2 color=black face="Courier New">(xh*<font size=2
color=fuchsia face="Courier New">0.2<font size=2
color=black face="Courier New">);

<font size=2 color=red
face="Courier New">H<span
lang=EN-AU > = <font
size=2 color=blue face="Courier New">IIf<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">DateNum<span
lang=EN-AU >()==<font
size=2 color=blue face="Courier New">LastValue<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">DateNum<span
lang=EN-AU >()),<font
size=2 color=blue face="Courier New">Param<font size=2
color=black face="Courier New">(<font size=2
color="#cc4466" face="Courier New">"H"<font
size=2 color=black face="Courier New">,xh,xh-dh,xh+dh,tick),<font
size=2 color=blue face="Courier New">Ref<font size=2
color=black face="Courier New">(<font size=2 color=red
face="Courier New">H<span
lang=EN-AU >,<font
size=2 color=fuchsia face="Courier New">1<font size=2
color=black face="Courier New">));

<font size=2 color=black
face="Courier New">xl= <span
lang=EN-AU >LastValue<font
size=2 color=black face="Courier New">(<font size=2 color=red
face="Courier New">L<span
lang=EN-AU >);

<font size=2 color=black
face="Courier New">dl = <span
lang=EN-AU >round<font
size=2 color=black face="Courier New">(xl*<font size=2
color=fuchsia face="Courier New">0.2<font size=2
color=black face="Courier New">);

<font size=2 color=red
face="Courier New">L<span
lang=EN-AU > = <font
size=2 color=blue face="Courier New">IIf<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">DateNum<span
lang=EN-AU >()==<font
size=2 color=blue face="Courier New">LastValue<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">DateNum<span
lang=EN-AU >()),<font
size=2 color=blue face="Courier New">Param<font size=2
color=black face="Courier New">(<font size=2
color="#cc4466" face="Courier New">"L"<font
size=2 color=black face="Courier New">,xl,xl-dl,xl+dl,tick),<font
size=2 color=blue face="Courier New">Ref<font size=2
color=black face="Courier New">(<font size=2 color=red
face="Courier New">L<span
lang=EN-AU >,<font
size=2 color=fuchsia face="Courier New">1<font size=2
color=black face="Courier New">));

<font size=2 color=black
face="Courier New">xc = <span
lang=EN-AU >LastValue<font
size=2 color=black face="Courier New">(<font size=2 color=red
face="Courier New">C<span
lang=EN-AU >);

<font size=2 color=black
face="Courier New">dc = <span
lang=EN-AU >round<font
size=2 color=black face="Courier New">(xc*<font size=2
color=fuchsia face="Courier New">0.2<font size=2
color=black face="Courier New">);

<font size=2 color=red
face="Courier New">C<span
lang=EN-AU > = <font
size=2 color=blue face="Courier New">IIf<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">DateNum<span
lang=EN-AU >()==<font
size=2 color=blue face="Courier New">LastValue<font size=2
color=black face="Courier New">(<font size=2 color=blue
face="Courier New">DateNum<span
lang=EN-AU >()),<font
size=2 color=blue face="Courier New">Param<font size=2
color=black face="Courier New">(<font size=2
color="#cc4466" face="Courier New">"C"<font
size=2 color=black face="Courier New">,xc,xc-dc,xc+dc,tick),<font
size=2 color=blue face="Courier New">Ref<font size=2
color=black face="Courier New">(<font size=2 color=red
face="Courier New">C<span
lang=EN-AU >,<font
size=2 color=fuchsia face="Courier New">1<font size=2
color=black face="Courier New">));

<font size=3
face="Times New Roman"> 

<font size=3
face="Times New Roman"> 

<font size=2 color=blue
face="Courier New">Plot<span
lang=EN-AU >( <font
size=2 color=blue face="Courier New">EMA<font size=2
color=black face="Courier New"> (<font size=2 color=red
face="Courier New">C<span
lang=EN-AU >,<font
size=2 color=fuchsia face="Courier New">10<font size=2
color=black face="Courier New">),<font size=2
color="#cc4466" face="Courier New">"EMA"<font
size=2 color=black face="Courier New">,<font size=2 color=red
face="Courier New">colorBlue<span
lang=EN-AU >,<font
size=2 color=red face="Courier New">styleLine<font size=2
color=black face="Courier New">);

<font size=2 color=blue
face="Courier New">Plot<span
lang=EN-AU >(<font
size=2 color=red face="Courier New">C<font size=2 color=black
face="Courier New">,<span
lang=EN-AU >"chart"<font
size=2 color=black face="Courier New">,<font size=2 color=red
face="Courier New">colorBlack<span
lang=EN-AU >,<font
size=2 color=red face="Courier New">styleCandle<font size=2
color=black face="Courier New">);

<font size=2 color=blue
face="Courier New">Plot<span
lang=EN-AU >(<font
size=2 color=blue face="Courier New">StochD<font size=2
color=black face="Courier New">(<font size=2
color=fuchsia face="Courier New">14<font size=2
color=black face="Courier New">),<font size=2
color="#cc4466" face="Courier New">"stochD"<font
size=2 color=black face="Courier New">,<font size=2 color=red
face="Courier New">colorGreen<span
lang=EN-AU >,<font
size=2 color=red face="Courier New">styleLine<font size=2
color=black face="Courier New">+<font size=2 color=red
face="Courier New">styleOwnScale<font size=2 color=black
face="Courier New">);

<font size=2 color=blue
face="Courier New">Plot<font
color=black>(<font
color=blue>StochK<font
color=black>(<font
color=fuchsia>14<font
color=black>),<font
color="#cc4466">"stochK"<font
color=black>,<font
color=red>colorRed<font
color=black>,<font
color=red>styleLine<font
color=black>+<font
color=red>styleOwnScale<font
color=black>);

<span
> 

<span
lang=EN-AU >Cheers,

<span
lang=EN-AU >Graham

<span
> 

<span
> 

<span
>-----Original Message-----
From: Tomasz Janeczko [mailto:amibroker@xxxxxx] 
Sent: Wednesday, 5 February 2003 3:51 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Creating an artifical security.

<span
> 

<span
lang=EN-AU >Bill,

<span
> 

<span
lang=EN-AU >Graham already presented the code and it is
nice.

<span
lang=EN-AU >But I started to wonder if it wouldn't be
easier for you to use 

<span
lang=EN-AU >Foreign/Ref function instead. I mean
instead of creating artificial ticker

<span
lang=EN-AU >and then using it somewhere else

<span
lang=EN-AU >use

<span
> 

<span
lang=EN-AU >Dummy = Ref( Foreign("Original
Security", "C" ), -1 );

<span
> 

<span
lang=EN-AU >in the *final* indicator you want to
create.

<span
> 

<span
lang=EN-AU >To change the last day data simply use:

<span
> 

<span
lang=EN-AU >Dummy = Ref( Foreign("Original
Security", "C" ), -1 );

<span
lang=EN-AU >Dummy = IIF( Cum(1) == LastValue( Cum(1) ),
FINALDAYVALUE, Dummy );

<span
> 

<span
lang=EN-AU >(in most recent version 4.28 it can be also
coded using BarIndex() :)

<span
> 

<span
lang=EN-AU >Dummy = IIF( BarIndex() == LastValue(
BarIndex() ), FINALDAYVALUE, Dummy );

<span
> 

<span
> 

<span
lang=EN-AU >Best regards,

<span
lang=EN-AU >Tomasz Janeczko

<span
lang=EN-AU >amibroker.com

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

<span
lang=EN-AU >From: <wbarack@xxxxxxxxx>

<span
lang=EN-AU >To: <amibroker@xxxxxxxxxxxxxxx>

<span
lang=EN-AU >Sent: Tuesday, February 04, 2003 9:30 PM

<span
lang=EN-AU >Subject: [amibroker] Creating an artifical
security.

<span
> 

<span
> 

<span
lang=EN-AU >> Help! I want to be able to create a
security that has all data 

<span
lang=EN-AU >> shifted back in time by one day and
then be able to put in my best 

<span
lang=EN-AU >> guess for the final day's data.

<span
lang=EN-AU >> 

<span
lang=EN-AU >> Shifting can be done, I think, using
the ref function.

<span
lang=EN-AU >> 

<span
lang=EN-AU >> Dummy = ref(original security,-1)

<span
lang=EN-AU >> 

<span
lang=EN-AU >> But how can I plug in the final days
data. I can't quite figure that 

<span
lang=EN-AU >> one out. Any great ideas out there?

<span
lang=EN-AU >> 

<span
lang=EN-AU >> Bill

<span
lang=EN-AU >> 

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

<span
lang=EN-AU >> Your use of Yahoo! Groups is subject
to http://docs.yahoo.com/info/terms/ 

<span
lang=EN-AU >> 

<span
lang=EN-AU >> 

<span
lang=EN-AU >> 

<span
> 

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

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

<span
> 

<span
lang=EN-AU >Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/ 

<span
> 

<font size=2
face="Times New Roman">

Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx <font
size=2 face="Courier New">
(Web page: <a
href="">http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html<font
size=2> 

Your
use of Yahoo! Groups is subject to the <a
href="">Yahoo! Terms of Service.<font
size=2> 



<font size=2
face="Times New Roman">



<font size=2
face="Courier New">Post AmiQuote-related
messages ONLY to: amiquote@xxxxxxxxxxxxxxx <font size=2
face="Courier New">
(Web page: <a
href="">http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: <a
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html<font
size=2> 

Your
use of Yahoo! Groups is subject to the <a
href="">Yahoo! Terms of Service.<font
size=2> 










Yahoo! Groups Sponsor


  ADVERTISEMENT  









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



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.