PureBytes Links
Trading Reference Links
|
Hi Erkan,
I unfortunately don't know the other
programming
language. Therefore there are
still many question open.
For example the functionality of the
following functions
is unknown to AB:
StdDevSAnnualized(...)
ExtremePrice(...)<FONT
face="Times New Roman"> <FONT
face="Times New Roman">MinList()
I think I saw this in an issue of TASC. Maybe you
should
post a link to the original work. But, I must admit,
I personally don't have the time to convert the program
into AFL, but maybe someone else
will find it an interessting
challenge.
The idea is not bad, but it is more a graphical
programming,
which is not my strength. On the other hand, for me
personally
a calculated probability number (not plotting) for only
tommorrow would be
sufficient. Because this could be further
used in the decision making within a system.
The graphical "nice"(?)
picture plot I saw in the article IMHO didn't look much
usable (for me).
But the general idea is not that bad.
IMHO using Linear Regression (LR) <FONT
face=Arial>estimate or TimeSeriesForecast (TSF)
estimate of both the price <FONT
face=Arial>and the mean price will be much
easier
and IMHO better. The analysis of the estimates of
these numbers
and their rate, relative
movement etc. will allow to calculate such
probabilities.
But one drawback is that you need the "Estimate"
functionality of LR/TSF.
I'm not sure if they are available in AFL; In such cases
I'm using my own
C++ LR source from within an AB
pluging of my own, since in C++ I've full
access to the LR
algorithm. Of course same is true with the TSF
algorithm.
So, to make a long story short: what do you expect from
the code you
presented? Are you interessted in a probability
number for the next day's
outcome based on LR or TSF (or
both combined) or do you want a
graphical
plot of this on the chart as much like in the
article?
UM
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
ERKAN BISEVAC
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Wednesday, April 30, 2003 4:11
AM
Subject: Re: [amibroker] CONES
Hi UM,
I just came back home after 3 days.
This is code from trade station
{Input definitions:VolatilityLength in the modified code is the ratio
of look-a-head days divided by trading days(252) in a year or all
days(365) in a year. For example use VolatilityLength(30/252) for a 30
day lookahead using trading days. SD(#)= number of standard
deviations for top and bottom of the ProbMapND. SD(1) captures
prices 68% of the time.SD(2) captures prices 95% of the time. SD(3)
captures prices 99.7 of the time. VIX(c of data2) is to provide
an implied volatility input from your datafeed or from a manual inputwhen
doing "what if" types of studies. For example if you want to assume the
market goes into a nosediveand implied volatility rises to 50 then use
VIX(50) instead of VIX(c of data2). PriceRows(#) determines the
number of horizontal lines in the map.BarColumns(#) determines the number
of price bars used in the map. Format Window Bars to Right to "see" into
the future.
********************************************************************} Inputs:
VolatilityLength(30/252),SD(2),VIX(c of data2), PriceRows(75),
BarColumns(75);Variables: Count(0), PriceLevel(0), RowHeight(0),
MapTop(0), MapBottom(0), VolatilitySDev(0), Probability(0),
UseLog(True); {VolatilitySDev =
StdDevSAnnualized(ExtremePrice(2,UseLog),VolatilityLength);}VolatilitySDev
= SD*(0.01*VIX)*squareroot(volatilitylength); If CurrentBar>=
1 Then Begin MapTop = Close + (Close *
VolatilitySDev); MapBottom = Close - (Close *
VolatilitySDev); RowHeight = (MapTop - MapBottom) /
PriceRows; Count =
1; PM_SetLow(MapBottom); PM_SetHigh(MapTop); PM_SetRowHeight(RowHeight); PM_SetNumColumns(BarColumns);
While Count <= BarColumns Begin PriceLevel =
MapBottom; While PriceLevel < MapTop Begin
If PriceLevel < Close Then
Probability = ProbBelow(PriceLevel, Close, VolatilitySDev, Count) *
100 Else Probability =
ProbAbove(PriceLevel, Close, VolatilitySDev, Count) * 100;
PM_SetCellValue(Count, PriceLevel, Probability); PriceLevel =
PriceLevel + RowHeight; End; Count = Count +
1; End; End;
ProbAbove
<FONT
face=Arial>PriceTarget=1;CurrentPrice=1;VltyVal=1;BarsToGo=1;e=2.71828;
If MinList(PriceTarget, CurrentPrice, VltyVal, BarsToGo) <= 0
Then ProbBelow = 0ElseBeginVlty = VltyVal *
Sqrt(BarsToGo/(BarAnnualization^2));PriceRatio = Log(PriceTarget /
CurrentPrice);
If (Vlty <> 0) Then RawProb = PriceRatio /
Vlty; z1 = .3989423 *
(e^(-(RawProb^2)*.5); y1 =
1 / (1 + .23166419 *
Abs(RawProb)); x1 = 1 - z1
* ((1.33027443 * (y1^5)) - (1.821256 * (y1^4)) + (1.78147794 *
(y1^3)) - (.3565638 * (y1^2)) + (.31938153 * y1)); If
RawProb > 0 Then ProbBelow =
x1 Else ProbBelow = 1 - x1;ProbAbove = 1 -
ProbBelow;ProbBetween = ProbBelow - ProbBelow;
ProbBelow
Inputs: PriceTarget(Numeric), CurrentPrice(Numeric), VltyVal(Numeric),
BarsToGo(Numeric);Variables: PriceRatio(0), Vlty(0), RawProb(0),
e(2.71828), z1(0), y1(0), x1(0);
If MinList(PriceTarget, CurrentPrice, VltyVal, BarsToGo) <= 0
Then ProbBelow = 0ElseBegin Vlty = VltyVal *
SquareRoot(BarsToGo/Square(BarAnnualization)); PriceRatio =
Log(PriceTarget / CurrentPrice);
If Vlty <> 0 Then RawProb = PriceRatio /
Vlty; z1 = .3989423 * Power(e, -Square(RawProb)*.5); y1 = 1
/ (1 + .23166419 * AbsValue(RawProb)); x1 = 1 - z1 * ((1.33027443 *
Power(y1, 5)) - (1.821256 * Power(y1, 4)) + (1.78147794 *
Power(y1, 3)) - (.3565638 * Power(y1, 2)) + (.31938153 *
y1)); If RawProb > 0 Then ProbBelow =
x1 Else ProbBelow = 1 - x1;
Thanks,
ErkanEnd;
uenal.mutlu@xxxxxxxxxxx wrote:
<BLOCKQUOTE
>
Hi, did you unterstand what the
syntax error message says?
At some places you have to use
the subscript operator (ie. myarray[i])
No, sorry, I don't have time to fix bugs, esp. of code
without any
explanation what it supposed to do. Shall I guess
and try the zillion
possibilities the coder could have meant?
Sorry, more explanation is required if you want it be
fixed by anyone.
UM
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
ERKAN
BISEVAC
To: <A
title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Saturday, April 26, 2003 5:40
AM
Subject: Re: [amibroker] CONES
UM
Can you show me how to fix it?
Thanks
Erkan<A
href="">uenal.mutlu@xxxxxxxxxxx
wrote:
<BLOCKQUOTE
>
Hi Erkan,
the syntax error says:
Condition in IF, WHILE, FOR
statements has to be Numeric or Boolean type. You
can not use array here, please use [] (array subscript
operator) to access array elements
UM
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
ERKAN
BISEVAC
To: <A
title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Saturday, April 26, 2003
1:51 AM
Subject: [amibroker] CONES
<BLOCKQUOTE
>
I am trying to translate one indicator but it's not working.
Can somebody look at this, please.
Thanks
Erkan
VolatilityLength=<FONT
color=#ff00ff size=1>30<FONT color=#000000
size=1>/252<FONT
color=#000000 size=1>;
SD=2<FONT color=#000000
size=1>;
VIX=Foreign<FONT
color=#000000 size=1>(<FONT color=#ff00ff
size=1>"^Vix",<FONT
color=#ff00ff size=1>"C");
PriceRows=75<FONT
color=#000000 size=1>;
BarColumns=75<FONT
color=#000000 size=1>;
VolatilitySDev = SD*(<FONT color=#ff00ff
size=1>0.01*VIX)*<FONT
color=#0000ff size=1>sqrt<FONT color=#000000
size=1>(volatilitylength);
MT = Close + (Close * VolatilitySDev);
MB = Close - (Close * VolatilitySDev);
RH = (MapTop - MapBottom) / PriceRows;
<FONT face="Courier New" color=#000000
size=1>CL=Close;
<FONT color=#000000
size=1>
for(<FONT face="Courier New" color=#000000
size=1>I=<FONT
color=#ff00ff size=1>1<FONT color=#000000
size=1>;<FONT face="Courier New" color=#000000
size=1>i<=<FONT
face="Courier New" color=#000000 size=1>BARCOLU<FONT
color=#000000 size=1>mns;<FONT face="Courier New"
color=#000000 size=1>i++)
{
PriceLevel = M<FONT face="Courier New" color=#000000
size=1>B[I];
while (PriceLevel < MT<FONT face="Courier New"
color=#000000 size=1>[I])
{
if (PriceLevel < C<FONT face="Courier New"
color=#000000 size=1>L[I])
Probability = 1<FONT
face="Courier New" color=#000000 size=1>;
<FONT face=Arial
size=3><FONT face=Arial
size=3>
else
{
Probability = .5;
}
<FONT face=Arial
size=3>
Plot<FONT color=#000000
size=1>(PriceLevel*(1<FONT
color=#000000 size=1>-Probability),<FONT color=#ff00ff
size=1>"UP",<FONT
color=#ff00ff size=1>1<FONT color=#000000
size=1>,1<FONT
color=#000000 size=1>);
Plot<FONT color=#000000
size=1>(PriceLevel*(1<FONT
color=#000000 size=1>+Probability),<FONT color=#ff00ff
size=1>"UP",<FONT
color=#ff00ff size=1>1<FONT color=#000000
size=1>,1<FONT
color=#000000 size=1>);
PriceLevel = PriceLevel + RH<FONT face="Courier New"
color=#000000 size=1>[I];
}
}
<FONT face=Arial
size=3>
Yahoo! Groups Sponsor
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
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.
|