[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] CONES



PureBytes Links

Trading Reference Links

Then you would need to draw a * Horizontal-axis Parabola with its Vertex at
the left *, 
connecting these top and bottom values....( as shown in the attached image )
.....
 
I had asked for help with this over a year ago...specifically I asked
Dimitri....because he is great with 
producing graphical output and  the mathematics behind the output...as
evidenced by his many post.
( thank you Dimitri ) .....
 
Probability Calculator
http://www.amibroker.com/library/formula.php?id=114
 
Anthony
-------Original Message-------
 
From: amibroker@xxxxxxxxxxxxxxx
Date: Tuesday, April 29, 2003 10:11:12 PM
To: amibroker@xxxxxxxxxxxxxxx
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 input
when doing "what if" types of studies.  For example if you want to assume
the market goes into a nosedive
and 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
 
PriceTarget=1;
CurrentPrice=1;
VltyVal=1;
BarsToGo=1;
e=2.71828; 
If MinList(PriceTarget, CurrentPrice, VltyVal, BarsToGo) <= 0 Then
 ProbBelow = 0
Else
Begin
Vlty = 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 = 0
Else
Begin
 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,
Erkan
End;
 
 
 
 
uenal.mutlu@xxxxxxxxxxx wrote:
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
 
 
----- Original Message ----- 
From: ERKAN BISEVAC 
To: 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
 
uenal.mutlu@xxxxxxxxxxx wrote:
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
 
----- Original Message ----- 
From: ERKAN BISEVAC 
To: amibroker@xxxxxxxxxxxxxxx 
Sent: Saturday, April 26, 2003 1:51 AM
Subject: [amibroker] CONES
 
 
I am trying to translate one indicator but it's not working.
Can somebody look at this, please.
Thanks
Erkan
 
VolatilityLength=30/252;
SD=2;
VIX=Foreign("^Vix","C");
PriceRows=75;
BarColumns=75;
VolatilitySDev = SD*(0.01*VIX)*sqrt(volatilitylength);
MT = Close + (Close * VolatilitySDev);
MB = Close - (Close * VolatilitySDev);
RH = (MapTop - MapBottom) / PriceRows;
CL=Close;
 
for(I=1;i<=BARCOLUmns;i++)
{
PriceLevel = MB[I]; 
while (PriceLevel < MT[I])
{
if (PriceLevel < CL[I]) 
Probability = 1;
 
else
 
{
Probability = .5;
}
 
Plot(PriceLevel*(1-Probability),"UP",1,1);
Plot(PriceLevel*(1+Probability),"UP",1,1);
PriceLevel = PriceLevel + RH[I];
}
}
 
 
 
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. 
 
 
 
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo. 
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. 
 
 
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading!
Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/cjB9SD/od7FAA/AG3JAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/ 


Attachment:
cones.JPG

Attachment: Description: "Description: JPEG image"