Ok,
two questions:
How
does one scale the chart "as a default programmatically" to a 1:1
scale ratio, just like graph paper?
How does one calculate the degree angle of a moving
average?
I
tried using 4 points but I can't seem to figure out what the LineArray() is
asking for...
It
errors out on me...
/*EMA Angle */
Var = Close;
START= 34;
END= 1;
ARRAY= Var ;
//L1=LastValue(Cum(1));
L1= EMA(C,34);
START = Ref(EMA(C,34),-34);
END = EMA(C,34);
//X0=L1- START;
//X1=L1 - END;
//Y0=ARRAY[X0];
//Y1=ARRAY[X1];
ARRAY = EMA(C,34);
Plot (Close,"Close",1,128);
//Plot(ARRAY,"",2,1);
Plot (LineArray(X0,Y0,X1,Y1),"",4,1);
Plot (LineArray(X0,Y0,X1,Y0),"",4,1);
Plot (Y0,"",10,1);
Plot (Y1,"",11,1);
Plot (X0,"",10,1);
Plot (X1,"",11,1);
ANGLE= atan((Y1-Y0)/(X1-X0));
Title= "ANGLE="+WriteVal(ANGLE)+" RADS"+", ["+WriteVal(45*ANGLE/atan(1),1.0)+" DEGREES]";
Hello,
Please note that "visual angle" has nothing to do with the
"angle" you are computing using your formula.
What you are doing in the formula is to calculate "angle"
from chart that has completely *different* X/Y units.
The X unit is time , the Y unit is price. These two can not
give you ANGLE. Angle can only be given
if you have *SAME* units for X and Y. Therefore the concept
of "angle" in TIME vs PRICE chart is flawed from the start.
The reason why you are getting non-zero for *JPY currencies
is simply because delta Y is in range 30-40
so it "corresponds" with 34 bars you have
selected.
Now if you apply the formula to say EURUSD the y delta will
be in 0.01 range so you will divide 0.01 $/ 34 and the
"angle" will be close to zero.
The "visual angle" you see on the chart is the result
of scaling. Again note that X and Y units are completely
unrelated
(time vs price) so to fill the window area you need to apply
the scaling.
The scaling is different when
a) your window size changes
b) you zoom in/zoom out
c) display symbol with different min Y max Y dynamic
range
Happy Thanksgiving.
Best regards, Tomasz Janeczko amibroker.com
----- Original Message -----
Sent: Thursday, November 22, 2007 8:13
AM
Subject: FW: [AmiBroker] Array
Problem
Chart3 is a better one it looks like about 40
degrees, but it sure isn't zero.
Is
there something in the Precision as it is on FX symbol?
I
tried SetBarsRequired and that didn't do it, but it can't be
right.
See attached.
TJ,
Yes and indeed both "work", but the subtle difference is that that
in the title line on the CCI(20) it will display the angle and degrees
whereas the other does not and displays 0 on my end...
Do they both display the values on your end?
Thanks for the reply and Happy Thanksgiving to you and
yours.
Mr. Valley
Both work OK on my end. Do you have at least 54 bars
in your data set ?
Best regards, Tomasz Janeczko amibroker.com
----- Original Message -----
Sent: Thursday, November 22, 2007
7:25 AM
Subject: [amibroker] Array
Problem
resend with subject line
What am I doing
wrong?
/* Angle Test v2
*/
// I don't understand why the
array created by "Var" cannot be used as CCI(20) built-in works
??? // Comment out the Var below and use the other to see what I
mean. // Angle and Degrees don't read in the Title Line like they
do with CCI(20)
Var = CCI(20); //
Comment out this line //Var =
MA(C,20);Plot(Var,"",1,128); // Uncomment and try this line
instead
START=34;END=1; ARRAY= Var
; L1=LastValue(Cum(1)); X0=L1-START; X1=L1-END; Y0=ARRAY[X0]; Y1=ARRAY[X1]; ANGLE=atan((Y1-Y0)/(X1-X0)); Color
= IIf(Y1 > Y0,5,4); // Green
= Positive Red =
Negative Title1="ANGLE="+WriteVal(ANGLE)+"
RADS"+", ["+WriteVal(45*ANGLE/atan(1),1.0)+"
DEGS]"; Plot(ARRAY,"",12,1); Plot(LineArray(X0,Y0,X1,Y1),Title1
+ "\nLine to Last Value of End Point Value",Color
,1); Plot(LineArray(X0,Y0,X1,Y0),"Horizontal",2,1); Plot(LastValue(Y0),"\nBegin
at This point in the Array",10,1);
Thanks,
Mr.
Valley
__._,_.___
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
__,_._,___
|