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

RE: [amibroker] Creating an artifical security.



PureBytes Links

Trading Reference Links









<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 lang=EN-AU
> 

<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=2 color=black
face="Courier New"> 

<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=2 color=black
face="Courier New"> 

<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">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">);

<span
lang=EN-AU >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
lang=EN-AU > 

<span lang=EN-AU
>Cheers,

<span lang=EN-AU
 >Graham

<span lang=EN-AU
> 

<span lang=EN-AU
> 

-----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 lang=EN-AU
> 

<span lang=EN-AU
>Bill,

<span lang=EN-AU
> 

<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 lang=EN-AU
> 

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

<span lang=EN-AU
> 

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

<span lang=EN-AU
> 

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

<span lang=EN-AU
> 

<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 lang=EN-AU
> 

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

<span lang=EN-AU
> 

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

<span lang=EN-AU
> 

<span lang=EN-AU
> 

<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 lang=EN-AU
> 

<span lang=EN-AU
> 

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










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.