PureBytes Links
Trading Reference Links
|
Markus, Try this: Value1=Valuewhen(h==firstswingtop,cum(1),1) and Value2=Valuewhen(l==firstswingbottom,cum(1),1) Value3=valuewhen(value1==cum(1), cum(1),1) and value4=valuewhen(value2==cum(1),cum(1),1)
Anthony
-------Original Message-------
From: amibroker@xxxxxxxxxxxxxxx
Date: Monday, February 17, 2003 11:20:27 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Can´t detect proper cum values - TJ please read
Jayson,
I thought about what you said.
The variables "firstswingtop" and "firstswingbottom" are try only once in the chart (this is why I callend the FIRST; the next occurence would be secondswingbottom and secondswingtop etc.).
And since they occur only once in the chart, I thought it couldn´t be such a problem to find their respective cum values.
What puzzles me is that the conditions return the proper high value (for firstswingtop) and the proper low value (for firstswingtbottom). so, I figured that if the high value hits firstswingtop value for the first time, this cum value could be returned by using valuewhen function (analogue for firstswingbottom).
Do you know what I mean? If you ran the code in explore mode, you´ll be given one single value for each condition.
Markus
----- Original Message -----
From: Jayson
To: amibroker@xxxxxxxxxxxxxxx
Sent: Monday, February 17, 2003 4:46 PM
Subject: RE: [amibroker] Can´t detect proper cum values - TJ please read
Markus,
I do not know how you calculated firstswing but have you tried...
Value1=Valuewhen(firstswingtop,cum(1),1) and
Value2=Valuewhen(firstswingbottom,cum(1),1)
In your original cum(1) would be returned for the last time High was equal to your trigger if this number occurs several times than your cum(1) could be misrepresented......
Jayson
-----Original Message-----From: funnybiz@xxxxxx [mailto:funnybiz@xxxxxx]Sent: Monday, February 17, 2003 10:05 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Can´t detect proper cum values - TJ please read
TJ,
I´m trying to retrieve the cum values for the two variable below clled "firstswingtop" and "firstswingbottom". I sent the complete code so that you understand what those two variable are made up of.
I figured that the cum values were this
Value1=Valuewhen(h==firstswingtop,cum(1),1) and
Value2=Valuewhen(l==firstswingbottom,cum(1),1)
but I aly get the last bars cum value. Why is that since the conditions above can´t apply to this very last bar????????
I´m really puzzled, since firstswingtop and firstswingbottom detect the right high and low values ;-))
Markus
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
swingsize=5;
weeklyrange=(Ref(HHV(High,swingsize),-1)-Ref(LLV(Low,swingsize),-1))*0.1;
Thresholddown=Ref(LLV(Low,swingsize),-1)-weeklyrange;
Thresholdup=Ref(HHV(High,swingsize),-1)+weeklyrange;
Linechangeup=High>Thresholdup;
Linechangedown=Low<thresholddown;
z=Linechangedown;
y=linechangeup;
firstlinechangedown=LastValue(ValueWhen(z,Cum(1),1));
firstlinechangeup=LastValue(ValueWhen(y,Cum(1),1));
firstswingtop=Ref(HHV(High,(firstlinechangedown-firstlinechangeup)+1),-(LastValue(Cum(1))-firstlinechangedown));
secondlinechangedown=LastValue(ValueWhen(z AND Cum(1)<LastValue(firstlinechangeup),Cum(1),1));
secondlinechangeup=LastValue(ValueWhen(y AND Cum(1)<LastValue(secondlinechangedown),Cum(1),1));
firstswingbottom=Ref(LLV(Low,(firstlinechangeup-secondlinechangedown)+1),-(LastValue(Cum(1))-firstlinechangeup));
Filter=firstlinechangedown>firstlinechangeup;
AddColumn(Cum(1), "total bars",1.0);
AddColumn(firstswingtop,"1. swing top",1.2);
AddColumn(firstswingbottom,"1. swing bottom",1.2);
AddColumn(MA(Volume,50),"50DMA Vol.",1.2);
AddColumn(Close, "last close",1.2);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. 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. 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.
____________________________________________________ IncrediMail - Email has finally evolved - Click Here
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.
Attachment:
Description: ""
|