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

Re: [amibroker] How do I subtract the difference between two horizontal study lines? (in AFL)



PureBytes Links

Trading Reference Links




Bruce,
 
Please use this code:
 

<FONT face="Courier New" 
color=black size=1><SPAN 
>x=<SPAN 
class=SpellE><SPAN 
>ValueWhen<SPAN 
class=GramE><SPAN 
>(NOT IsNull( 
<SPAN 
>Study<FONT 
face="Courier New" color=black size=1><SPAN 
>(<FONT 
face="Courier New" color=fuchsia size=1><SPAN 
>"re"<FONT 
face="Courier New" color=black size=1><SPAN 
>)),<SPAN 
>Study<FONT 
face="Courier New" color=black size=1><SPAN 
>(<FONT 
face="Courier New" color=fuchsia size=1><SPAN 
>"re"<FONT 
face="Courier New" color=black size=1><SPAN 
>));
<FONT face="Courier New" 
color=black size=1><SPAN 
>y=<SPAN 
class=SpellE><SPAN 
>ValueWhen<SPAN 
class=GramE><SPAN 
>(NOT IsNull( 
<SPAN 
>Study<FONT 
face="Courier New" color=black size=1><SPAN 
>(<FONT 
face="Courier New" color=fuchsia size=1><SPAN 
>"<SPAN 
class=SpellE>su"<FONT face="Courier New" color=black 
size=1><SPAN 
>)),<SPAN 
>Study<FONT 
face="Courier New" color=black size=1><SPAN 
>(<FONT 
face="Courier New" color=fuchsia size=1><SPAN 
>"<SPAN 
class=SpellE>su"<FONT face="Courier New" color=black 
size=1><SPAN 
>));
<FONT 
face="Courier New" color=blue size=1><SPAN 
>WriteVal<FONT 
face="Courier New" color=black size=1><SPAN 
>(x);
<FONT 
face="Courier New" color=blue size=1><SPAN 
>WriteVal<FONT 
face="Courier New" color=black size=1><SPAN 
>(y);
<FONT 
face="Courier New" color=blue size=1><SPAN 
>WriteVal<FONT 
face="Courier New" color=black size=1><SPAN 
>(x-y);
<FONT face="Courier New" 
color=black size=1><SPAN 
> 
Hope this helps.
 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Bruce 
  Nutter 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Tuesday, October 14, 2003 10:09 
  PM
  Subject: RE: [amibroker] How do I 
  subtract the difference between two horizontal study lines? (in AFL)
  
  
  <FONT 
  face="Courier New" color=black size=1><SPAN 
  >Gurus and 
  Jayson
  <FONT 
  face="Courier New" color=black size=1><SPAN 
  >I tried this 
  code so I could see the difference between the two horizontal lines. But the 
  results I get in the interpretation window is shown 
  below. Could some guru please tell me why this does not <SPAN 
  class=GramE>work. (For those of you who might ask yes the labels of my 
  horizontal study lines are &#8220;re&#8221; and &#8220;<SPAN 
  class=SpellE>su&#8221;)
  <B 
  ><FONT face="Courier New" color=black 
  size=5><SPAN 
  >Formula 
  code:
  <FONT 
  face="Courier New" color=black size=1><SPAN 
  >x=<SPAN 
  class=SpellE><FONT face="Courier New" color=blue 
  size=1><SPAN 
  >LastValue<SPAN 
  class=GramE><SPAN 
  >(<FONT 
  face="Courier New" color=blue size=1><SPAN 
  >Study<FONT 
  face="Courier New" color=black size=1><SPAN 
  >(<FONT 
  face="Courier New" color=fuchsia size=1><SPAN 
  >"re"<FONT 
  face="Courier New" color=black size=1><SPAN 
  >));
  <FONT 
  face="Courier New" color=black size=1><SPAN 
  >y=<SPAN 
  class=SpellE><FONT face="Courier New" color=blue 
  size=1><SPAN 
  >LastValue<SPAN 
  class=GramE><SPAN 
  >(<FONT 
  face="Courier New" color=blue size=1><SPAN 
  >Study<FONT 
  face="Courier New" color=black size=1><SPAN 
  >(<FONT 
  face="Courier New" color=fuchsia size=1><SPAN 
  >"<SPAN 
  class=SpellE>su"<FONT face="Courier New" color=black 
  size=1><SPAN 
  >));
  <SPAN 
  class=SpellE><SPAN 
  >WriteVal<FONT 
  face="Courier New" color=black size=1><SPAN 
  >(x);
  <SPAN 
  class=SpellE><SPAN 
  >WriteVal<FONT 
  face="Courier New" color=black size=1><SPAN 
  >(y);
  <SPAN 
  class=SpellE><SPAN 
  >WriteVal<FONT 
  face="Courier New" color=black size=1><SPAN 
  >(x-y);
  <B 
  ><FONT face="Courier New" color=black 
  size=5><SPAN 
  >Interpretation 
  window result:
  <FONT 
  face="Courier New" color=black size=1><SPAN 
  >0
  <FONT 
  face="Courier New" color=black size=1><SPAN 
  >0
  <FONT 
  face="Courier New" color=black size=1><SPAN 
  >0
  <FONT 
  face="Courier New" color=black size=1><SPAN 
  > 
  <FONT 
  face="Courier New" color=black size=1><SPAN 
  > 
  <SPAN 
  >Bruce
  <SPAN 
  > 
  <SPAN 
  >-----Original 
  Message-----From: Jayson 
  [mailto:jcasavant@xxxxxxxxxxx] <SPAN 
  >Sent: <st1:date Year="2003" 
  Day="14" Month="10"><SPAN 
  >Tuesday, October 14, 
  2003<SPAN 
  > <st1:time 
  Minute="49" Hour="9"><SPAN 
  >9:49 
  AM<SPAN 
  ><SPAN 
  >To: amibroker@xxxxxxxxxxxxxxx<SPAN 
  >Subject: RE: [amibroker] How do I 
  subtract the difference between two horizontal study lines? (in 
  AFL)
  <FONT face="Times New Roman" 
  size=3> 
  
  <FONT face=Arial color=blue 
  size=2><SPAN 
  >Brian,
  
  <FONT face=Arial color=blue 
  size=2>have a 
  look in the help files for Study(). You can name your trend line than call its 
  value in a code.
  
  <FONT face="Times New Roman" 
  size=3> 
  
  <FONT face=Arial color=blue 
  size=2>for 
  instance in this exploration I have named 2 study lines and called the last 
  value of each and subtracted one from the 
  other....
  
  <FONT face="Times New Roman" 
  size=3> 
  
  <FONT face="Times New Roman" 
  size=2> 
  
  <FONT face=Arial color=blue 
  size=2><SPAN 
  >Filter=C>0;<FONT 
  color=#282828 size=2><SPAN 
  >
  
  <FONT face=Arial color=blue 
  size=2><SPAN 
  >x=<FONT 
  color=blue size=2><SPAN 
  >LastValue(Study("s1"))<FONT 
  face=Arial color=blue size=2><SPAN 
  >;<FONT 
  face=Arial color=#282828 size=2><SPAN 
  >
  
  <FONT face=Arial color=blue 
  size=2><SPAN 
  >y=<FONT 
  color=blue size=2><SPAN 
  >LastValue(Study("s<FONT 
  face=Arial color=blue size=2><SPAN 
  >2<FONT 
  color=blue size=2><SPAN 
  >")<FONT face=Arial 
  color=blue size=2><SPAN 
  >);<FONT 
  face=Arial color=#282828 size=2><SPAN 
  >
  
  <FONT face=Arial color=blue 
  size=2><SPAN 
  >AddColumn<FONT 
  face=Arial color=#282828 size=2><SPAN 
  >(x,<FONT 
  face=Arial color=fuchsia size=2><SPAN 
  >""<FONT 
  face=Arial color=#282828 size=2><SPAN 
  >);<FONT 
  color=#282828 size=2><SPAN 
  >
  
  <FONT face=Arial color=blue 
  size=2><SPAN 
  >AddColumn<FONT 
  face=Arial color=#282828 size=2><SPAN 
  >(y,<FONT 
  face=Arial color=fuchsia size=2><SPAN 
  >""<FONT 
  face=Arial color=#282828 size=2><SPAN 
  >);
  
  <FONT face=Arial color=blue 
  size=2><SPAN 
  >AddColumn<FONT 
  face=Arial color=#282828 size=2><SPAN 
  >(x-y,<FONT 
  face=Arial color=fuchsia size=2><SPAN 
  >""<FONT 
  face=Arial color=#282828 size=2><SPAN 
  >);
  
  <FONT face="Times New Roman" 
  size=3> 
  
  <FONT face="Times New Roman" 
  size=3> 
  
  <FONT face=Arial color=blue 
  size=2><SPAN 
  >Regards, 
  
  <FONT face=Arial color=blue 
  size=2><SPAN 
  >Jayson 
  
  <P class=MsoNormal 
  ><FONT 
  face=Tahoma size=2><SPAN 
  >-----Original 
  Message-----From: Bruce 
  Nutter [mailto:bdnutter@xxxxxxxxxxx]<SPAN 
  >Sent: <st1:date Year="2003" 
  Day="14" Month="10"><SPAN 
  >Tuesday, October 14, 
  2003<SPAN 
  > <st1:time 
  Minute="26" Hour="12"><SPAN 
  >12:26 
  PM<SPAN 
  ><SPAN 
  >To: amibroker@xxxxxxxxxxxxxxx<SPAN 
  >Subject: [amibroker] How do I subtract 
  the difference between two horizontal study lines? (in 
  AFL)
  <FONT face="Times New Roman" 
  color=black size=3><SPAN 
  >Gurus,
  <FONT face="Times New Roman" 
  color=black size=3>Does anybody 
  know how to subtract between two horizontal study lines in AFL code? I have to 
  study lines that I move around to calculate entry and exit points. What I'd 
  like to do is to show that vertical distance between these two horizontal 
  lines in the interpretation window. Would one of you gurus please let me know 
  how to do this?
  <FONT face="Times New Roman" 
  color=black size=3><SPAN 
  >Bruce
  <FONT face="Times New Roman" 
  size=3><FONT 
  face="Courier New" size=2>Send BUG REPORTS to 
  bugs@xxxxxxxxxxxxx<SPAN 
  ><FONT 
  face="Courier New">Send SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx<FONT 
  face="Courier New">-----------------------------------------<FONT 
  face="Courier New">Post AmiQuote-related messages ONLY to: 
  amiquote@xxxxxxxxxxxxxxx (Web 
  page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
  face="Courier New">--------------------------------------------<FONT 
  face="Courier New">Check group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your 
  use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of 
  Service. <BR 
  ><BR 
  ><FONT 
  face="Courier New" size=2>Send BUG REPORTS to 
  bugs@xxxxxxxxxxxxx<SPAN 
  ><FONT 
  face="Courier New">Send SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx<FONT 
  face="Courier New">-----------------------------------------<FONT 
  face="Courier New">Post AmiQuote-related messages ONLY to: 
  amiquote@xxxxxxxxxxxxxxx (Web 
  page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)<FONT 
  face="Courier New">--------------------------------------------<FONT 
  face="Courier New">Check group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your 
  use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of 
  Service. 
  Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (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 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT 









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



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