PureBytes Links
Trading Reference Links
|
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@xxxxxxxxx]
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]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/
|