PureBytes Links
Trading Reference Links
|
Thank you DT,
The problem is different. We need to know the value of tomorrow's Ct when
two OTHER arrays cross, NOT when the Ct crosses anything: Ct is not required
to touch any line. I do not know how to explain it better: the objective is
to know at what value of Ct the other two functions cross, i.e. find Ct when
a F1(Ct) touches F2(Ref(Array,-1)). This is probably a more useful
application than having the raw C touch any line because the C is subject to
a lot of noise and would give many false signals. I think your innovative
math functions provide the solution for this problem but i can't figure out
how, I hoped my code would illustrated the problem more clearly... Forgive
me if i am just plain dumb and the solution is staring at me.
Anyway, thanks very much for your time DT,
best regards,
herman.
-----Original Message-----
From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@xxxxxxxxx]
Sent: Tuesday, October 26, 2004 2:08 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: DT's Ct prediction for the Ti3
Herman,
The formula is correct and gives the next bar close Ct as a function
of tomorrow´s Ti3Ct.
When Ti3Ct value is known [or equal to another function] then Ct is
calculated.
For a simple verification, set
Ti3Ct=Ref(Ti3C,1);
and then Ct will be EXACTLY the Ref(C,1).
Plot(C,"C",colorBlack,1);
periods=5;s=0.7;f=2/(periods+1);R=1-f;
//the Ti3C
price=C;
e1C=EMA(price,periods);
e2C=EMA(e1C,Periods);
e3C=EMA(e2C,Periods);
e4C=EMA(e3C,Periods);
e5C=EMA(e4C,Periods);
e6C=EMA(e5C,Periods);
c1=-s*s*s;
c2=3*s*s+3*s*s*s;
c3=-6*s*s-3*s-3*s*s*s;
c4=1+3*s+s*s*s+3*s*s;
Ti3C=c1*e6C+c2*e5C+c3*e4C+c4*e3C;
Ti3Ct=Ref(Ti3C,1);// condition
//the Ct as a function of Ti3Ct
Ct=(Ti3Ct-R*(c1*(f^5*e1C+f^4*e2C+f^3*e3C+f^2*e4C+f*e5C+e6C)+c2*
(f^4*e1C+f^3*e2C+f^2*e3C+f*e4C+e5C)+c3*(f^3*e1C+f^2*e2C+f*e3C+e4C)+c4*
(f^2*e1C+f*e2C+e3C)))/(C1*f^6+C2*f^5+C3*f^4+C4*f^3) ;
Plot(Ref(Ct,-1),"Ct",colorRed,8);
Dimitris
--- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen"
<psytek@xxxx> wrote:
> Hello DT,
>
> I really appreciate your help with this however is that your
solution looks
> somewhat the same but isn't accurate...perhaps you misunderstood
and are
> calculating something else...
>
> The best way for me to illustrate my need is with a generic
iterative
> solution. Sorry to impose on you DT but to see how the result
differs you
> have to display both your solution and mine. When you have loaded
the demo
> code below, click on any bar and open the Param() window. Then
apply an
> offset to the selected close price until you see the two T3s (white
and
> black) cross, at that point the C price is exactly on the Predicted
Close
> price (Red). This is not the case with your formula. Note that I
moved the
> Red predicted value forward one bar to allow easier comparison to
the Close
> and show a little square when the target is hit. The key
requirement of
> course it that C falls exactly on the predicted value when the T3s
cross -
> this doesn't happen with your indicator.
>
> With EOD data and restricting the calculation to the display area
only, my
> solutions works OK, but i need a continuous indicator for the
entire data RT
> history, this means about 100K bars. If your formula worked it
would enable
> me to do that!!!
>
> Any change of making your solution match mine?
>
> thanks again DT,
> herman.
>
>
> --------------------------------------------------------------------
--------
> ----
>
> SetBarsRequired(1000000,1000000);
>
> function Ti3(array,p,s)
> {
> f=2/(p+1);
> e1=EMA(array,p);
> e2=EMA(e1,p);
> e3=EMA(e2,p);
> e4=EMA(e3,p);
> e5=EMA(e4,p);
> e6=EMA(e5,p);
> c1=-s*s*s;
> c2=3*s*s+3*s*s*s;
> c3=-6*s*s-3*s-3*s*s*s;
> c4=1+3*s+s*s*s+3*s*s;
> T3=c1*e6+c2*e5+c3*e4+c4*e3;
> return T3;
> }
>
> function ReferenceFunction( ReferenceArray )
> {
> global T3Periods, T3Sensitivity, ResetReference;
> R = Ti3( ReferenceArray, T3Periods ,T3Sensitivity);
> return R;
> }
>
> function TestFunction( TestArray )
> {
> global T3Periods, T3Sensitivity, ResetReference;
> R = Ti3( TestArray, T3Periods ,T3Sensitivity);
> return R;
> }
>
> function GetTriggerPrice( ReferenceArray, TestArray, TestBarNum,
T3Period,
> T3Sensitivity )
> {
> Precision = 0.0001;
>
> RefArray = ReferenceFunction( ReferenceArray );
> RefValue = RefArray[TestBarNum ];
>
> TestValue = TestArray[TestBarNum];
> TestIncr = TestValue/3;
>
> do {
> TestArray[TestBarNum ] = TestValue;
> T3t = TestFunction( TestArray);
> TodaysT3 = T3t[TestBarNum ];
> if( abs(TodaysT3-RefValue) < Precision );
> else if(TodaysT3< RefValue) TestValue= TestValue+ TestIncr ;
> else TestValue= TestValue- TestIncr ;
> TestIncr = TestIncr /2;
> Error = abs(TodaysT3- RefValue);
> } while ( Error > Precision );
>
> return TestArray[TestBarNum ];
> }
>
> PriceOffSet = Param("Price offset",0,-2,2,0.001);
> BarNum = SelectedValue(BarIndex());
> CursorBar = BarNum == BarIndex();
> ParamPrice = C + PriceOffSet;
> C = IIf(CursorBar, ParamPrice, C);
> ReferenceArray = Ref(H,-1);
> TestArray = C;
> T3Periods = 3;
> T3Sensitivity = 0.7;
>
> FirstVisibleBar = Status( "FirstVisibleBar");
> Lastvisiblebar = Status("LastVisibleBar");
> TP=Null;
> for( b = Firstvisiblebar; b < Lastvisiblebar AND b < BarCount; b++)
> {
> TP[b] = GetTriggerPrice( ReferenceArray, TestArray, b, T3Periods,
> T3Sensitivity );
> }
>
> TargetHit = IIf(abs(C-TP) < 0.01,1,Null);
> Plot(C,"C",1,128);
> Plot(Ti3( ReferenceArray,
T3Periods ,T3Sensitivity),"ReferenceArray",1,1);
> Plot(Ti3( TestArray, T3Periods ,T3Sensitivity),"TestArray",2,1);
> PlotShapes(TargetHit*shapeHollowSquare,9,0,TP,0);
> Plot(TP,"TP",4,1);
>
> --------------------------------------------------------------------
--------
> ----
>
>
>
>
>
> -----Original Message-----
> From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...]
> Sent: Monday, October 25, 2004 3:04 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: DT's Ct prediction for the Ti3
>
>
>
> Herman,
> As I wrote in previous post, Ct is a function of Ti3Ct [and vice
> versa]
> In your example, Ti3C and Ti3H should be calculated separately, to
> avoid any confusion.
> The expected next bar Close Ct would be
>
> Plot(C,"C",colorBlack,8);
> periods=5;s=0.7;f=2/(periods+1);R=1-f;
> //the Ti3H
> price=H;
> e1H=EMA(price,periods);
> e2H=EMA(e1H,Periods);
> e3H=EMA(e2H,Periods);
> e4H=EMA(e3H,Periods);
> e5H=EMA(e4H,Periods);
> e6H=EMA(e5H,Periods);
> c1=-s*s*s;
> c2=3*s*s+3*s*s*s;
> c3=-6*s*s-3*s-3*s*s*s;
> c4=1+3*s+s*s*s+3*s*s;
> Ti3H=c1*e6H+c2*e5H+c3*e4H+c4*e3H;
> //Plot(Ti3H,"Ti3H",1,1);
> //the Ti3C
> price=C;
> e1C=EMA(price,periods);
> e2C=EMA(e1C,Periods);
> e3C=EMA(e2C,Periods);
> e4C=EMA(e3C,Periods);
> e5C=EMA(e4C,Periods);
> e6C=EMA(e5C,Periods);
> Ti3C=c1*e6C+c2*e5C+c3*e4C+c4*e3C;
> //Plot(Ti3C,"Ti3C",2,1);
> Ti3Ct=Ti3H;//your condition:the next bar Ti3C is equal to todays
Ti3H
> //the Ct as a function of Ti3Ct
> Ct=(Ti3Ct-R*(c1*(f^5*e1C+f^4*e2C+f^3*e3C+f^2*e4C+f*e5C+e6C)+c2*
> (f^4*e1C+f^3*e2C+f^2*e3C+f*e4C+e5C)+c3*(f^3*e1C+f^2*e2C+f*e3C+e4C)
+c4*
> (f^2*e1C+f*e2C+e3C)))/(C1*f^6+C2*f^5+C3*f^4+C4*f^3) ;
> Plot(Ct,"Ct",colorRed,8);
>
> For periods>10 the condition is quite rare.
> Dimitris
> --- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen"
> <psytek@xxxx> wrote:
> > In my requirements there is only one unknown, the next day Ct as
> the other
> > Ti3 was using the previous bar's value. The equation is
solvable by
> > iteration however it is too slow for Real Time data, where in a
> backtests i
> > want to process 100,000 bars. The problem could also be stated,
> since both
> > Ti3s have the same value when crossing, and assigning arbitrary
> familiar
> > price arrays to Array1 and Array2, as:
> >
> > Ti3( ref(H,-1), period, sensitivity ) = Ti3( C, period,
> sensitivity )
> >
> > and solving for C. In this equation C is the only unknown
because H
> is
> > yesterday's known value. Your earlier solutions are close to
this
> but i
> > haven't been able to modify them to this requirement. Note that
> periods and
> > sensitivities are the same on both sides of the equation.
> >
> > Best regards,
> > herman
> >
> >
> > -----Original Message-----
> > From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...]
> > Sent: Monday, October 25, 2004 6:58 AM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] Re: DT's Ct prediction for the Ti3
> >
> >
> >
> > To be more specific:
> > Ti3t, the next bar Ti3 of an array, is ALWAYS a [known]
function
> of
> > the next bar array value arrayt.
> > Arrayt is NOT ALWAYS a [known] function of the next bar Close
Ct.
> > Dimitris
> > PS : If you could be more specific about array1, array2 we
could
> > probably come to some result...
> > --- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen"
> > <psytek@xxxx> wrote:
> > > Thank you Dt.
> > >
> > > herman
> > > -----Original Message-----
> > > From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...]
> > > Sent: Monday, October 25, 2004 6:41 AM
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Subject: [amibroker] Re: DT's Ct prediction for the Ti3
> > >
> > >
> > >
> > > Herman,
> > > There is no answer for this general question.
> > > Some arrays may be RevEnged [RSI, Ti3], some others not
> [StochD].
> > > The next bar RSI is a function of the next bar Close Ct,
the
> next
> > bar
> > > StochD is [unfortunately] a function of Ht, Lt and Ct.
> > > Dimitris
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen"
> > > <psytek@xxxx> wrote:
> > > > Thank you DT, I tried this code but it requires that pb
is
> > greater
> > > than pa
> > > > and also it uses C in both Ti3s. I am looking for a
sulution
> > where
> > > pa==pb
> > > > and we use different price arrays.
> > > >
> > > > best regards,
> > > > herman
> > > >
> > > >
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...]
> > > > Sent: Monday, October 25, 2004 1:57 AM
> > > > To: amibroker@xxxxxxxxxxxxxxx
> > > > Subject: [amibroker] Re: DT's Ct prediction for the
Ti3
> > > >
> > > >
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "Herman van den
Bergen"
> > > > <psytek@xxxx> wrote:
> > > > > DT, I am not sure i understand the Ti3t... what i am
> trying
> > to
> > > find
> > > > out is
> > > > > what tomorrows closing price would be to cause the
> crossing
> > of
> > > two
> > > > Ti3
> > > > > functions.
> > > >
> > > > Herman,
> > > > this specific question is already in
> > > > http://finance.groups.yahoo.com/group/amibroker-
> ts/files/A%
> > 20Ti3%
> > > > 20application/
> > > > "Cross(Ti3a,Ti3b) predictions.txt"
> > > > Dimitris
> > > > For example:
> > > > >
> > > > > F1 = T3( Array1, 3, 0.8 );
> > > > > F2 = T3( ref(Array2,-1), 3, 0.8 );
> > > > >
> > > > > Array1 and Array2 are two different arrays and
could be
> any
> > > type of
> > > > > indicator array. For development you can plug in
any of
> the
> > OHLC
> > > > arrays, but
> > > > > you cannot use the same price array for both
function
> > calles.
> > > > > The Periods and Sensitivities are the same for both
T3
> > function
> > > > calls.
> > > > > F2 is based on yesterdays values, F1 is based on
todays
> > values.
> > > > > I would like to calculate tomorrows value for Array1
> that
> > would
> > > > cause the
> > > > > two functions to cross: cross(F1, F2).
> > > > >
> > > > > Do you think this is possible?
> > > > >
> > > > > thanks for you help DT!
> > > > > herman
> > > > > -----Original Message-----
> > > > > From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...]
> > > > > Sent: Saturday, October 23, 2004 5:34 AM
> > > > > To: amibroker@xxxxxxxxxxxxxxx
> > > > > Subject: [amibroker] Re: DT's Ct prediction for
the
> Ti3
> > > > >
> > > > >
> > > > >
> > > > > Herman,
> > > > > Ti3t (the next bar Ti3) is a direct function of
the
> next
> > bar
> > > > Close Ct.
> > > > > Ti3t=
> > > > > c1*(f*(f*(f*(f*(f*(f*Ct+(1-f)*e1)+
> > > > > (1-f)*e2)+(1-f)*e3)+(1-f)*e4)+(1-f)*e5)+(1-f)*e6)+
> > > > > c2*(f*(f*(f*(f*(f*Ct+(1-f)*e1)+(1-f)*e2)+(1-f)*e3)
+
> > > > > (1-f)*e4)+(1-f)*e5)+
> > > > > c3*(f*(f*(f*(f*Ct+(1-f)*e1)+(1-f)*e2)+(1-f)*e3)+
(1-f)
> *e4)+
> > > > > c4*(f*(f*(f*Ct+(1-f)*e1)+(1-f)*e2)+(1-f)*e3);
> > > > > If I understand your question, you want to solve
Ct
> for
> > any
> > > given
> > > > > Ti3t.
> > > > > Let me know and I will do it.
> > > > > Dimitris
> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "Herman van den
> Bergen"
> > > > > <psytek@xxxx> wrote:
> > > > > > Hello,
> > > > > >
> > > > > > 'been looking at DT's Ct formula (nice work!) to
> predict
> > > where
> > > > > tomorrow's
> > > > > > Close will touch the Ti3 - see code below. Can
> anybody
> > see a
> > > > way to
> > > > > use this
> > > > > > formula to predict the Close of tomorrow needed
to
> have
> > the
> > > Ti3
> > > > > touch any
> > > > > > arbitrary point? For example a point on another
> > indicator.
> > > > > >
> > > > > > My math is not up to this, any help would be
> > appreciated!
> > > > > >
> > > > > > herman.
> > > > > >
> > > > > > p=3;s=0.84;f=2/(p+1);
> > > > > > // Ti3
> > > > > > e1=EMA(C,p);
> > > > > > e2=EMA(e1,p);
> > > > > > e3=EMA(e2,p);
> > > > > > e4=EMA(e3,p);
> > > > > > e5=EMA(e4,p);
> > > > > > e6=EMA(e5,p);
> > > > > > c1=-s*s*s;
> > > > > > c2=3*s*s+3*s*s*s;
> > > > > > c3=-6*s*s-3*s-3*s*s*s;
> > > > > > c4=1+3*s+s*s*s+3*s*s;
> > > > > > Ti3=c1*e6+c2*e5+c3*e4+c4*e3;
> > > > > > //The value of tomorrow´s Close Ct that touches
> > tomorrow´s
> > > Ti3
> > > > is
> > > > > > Ct=
> > > > > > (1-f)*((c1*f^5+c2*f^4+c3*f^3+c4*f^2)*e1+
> > > > (c1*f^4+c2*f^3+c3*f^2+c4*f)
> > > > > *e2+(c1*f
> > > > > > ^3+c2*f^2+c3*f+c4*1)*e3+(c1*f^2+c2*f+c3*1)*e4+
> > (c1*f+c2*1)
> > > > *e5+c1*e6)/
> > > > > (1-(C1*f
> > > > > > ^6+C2*f^5+C3*f^4+C4*f^3)) ;//relation III
> > > > > > Plot(C,"Close",1,128);
> > > > > > Plot(Ti3,"Ti3",4,1);
> > > > > > Plot(Ct,"Ct",2,1);
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Check AmiBroker web page at:
> > > > > http://www.amibroker.com/
> > > > >
> > > > > Check group FAQ at:
> > > > >
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > >
> > > > >
> > > > > Yahoo! Groups Sponsor
> > > > > ADVERTISEMENT
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ----------------------------------------------------
----
> ----
> > ----
> > > ----
> > > > --------
> > > > > --
> > > > > Yahoo! Groups Links
> > > > >
> > > > > a.. To visit your group on the web, go to:
> > > > > http://groups.yahoo.com/group/amibroker/
> > > > >
> > > > > b.. To unsubscribe from this group, send an
email
> to:
> > > > > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > > > >
> > > > > c.. Your use of Yahoo! Groups is subject to the
> Yahoo!
> > > Terms of
> > > > Service.
> > > > >
> > > > >
> > > > >
> > > > > [Non-text portions of this message have been
removed]
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Check AmiBroker web page at:
> > > > http://www.amibroker.com/
> > > >
> > > > Check group FAQ at:
> > > >
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > >
> > > >
> > > > Yahoo! Groups Sponsor
> > > > ADVERTISEMENT
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --------------------------------------------------------
----
> ----
> > ----
> > > --------
> > > > --
> > > > Yahoo! Groups Links
> > > >
> > > > a.. To visit your group on the web, go to:
> > > > http://groups.yahoo.com/group/amibroker/
> > > >
> > > > b.. To unsubscribe from this group, send an email
to:
> > > > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > > >
> > > > c.. Your use of Yahoo! Groups is subject to the
Yahoo!
> > Terms of
> > > Service.
> > > >
> > > >
> > > >
> > > > [Non-text portions of this message have been removed]
> > >
> > >
> > >
> > >
> > >
> > > Check AmiBroker web page at:
> > > http://www.amibroker.com/
> > >
> > > Check group FAQ at:
> > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > >
> > >
> > > Yahoo! Groups Sponsor
> > > ADVERTISEMENT
> > >
> > >
> > >
> > >
> > >
> > > ------------------------------------------------------------
----
> ----
> > --------
> > > --
> > > Yahoo! Groups Links
> > >
> > > a.. To visit your group on the web, go to:
> > > http://groups.yahoo.com/group/amibroker/
> > >
> > > b.. To unsubscribe from this group, send an email to:
> > > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > >
> > > c.. Your use of Yahoo! Groups is subject to the Yahoo!
> Terms of
> > Service.
> > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> >
> >
> >
> >
> >
> > Check AmiBroker web page at:
> > http://www.amibroker.com/
> >
> > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >
> >
> > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> >
> >
> >
> >
> >
> > ----------------------------------------------------------------
----
> --------
> > --
> > Yahoo! Groups Links
> >
> > a.. To visit your group on the web, go to:
> > http://groups.yahoo.com/group/amibroker/
> >
> > b.. To unsubscribe from this group, send an email to:
> > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> >
> > c.. Your use of Yahoo! Groups is subject to the Yahoo!
Terms of
> Service.
> >
> >
> >
> > [Non-text portions of this message have been removed]
>
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
>
>
>
>
>
> --------------------------------------------------------------------
--------
> --
> Yahoo! Groups Links
>
> a.. To visit your group on the web, go to:
> http://groups.yahoo.com/group/amibroker/
>
> b.. To unsubscribe from this group, send an email to:
> amibroker-unsubscribe@xxxxxxxxxxxxxxx
>
> c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
>
> [Non-text portions of this message have been removed]
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor
ADVERTISEMENT
----------------------------------------------------------------------------
--
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
b.. To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|