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

Re: [amibroker] CONES FOR Anthony Faragasso



PureBytes Links

Trading Reference Links




Anthony,
Can you please check the code below?
I wrote it couple of days ago but I am still stuck with it.
Attached is the picture of the cones.
Thanks
Erkan Anthony Faragasso <ajf1111@xxxxxxxx> wrote:
Erkan,Have you had a look at the *Probability Calculator* in the AFL library, Thiswill produce the probabilityvalues ( I am sure the code can be manipulated to give the values for saythe next 5 days ) ....Then you would need to draw a * Horizontal-axis Parabola with its Vertex atthe 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 askedDimitri....because he is great with producing graphical output and the mathematics behind the output...asevidenced by his many post.( thank you Dimitri ) .....Probability Calculatorhttp://www.amibroker.com/library/formula.php?id=114Anthony-------Original Message-------From: amibroker@xxxxxxxxxxxxxxxDate: Tuesday, April 29, 2003 10:11:12 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] CONESHi 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 daysdivided by trading days(252) in a year or all days(365) in a year. For example use VolatilityLength(30/252) for a30 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 datafeedor from a manual inputwhen doing "what if" types of studies. For example if you want to assumethe market goes into a nosediveand implied volatility rises to 50 then use VIX(50) instead of VIX(c ofdata2).PriceRows(#) determines the number of horizontal lines in the map.BarColumns(#) determines the number of price bars used in the map. FormatWindow 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 BeginMapTop = 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 BeginPriceLevel = MapBottom; While PriceLevel < MapTop Begin If PriceLevel < Close ThenProbability = ProbBelow(PriceLevel, Close, VolatilitySDev, Count) * 100ElseProbability = ProbAbove(PriceLevel, Close, VolatilitySDev, Count) * 100;PM_SetCellValue(Count, PriceLevel, Probability);PriceLevel = PriceLevel + RowHeight;End;Count = Count + 1;End; End;ProbAbovePriceTarget=1;CurrentPrice=1;VltyVal=1;BarsToGo=1;e=2.71828; If MinList(PriceTarget, CurrentPrice, VltyVal, BarsToGo) <= 0 ThenProbBelow = 0ElseBeginVlty = VltyVal * Sqrt(BarsToGo/(BarAnnualization^2));PriceRatio = Log(PriceTarget / CurrentPrice);If (Vlty <> 0) ThenRawProb = 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 ThenProbBelow = x1ElseProbBelow = 1 - x1;ProbAbove = 1 - ProbBelow;ProbBetween = ProbBelow - ProbBelow;ProbBelowInputs: 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 ThenProbBelow = 0ElseBeginVlty = VltyVal * SquareRoot(BarsToGo/Square(BarAnnualization));PriceRatio = Log(PriceTarget / CurrentPrice);If Vlty <> 0 ThenRawProb = 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 ThenProbBelow = x1ElseProbBelow = 1 - x1;Thanks,ErkanEnd;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 AMSubject: Re: [amibroker] CONESUMCan you show me how to fix it?ThanksErkanuenal.mutlu@xxxxxxxxxxx wrote:Hi Erkan,the syntax error says:Condition in IF, WHILE, FOR statementshas to be Numeric or Boolean type.You can not use array here,please use [] (array subscript operator)to access array elementsUM----- Original Message ----- From: ERKAN BISEVAC To: amibroker@xxxxxxxxxxxxxxx Sent: Saturday, April 26, 2003 1:51 AMSubject: [amibroker] CONESI am trying to translate one indicator but it's not working.Can somebody look at this, please.ThanksErkanVolatilityLength=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@xxxxxxxxxxxxxSend 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/groupfaqhtml 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 SponsorSend BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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/groupfaqhtml 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@xxxxxxxxxxxxxSend 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 part 2 image/jpeg name=cones.JPG 
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.



Attachment: Description: ""