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

Re: [amibroker] Can´t find the cum value!!!!!!!!!!!!



PureBytes Links

Trading Reference Links




Jayson,
 
I donīt want to get the cum values for z and y. 
They are cum values in themselves.
 
Plus, I donīt want the # of bars which make up the 
distance between z and y. Rather, I want the cum value (i.e. bar number) when 
the swing top, labeled firstswingtop, and the swing bottom, firstswingbottom, 
occur.
 
Take for instance the chart of Comp-I.
 
There, firstwingtop (NOTE I changed the swingsize 
to 18 for better visibility) has a value of 1,467.35 and 
the firstswingbottom has a value of 1,327.19. And itīs THEIR cum value that I 
want not the ones of firstlinechangedown and firstlinechangeup.
 
Firstlinechangeup and firstlinechangedown are some 
sort of "assisting variables" which I need to determine first since a swing top 
is located in between. 
 
Take for instance the firstswingtop: it is the 
highest high between firstlinechangeup and firstlinechangedown, provided that 
firstlinechangedown comes first (seen from the end of the chart). 
 
Firstswingbottom is the lowest low between 
firstlinechangeup and SECONDlinechangedown. As you can see, 
firstswingbottom happens AFTER firstswingtop (again seen from the end of the 
chart). So it must have a lower cum value than firstswingtop.
 
As you can see, the tops and the bottoms occur 
alternately. The fact that firstswingtop occurs before firstswingbottom has to 
do with the fact that I required in my filter that firstlinechangedown must 
occur before firstlinechangeup.
 
Had it required the other way around, then 
firstswingbottom had occured before firstswingtop.
 
Do you now see which cum values Iīm after? My 
cum values might differ from yours since the first day loaded in the chart 
is 11/02/84.
 
Please ask back if I havenīt made myself clear 
enough!
 
Incidentally, I copied a post from me and TJīs 
reply from a while ago regarding the lastvalue issue if youīre 
interested.
 
Appreciate your help
 
Markus
 
- - - - - - -

Markus,
 
I have pointed you and other people tens of times to 
<A 
href="">http://www.amibroker.com/newsletter/09-2001.html<A 
href="">
where in "Understanding AmiBroker Formula Language" 
article it is explained
that (almost) AFL all functions operate on arrays and 
return array.
Array always contains multiple values - one for every bar of 
your data.
ValueWhen function is NO exception here.
 
Otherwise it would not work at all. Consider 
this:
 
ValueWhen( DayOfWeek() == 5, Close );
 
If this would give you only ONE value it would not allow you 
to do anything useful,
but since it gives you array - it allows you to plot Weekly 
(Friday) close:
 
graph0 = ValueWhen( DayOfWeek() == 5, Close );
 
Best 
regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  IVA GmbH 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Tuesday, November 26, 2002 12:02 
  PM
  Subject: Re: [amibroker] TJ, your kind 
  offer - Thanks!
  
  TJ,
   
  many thanks for getting back on this admittedly 
  "weird" piece of work>g>.
   
  Iīve found out why my code didnīt work and wanted 
  to share this with you and the rest of the bb members:
   
  I mistakenly supposed that 
  Valuewhen(cond1,cum(),1) would give me a single output (though this would 
  seem logical) which I could then continue to use.
   
  As you know, I used the output above to compare 
  it with the cum() value of another condition to determine which one happened 
  first or thereafter by using:
   
  Valuewhen(cond2 and 
  cum<Valuewhen(cond1,cum(),1) ,cum(),1)
   
  This gave me no output (column in Exploration 
  remained blank)! Just when I used
   
  Valuewhen(cond2 and  cum<<FONT 
  color=#ff0000>LASTVALUE(Valuewhen(cond1,cum(),1))
   
  I could use it further.
   
  I donīt understand it, īcause Valuewhen(...) 
  gives you a single output to which AFL "should"<g> be able to compare 
  further conditions.
   
  Just wanted to bring this to your attention - 
  itīs cost me weeks to find this out by coincidence!
   
  But Iīve enjoyed all your kind contributions and 
  assisting comments and continue to learn from the helping hands of this 
  forum!
   
  Have a great day!
   
  Markus
 
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  <A title=jcasavant@xxxxxxxxxxxx 
  href="">Jayson 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Saturday, March 08, 2003 9:55 
  PM
  Subject: RE: [amibroker] Canīt find the 
  cum value!!!!!!!!!!!!
  
  <SPAN 
  class=496454320-08032003>Markus,
  I am 
  not sure I understand. If you want the cum(1) value when a variable was True 
  then your first example should do it.
  <SPAN 
  class=496454320-08032003> 
  <FONT 
  size=2>Example: <FONT 
  size=2>
  AddColumn(<FONT 
  color=#0000ff>ValueWhen(z,<FONT 
  color=#0000ff>Cum(<FONT 
  color=#ff00ff>1),<FONT 
  color=#ff00ff>1)<FONT 
  color=#282828>,"barcount At Z"<FONT 
  color=#282828>);<FONT 
  color=#0000ff>
  AddColumn(<FONT 
  color=#0000ff>ValueWhen(y,<FONT 
  color=#0000ff>Cum(<FONT 
  color=#ff00ff>1),<FONT 
  color=#ff00ff>1),<FONT 
  color=#ff00ff>"barcount at Y");<FONT 
  color=#0000ff>
  AddColumn(<FONT 
  color=#0000ff>ValueWhen(<FONT 
  color=#282828>z,<FONT 
  color=#0000ff>Cum(<FONT 
  color=#ff00ff>1),<FONT 
  color=#ff00ff>1)<FONT 
  color=#282828>-ValueWhen<FONT 
  color=#282828>(y<FONT 
  color=#282828>,Cum<FONT 
  color=#282828>(1<FONT 
  color=#282828>),1<FONT 
  color=#282828>),"Bars in Swing"<FONT 
  color=#282828>);
   
  I 
  may be wrong but I wonder why you are using lastvalue for firstlinechangeup 
  and down. Would'nt you want simply the bar count as it 
  occurs?
   
  Jayson 
  <FONT face=Tahoma 
  size=2>-----Original Message-----From: funnybiz@xxxxxx 
  [mailto:funnybiz@xxxxxx]Sent: Saturday, March 08, 2003 1:14 
  PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] 
  Canīt find the cum value!!!!!!!!!!!!
  Jayson, Anthony and others,
   
  I recently posted a question that I couldnīt find 
  a cum value for a high (or low) value I found with my code 
  (attached).
   
  This question is posing a problem I canīt resolve 
  on my own.
   
  If anybody has an idea, please feel free to step 
  in!
   
  The code comes below. It pinpoints the high ad 
  low values correctly. I now need their cum values.
   
  I tried for instance 
   
  Valuewhen(high=firstswingtop, 
  cum(1),1)   or
   
  Iif (cum(1)>firstlinechangeup and 
  cum(1)<firstlinechangedown and 
  high=hhv(high,firstlinechangeup-firstlinechangedown),cum(1),0)
   
  but neither works.
   
  Thanks for your help!
   
  Markus
   
  - - - - - - - - - 
   
  
  swingsize=5<FONT 
  face="Courier New" color=#6600aa>;// could be any value of your choice
  weeklyrange=(Ref<FONT 
  face="Courier New" color=#6600aa>(<FONT face="Courier New" 
  color=#0000ff>HHV<FONT face="Courier New" 
  color=#6600aa>(<FONT face="Courier New" 
  color=#000000>High<FONT face="Courier New" 
  color=#6600aa>,swingsize),-<FONT face="Courier New" 
  color=#ff00ff>1)-<FONT 
  face="Courier New" color=#0000ff>Ref<FONT face="Courier New" 
  color=#6600aa>(LLV<FONT 
  face="Courier New" color=#6600aa>(<FONT face="Courier New" 
  color=#000000>Low<FONT face="Courier New" 
  color=#6600aa>,swingsize),-<FONT face="Courier New" 
  color=#ff00ff>1))*<FONT 
  face="Courier New" color=#ff00ff>0.1<FONT face="Courier New" 
  color=#6600aa>;
  Thresholddown=Ref<FONT 
  face="Courier New" color=#6600aa>(<FONT face="Courier New" 
  color=#0000ff>LLV<FONT face="Courier New" 
  color=#6600aa>(<FONT face="Courier New" 
  color=#000000>Low<FONT face="Courier New" 
  color=#6600aa>,swingsize),-<FONT face="Courier New" 
  color=#ff00ff>1<FONT face="Courier New" 
color=#6600aa>)-weeklyrange;
  Thresholdup=Ref<FONT 
  face="Courier New" color=#6600aa>(<FONT face="Courier New" 
  color=#0000ff>HHV<FONT face="Courier New" 
  color=#6600aa>(<FONT face="Courier New" 
  color=#000000>High<FONT face="Courier New" 
  color=#6600aa>,swingsize),-<FONT face="Courier New" 
  color=#ff00ff>1<FONT face="Courier New" 
color=#6600aa>)+weeklyrange;
  Linechangeup=<FONT face="Courier New" 
  color=#000000>High<FONT face="Courier New" 
  color=#6600aa>>Thresholdup;
  Linechangedown=<FONT face="Courier New" 
  color=#000000>Low<FONT face="Courier New" 
  color=#6600aa><thresholddown;
  z=Linechangedown;
  y=linechangeup;
  firstlinechangedown=<FONT face="Courier New" 
  color=#0000ff>LastValue<FONT face="Courier New" 
  color=#6600aa>(<FONT face="Courier New" 
  color=#0000ff>ValueWhen<FONT face="Courier New" 
  color=#6600aa>(z,Cum<FONT 
  face="Courier New" color=#6600aa>(<FONT face="Courier New" 
  color=#ff00ff>1),<FONT 
  face="Courier New" color=#ff00ff>1<FONT face="Courier New" 
  color=#6600aa>));
  firstlinechangeup=<FONT face="Courier New" 
  color=#0000ff>LastValue<FONT face="Courier New" 
  color=#6600aa>(<FONT face="Courier New" 
  color=#0000ff>ValueWhen<FONT face="Courier New" 
  color=#6600aa>(y,Cum<FONT 
  face="Courier New" color=#6600aa>(<FONT face="Courier New" 
  color=#ff00ff>1),<FONT 
  face="Courier New" color=#ff00ff>1<FONT face="Courier New" 
  color=#6600aa>));
  firstswingtop=Ref<FONT 
  face="Courier New" color=#6600aa>(<FONT face="Courier New" 
  color=#0000ff>HHV<FONT face="Courier New" 
  color=#6600aa>(<FONT face="Courier New" 
  color=#000000>High<FONT face="Courier New" 
  color=#6600aa>,(firstlinechangedown-firstlinechangeup)+<FONT 
  face="Courier New" color=#ff00ff>1<FONT face="Courier New" 
  color=#6600aa>),-(<FONT face="Courier New" 
  color=#0000ff>LastValue<FONT face="Courier New" 
  color=#6600aa>(Cum<FONT 
  face="Courier New" color=#6600aa>(<FONT face="Courier New" 
  color=#ff00ff>1<FONT face="Courier New" 
  color=#6600aa>))-firstlinechangedown));
  secondlinechangedown=<FONT face="Courier New" 
  color=#0000ff>LastValue<FONT face="Courier New" 
  color=#6600aa>(<FONT face="Courier New" 
  color=#0000ff>ValueWhen(z 
  AND<FONT 
  face="Courier New" color=#6600aa> <FONT face="Courier New" 
  color=#0000ff>Cum(<FONT 
  face="Courier New" color=#ff00ff>1<FONT face="Courier New" 
  color=#6600aa>)<<FONT face="Courier New" 
  color=#0000ff>LastValue<FONT face="Courier New" 
  color=#6600aa>(firstlinechangeup),<FONT face="Courier New" 
  color=#0000ff>Cum(<FONT 
  face="Courier New" color=#ff00ff>1<FONT face="Courier New" 
  color=#6600aa>),1<FONT 
  face="Courier New" color=#6600aa>));
  secondlinechangeup=<FONT face="Courier New" 
  color=#0000ff>LastValue<FONT face="Courier New" 
  color=#6600aa>(<FONT face="Courier New" 
  color=#0000ff>ValueWhen(y 
  AND<FONT 
  face="Courier New" color=#6600aa> <FONT face="Courier New" 
  color=#0000ff>Cum(<FONT 
  face="Courier New" color=#ff00ff>1<FONT face="Courier New" 
  color=#6600aa>)<<FONT face="Courier New" 
  color=#0000ff>LastValue<FONT face="Courier New" 
  color=#6600aa>(secondlinechangedown),<FONT face="Courier New" 
  color=#0000ff>Cum(<FONT 
  face="Courier New" color=#ff00ff>1<FONT face="Courier New" 
  color=#6600aa>),1<FONT 
  face="Courier New" color=#6600aa>));
  firstswingbottom=<FONT face="Courier New" 
  color=#0000ff>Ref(<FONT 
  face="Courier New" color=#0000ff>LLV<FONT face="Courier New" 
  color=#6600aa>(<FONT face="Courier New" 
  color=#000000>Low<FONT face="Courier New" 
  color=#6600aa>,(firstlinechangeup-secondlinechangedown)+<FONT 
  face="Courier New" color=#ff00ff>1<FONT face="Courier New" 
  color=#6600aa>),-(<FONT face="Courier New" 
  color=#0000ff>LastValue<FONT face="Courier New" 
  color=#6600aa>(Cum<FONT 
  face="Courier New" color=#6600aa>(<FONT face="Courier New" 
  color=#ff00ff>1<FONT face="Courier New" 
  color=#6600aa>))-firstlinechangeup));<FONT face="Courier New" 
  color=#6600aa>
  Filter<FONT face="Courier New" 
  color=#6600aa>=firstlinechangedown>firstlinechangeup <FONT 
  face="Courier New" color=#000000>AND<FONT face="Courier New" 
  color=#6600aa> MA<FONT 
  face="Courier New" color=#6600aa>(<FONT face="Courier New" 
  color=#000000>Volume<FONT face="Courier New" 
  color=#6600aa>,50<FONT 
  face="Courier New" color=#6600aa>)>=<FONT face="Courier New" 
  color=#ff00ff>20000<FONT face="Courier New" 
  color=#6600aa>;<FONT 
  face="Courier New" color=#0000ff>
  AddColumn(<FONT 
  face="Courier New" color=#0000ff>Cum<FONT face="Courier New" 
  color=#6600aa>(1<FONT 
  face="Courier New" color=#6600aa>), <FONT face="Courier New" 
  color=#ff00ff>"total bars"<FONT face="Courier New" 
  color=#6600aa>,1.0<FONT 
  face="Courier New" color=#6600aa>);<FONT face="Courier New" 
  color=#0000ff>
  AddColumn<FONT face="Courier New" 
  color=#6600aa>(firstswingtop,"1. 
  swing top",<FONT 
  face="Courier New" color=#ff00ff>1.2<FONT face="Courier New" 
  color=#6600aa>);
  AddColumn<FONT face="Courier New" 
  color=#6600aa>(firstlinechangeup,<FONT face="Courier New" 
  color=#ff00ff>"1dlcup"<FONT face="Courier New" 
  color=#6600aa>,1.1<FONT 
  face="Courier New" color=#6600aa>);<FONT face="Courier New" 
  color=#0000ff>
  AddColumn<FONT face="Courier New" 
  color=#6600aa>(firstlinechangedown,<FONT face="Courier New" 
  color=#ff00ff>"1dlcdown"<FONT face="Courier New" 
  color=#6600aa>,1.1<FONT 
  face="Courier New" color=#6600aa>);<FONT face="Courier New" 
  color=#0000ff>
  AddColumn<FONT face="Courier New" 
  color=#6600aa>(firstswingbottom,<FONT face="Courier New" 
  color=#ff00ff>"1. swing bottom"<FONT face="Courier New" 
  color=#6600aa>,1.2<FONT 
  face="Courier New" 
  color=#6600aa>);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. 
  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.



Attachment:
swingc~1.jpg

Attachment: Description: "Description: JPEG image"