# Traders' Tips from TASC Magazine

### Affine transformation

sx:=Input("date of first point [ mmddyyyy ]",1,12350000,1032000);
sxt:=Input("intraday time of first point[ 24 hour - hhmm ]",0,2460,0);
ex:=Input("date of second point [ mmddyyyy ]",1,12350000,1032001);
ext:=Input("intraday time of second point[ 24 hour - hhmm ]",0,2460,0);
prs:=Input("scaling factor for slope calculation",1,100000,1);
ops:=Input("shift value for affine display",0,100000,0);

sdt:= (Month()=Int(sx/1000000)) AND (DayOfMonth()=Rnd(Frac(Int(sx/10000)/100)*100)) AND (Year()=Rnd(Frac(sx/10000)*10000)) AND (Hour()= Int(sxt/100)) AND (Minute()=Rnd(Frac(sxt/100)*100));

edt:=Month()=Int(ex/1000000) AND DayOfMonth()=Rnd(Frac(Int(ex/10000)/100)*100) AND Year()=Rnd(Frac(ex/10000)*10000) AND (Hour()= Int(ext/100)) AND (Minute()=Rnd(Frac(ext/100)*100));

rise:=LastValue((ValueWhen(1,edt,C)-ValueWhen(1,sdt,C))*prs);
run:=LastValue(ValueWhen(1,edt,Cum(1))-ValueWhen(1,sdt,Cum(1)));
sl:=rise/run;
tr:=((C-LastValue(ValueWhen(1,sdt,C)))-(Cum(1)-LastValue(ValueWhen(1,sdt,Cum(1))))*sl);
tr+ops