|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
Compiling public domain code for the archives while continually producing advanced proprietary code. In order to get a indicator simply click on the name, the file will open showing the text then click edit at the top of your screen, click select all, click edit at the top of your screen again, now click copy. Go to the Omega Power Editor and click file new, click indicator, name the indicator click ok. Now click edit, then click paste.Your done hit the F3 key to verify.
The Original OddBall System Logic Below The OddBall System is a FREE and fully disclosed, mechanical trading model.
Please visit the Contribution page to review the original and variations of the
system complete with code in text and native platform file format. OddBall
systems code is available in TradeStation, MetaStock, WealthLab and eSignal
format. Active Trader Magazine - December 2000 issue: OddBall Position System Code {Data1 = Either the SP cash S&P 500 index tracking stock or the S&P
500 commodity futures contract. if time >830 and time<= 1500 then begin {*} {based upon (GMT-06:00) Central Time (US and Canada) - note you may have to adjust for your time zone.} Inputs: RL(7), BZ(3), SZ(1); Easy Language from the Omega-list below. Kase Indicator Origin: omega-listWritten by: Mark Brown Date found: 30 sep 97 {idea from Cynthia Kase} input: N1(10); var:KSDIUP(0),KSDIDN(0); if average(@TrueRange, n1) > 0 then KSDIUP = ((high[N1]/low))/(( average(V, N1) * SquareRoot(n1))) else KSDIUP = KSDIUP[1]; if average(@TrueRange, n1) > 0 then KSDIDN = ((high/low[N1]))/(( average(V, N1) * SquareRoot(n1))) else KSDIDN = KSDIDN[1]; if KSDIUP>KSDIDN then plot1(l,"l"); if KSDIUP<KSDIDN then plot2(h,"h"); if KSDIUP=KSDIDN then plot3((h+l)/2,"m"); Oscillator of Kase indicator Origin: omega-listWritten by: Mark Brown Date found: 30 sep 97 input: N1(10); var:KSDIUP(0),KSDIDN(0),jj(0); if average(@TrueRange, n1) > 0 then KSDIUP = ((high[N1]/low))/(( average(V, N1) * SquareRoot(n1))) else KSDIUP = KSDIUP[1]; if average(@TrueRange, n1) > 0 then KSDIDN = ((high/low[N1]))/(( average(V, N1) * SquareRoot(n1))) else KSDIDN = KSDIDN[1]; jj=ksdidn-ksdiup; if KSDIUP>KSDIDN then plot1(jj,"l"); if KSDIUP<KSDIDN then plot2(jj,"h"); a Kaufman kinda thing Origin: omega-listWritten by: Mark Brown Date found: 30 sep 97 input: period(5), indate(940331),yield(0); vars: sum(0), aclose(0), ahigh(0), alow(0), sumER(0), sumvlty(0), change(0), netchange(0), pcnet(0), pchange(0), maxrange(0), crange(0), ER(0), avgER(0), avglty(0), avgmaxv(0), sumrange(0), summax(0); {Noise(%) = Absolute price range perday, in percent Mom = Momentum, net price change over time} if yield = 0 then begin aclose = close; ahigh = high; alow = low; end else if yield = 1 then begin {Euros, T-Bills and 3 month rates} aclose = 100 - close; alow = 100 - high; ahigh = 100 - low; end else if yield = 2 then begin {Bonds and Notes: approx 100=8%, each 8 points = 1% the 164 =0} aclose = 164 - close; alow = 164 - high; ahigh = 164 - low; end; change = @AbsValue(aclose - aclose[1]); pchange = 0; if aclose[1] <> 0 then pchange = change*100/aclose[1]; sum = @summation(pchange,period); netchange = @AbsValue(aclose - aclose[period]); {close - only and maximum calculations, in percent} pcnet = 0; crange = 0; maxrange = 0; if aclose[period] <> 0 then begin pcnet = netchange*100/aclose[period]; crange = (@highest(aclose,period) - @lowest(aclose,period))*100/aclose[period]; maxrange = (@highest(ahigh,period) - @lowest(alow,period))*100/aclose[period]; end; sumrange = sumrange +crange; summax = summax + maxrange; ER = 1.0; if sum <> 0 then ER = pcnet / sum; sumER = sumER + ER; (currentbar:5:0,",PcNet",pcnet:4:2,",Crange",crange:4:2,",MaxRange",maxrange:4:2,",ER",ER:3:3); if date >= indate then begin avgER = sumER/currentbar; avglty = sumrange/currentbar; avgmaxv = summax/currentbar; (currentbar:5:0,",p=",period:3:0,",avgER=",avgER:2:3,",avgVlty=",avglty:3:2,"%,avgMaxv",avgmaxv:3:2,"%"); end; plot1(avger,"AVGER"); plot2( er,"ER"); More from Kaufman Origin: omega-listWritten by: Mark Brown Date found: 30 sep 97 input: Erperiod(10), Erentry(.25), Erexit(.03), maxavg(1.00), maxchg(1.5), option(2); vars: change(0),pchange(0),noise(0),signal(0), diff(0), efratio(0), ERavg(0), ERsd(0), ERsd3a(0), ERsd3(0); {CALCULATE EFFICIENCY RATIO} diff = @AbsValue(close - close[1]); if currentbar > ERperiod then begin change = close - close[ERperiod]; pchange = change*100/close[ERperiod]; signal = @AbsValue(change); noise = @summation(diff,ERperiod); efratio = 1.00; if (noise <> 0 ) then efratio = signal/noise; ERavg = @average(efratio,21); ERsd = @stddev(efratio,21); ERsd3a = @average(ERsd,3); ERsd3 = @average(Eravg - ERsd,3); {Entry signals} if efratio > Erentry and pchange > .000 then plot1(efratio,"+"); if efratio > Erentry and pchange < .000 then plot2(efratio,"-"); end; if efratio < ERexit then plot3(efratio,"exitS"); plot4(noise/10,"exitL"); Larry Connors, secrets of a hedge fund Mgr. Origin: omega-listWritten by: Mark Brown Date found: 30 sep 97 {data1=sp futures data2=sp cash} input:extra(.50); if t=1603 then value1=C of data1; if t=1603 then value2=C of data2; if t=1603 then value3=value1-value2; value4=value3+value2; value5=value4+extra; if t>=1603 and t<=1615 and DayOfWeek(date)<5 then plot1(value5,"SELL"); if t>=1603 and t<=1615 and DayOfWeek(date)<5 then plot2(value5+.50,"STOP"); if t>=1603 and t<=1615 and DayOfWeek(date)<5 then plot3(value5-.50,"TARGET"); Even more Kaufman Origin: omega-listWritten by: Mark Brown Date found: 30 sep 97 input : vbars(10),shockfac(3),endshock(1.00) ; vars :vlty(0),norm(0),avgTr(0),ix(0),iy(0),na(0),vmax(100),trend(0),save(0),x(0); if DataCompression=1 and TrueHigh >= average(TrueHigh,vbars) then x =h else if DataCompression=1 and TrueLow <= average(TrueLow,vbars) then x =l else if DataCompression= 2 then x= c else if DataCompression= 3 then x= c else if DataCompression= 4 then x= c ; Arrays : rng[100](0) ; {average true range during selected market periods} if currentbar <= vbars then begin {initilization} if na <= vmax then begin na = na + 1 ; rng[na] = @TrueHigh - @TrueLow ; end ; end else if currentbar = vbars + 1 then begin {sort range and find initial median value} for ix = 1 to na - 1 begin for iy = 2 to na begin if rng[ix] < rng[iy ] then begin save = rng[ix] ; rng[ix ]= rng[iy] ; rng[iy] = save ; end ; end ; end ; avgTr = rng[@IntPortion(na/2)] ; end else if currentbar > vbars + 1 then begin {normal processing} {current volatility uses all bars} vlty = @TrueHigh - @TrueLow ; {test for price shock levels} norm = avgTR ; if vlty/avgTR > shockfac then begin if TrueHigh >= average(TrueHigh,vbars) then if vlty>= shockfac then plot1(x,">shock+");end; if vlty/avgTR > shockfac then begin if TrueLow <= average(TrueLow,vbars) then if vlty>= shockfac then plot2(x,">shock-");end; if vlty >=endshock and vlty<= shockfac then plot3(c,"shockmid"); if vlty < endshock then plot4(c,"<shocklow"); end; Undocumented use of a function Origin: omega-listWritten by: Mark Brown Date found: 30 sep 97 {undocumented use of a function TradeStation has many, this one looks like the aroon, in a recent S&C article. This function is used internally and should not be called directly by the user.} inputs:PriceH(H),PriceL(L),Length(10); plot1(FastHighestBar(PriceH,Length),"FHB"); plot2(FastLowestBar(PriceL,Length),"FLB"); intraday fib juck here it is Origin: omega-listWritten by: Mark Brown Date found: 30 sep 97 var:r(0),f(0),hf(0),lf(0); r=IDhigh-IDlow; f=r*.68; hf=IDhigh-f; lf=IDlow+f; if t>1015 then plot1(hf,"hf"); if t>1015 then plot2(lf,"lf"); plot3(idhigh,"high"); plot4(idlow,"low"); outperform CatScan and Aberration Origin: omega-listWritten by: Mark Brown Date found: 1 oct 97 { Since my first posting of a system by mistake that was missing some critical user functions, I have be inundated by request for some serious systems. So in response to these request I am posting here a system that should out perform both CatScan and Aberration. The system is very simple as you can see and I have many various versions of it. I traded it for years before I hit on the nonlinear stuff. Most important it is free! I have hoarded code long enough to know allot of stuff works ok. It's as much a mind game as anything and if you want to make money let your mind go blank and trust the system, the system can be intuitive or computerized or any blend thereof. But defined and cast in stone it must be. In response to the editors comment in S&C magazine, in which he said there is no Holy Grail. I say pop poo on you! Just because you are a native in the woods of the jungle doesn't mean there isn't a cure for your disease here in the city. You just don't have it! Mark } inputs:BBLength(38),BBStdDev(3), BBHPrice(ADAPTIVE(H,10)),BBLPrice(ADAPTIVE(L,10)); vars:BBH(0),BBL(0); BBH=BollingerBand(BBHPrice,BBLength,BBStdDev); BBL=BollingerBand(BBLPrice,BBLength,-BBStdDev); if c >bbh then buy; if c<bbl then sell; { P.S. The adaptive function part is Perry Kaufmans: } inputs:price(numericseries),period(numericsimple); vars: noise(0),signal(0),dif(0),efratio(0), smooth(1),fastend(.666),slowend(.0645),am(0); {CALCULATE EFFICIENCY RATIO} dif=@AbsValue(price - price[1]); if(currentbar <= period) then am =price; if(currentbar > period)then begin signal = @AbsValue(price - price[period]); noise = @summation(dif,period); efratio = signal/noise; smooth = @Power(efratio*(fastend - slowend) + slowend,2); {ADAPTIVE MOVING AVERAGE} am = am[1] + smooth*(price - am[1]); Adaptive=am; end; What's an Aroon? Origin: omega-listWritten by: Mark Brown Date found: 1 oct 97 {THIS IS AN AROON} input:thold(20),length(25); var:hiref(0),loref(0); hiref=100*((length-nthhighestbar(1,h,length))/length); loref=100*((length-nthlowestbar(1,l,length))/length); plot1(hiref,"hi"); plot2(loref,"lo"); plot3(50+thold,"hiref"); plot4(50-thold,"loref"); Calm markets good for scalping Origin: omega-listWritten by: Mark Brown Date found: 1 oct 97 inputs:adxlen(28),adxavg(2),dmilen(28),dmiavg(2),adxzone(15); {sp,$tick,$ticki,$adv,$dec} inputs: N(25),UDVzone(1); inputs:LENGTH(20),FRSTDATA(C OF DATA4),SECNDATA(C OF DATA5); vars:v1(0),v2(0),v3(0),v4(0),v5(0),v6(0),v7(0),v8(0),v9(0),v10(0),v11(0),v12(0); v1=ADX(adxlen); v2=ADXZone; v3=average(value1[1],adxavg); v4=average(dmiPlus(dmilen),dmiavg); v5=average(dmiMinus(dmilen),dmiavg); v6=UDVolume(N); v7=UDVzone; v8=Diff(FRSTDATA,SECNDATA); v9=average(Diff(FRSTDATA,SECNDATA),LENGTH); {--------------------function Diff-------------} {Diff returns the difference of the two data series specified by the inputs. This is used to take the difference of Advances - Declines where Advances is Data2 and Declines is Data3} inputs: FrstData(numericseries),SecnData(numericseries); Diff = FrstData - SecnData; condition10=v8<v9; {A/D Line lessr than average A/D line showing calm market} Condition1=v1<=v2; {ADX below ADXzone showing market is still} Condition2=v3>v1; {ADXavg greater than ADX so its rising showing market strength increassing} Condition3=v4>v5; {DMIplus greater than DMI minus showing market direction up} condition4=v4<v5; {DMIplus less than DMI minus showing market direction down} condition5=v6<v7; {UDV Less Than UDVzone showing market stillness} condition6=h of data2<280 and h of data2>50; {High of $Tick less than 280 showing average trading} condition7=l of data2>-280 and l of data2<-50 ; {Low of $Tick less than -280 showing average trading} condition8=h of data3<21; {High of $Ticki less than 21 showing average trading} condition9=l of data3<-21; {Low of $Ticki less than -21 showing average trading} {-------------------------------- all items above are to identify calm market------} if Condition1 then plot1(o,"1"); if condition5 then plot2(h,"2"); if condition6 then plot3(c of data2,"3"); if condition7 then plot4(c of data2,"4"); Pretty weird late night stuff Origin: omega-listWritten by: Mark Brown Date found: 1 oct 97 input:NUM(10),avglen(5),thold(10); value1 = MaxList(h-h[1],h-h[2],h-h[3],h-h[4],h-h[5],h-h[6],h-h[7],h-h[8],h-h[9],h-h[10],h-h[11], h-h[12],h-h[13],h-h[14],h-h[15],h-h[16],h-h[17],h-h[18],h-h[19],h-h[20]); value3 = MaxList(h-h[21],h-h[22],h-h[23],h-h[24],h-h[25],h-h[26],h-h[27],h-h[28],h-h[29],h-h[30],h-h[31], h-h[32],h-h[33],h-h[34],h-h[35],h-h[36],h-h[37],h-h[38],h-h[39],h-h[40]); value5 = MaxList(h-h[41],h-h[42],h-h[43],h-h[44],h-h[45],h-h[46],h-h[47],h-h[48],h-h[49],h-h[50],h-h[51], h-h[52],h-h[53],h-h[54],h-h[55],h-h[56],h-h[57],h-h[58],h-h[59],h-h[60]); value2 = MinList(l-l[1],l-l[2],l-l[3],l-l[4],l-l[5],l-l[6],l-l[7],l-l[8],l-l[9],l-l[10],l-l[11], l-l[12],l-l[13],l-l[14],l-l[15],l-l[16],l-l[17],l-l[18],l-l[19],l-l[20]); value4 = MinList(l-l[21],l-l[2],l-l[23],l-l[24],l-l[25],l-l[26],l-l[27],l-l[28],l-l[29],l-l[30],l-l[31], l-l[32],l-l[33],l-l[34],l-l[35],l-l[36],l-l[37],l-l[38],l-l[39],l-l[40]); Value6 = MinList(l-l[41],l-l[2],l-l[43],l-l[44],l-l[45],l-l[46],l-l[47],l-l[48],l-l[49],l-l[50],l-l[51], l-l[52],l-l[53],l-l[54],l-l[55],l-l[56],l-l[57],l-l[158],l-l[59],l-l[60]); Value9 =average( MaxList(0,value1)*SquareRoot(num),avglen); Value10 =average( MinList(0,value2)*SquareRoot(num),avglen); Value11= value9-(-value10); plot1(value11,"ax"); if value9< -value10 then begin plot2(-thold,"di-");end; if value9> -value10 then begin plot3(thold,"di+");end; if value11>0 then if Value11[0]>(average(value11[1],2)) then plot4(0,"TrendStart") ; if value11<0 then if Value11[0]<(average(value11[1],2)) then plot4(0,"TrendStart"); 'recent magazine system I saw' Origin: omega-listWritten by: Mark Brown Date found: 1 oct 97 input: LEN1(100),fac(.05); var:aa(0); aa=(Log(c/c[len1])/(StdDevx(Log(c/c[1]),len1)*SquareRoot(len1))); if aa>fac and aa[1]<fac then buy; if aa<-fac and aa[1]>-fac then sell; The Kaufman Smoothing Constant Part of the Graile Origin: omega listWritten by: Mark Brown Date found: 1 oct 97 inputs:Period(10),Price(C),Z1(.10),Z2(.20),Z3(.30); vars: noise(0),signal(0),difference(0),efratio(0), smooth(1),fastend(.666),slowend(.0645),AMA(0); {CALCULATE EFFICIENCY RATIO} difference = @AbsValue(price - price[1]); if(currentbar <= period) then AMA = price; if(currentbar > period)then begin signal = @AbsValue(price - price[period]); noise = @summation(difference,period); efratio = signal/noise; smooth = @Power(efratio*(fastend - slowend) + slowend,2); plot1(smooth,"AMAsmooth"); end; plot2(Z1,"Z1"); plot3(Z2,"Z2"); plot4(Z3,"Z3"); Note for Newbies Origin: omega-listWritten by: Mark Brown Date found: 2 oct 97 {Well I didnt relize so many people are having problems with the adaptive user function. It is a user function, not a system, not a indicator, a USER FUNCTION! Functions can be thought of as a shortcut list. If a user has a certain set of rules that he or she would like to use often, these can be written inside a function. That function can then be called, by using a single word, inside any study, system, or even another function. This saves time and also makes the other analysis techniques easier to understand. Like any language, Easy Language has a set of basic components that make up the core of the language. Components are words, characters, or methods used to construct statements. These components must be organized and structured correctly to create valid sentences or statements. The organized pattern or structure of language is called syntax. If a statement does not have correct syntax, the computer will be unable to recognize it as valid. When the components of Easy Language are used in the proper syntax, virtually any trading strategy can be written. One of the major components of Easy Language is the function. Many functions were written by Omega Research, Inc. for the convenience of the user; however, the user may write his or her own functions. Then, all that users have to do is to reference the function while writing their own studies, systems, or other functions. Functions that are already included with TradeStation are covered in further detail later in this chapter. Ultimately, the goal will be to write complete statements using Easy Language. We will first look at how to put the different components of the language together to form various expressions. Then we will discuss how to turn these expressions into statements. Once a user is able to write statements, he or she will have little difficulty turning ideas into studies or systems that TradeStation can read and recognize. Make a USER FUNCTION and name it Adaptive then insert the code below and verify, thats it. I have included an ELA this time for the SC users. Cut and paste the below code to the power editor USER FUNCTION and name it Adaptive.} inputs:price(numericseries),period(numericsimple); vars: noise(0),signal(0),dif(0),efratio(0), smooth(1),fastend(.666),slowend(.0645),am(0); {CALCULATE EFFICIENCY RATIO} dif=@AbsValue(price - price[1]); if(currentbar <= period) then am =price; if(currentbar > period)then begin signal = @AbsValue(price - price[period]); noise = @summation(dif,period); efratio = signal/noise; smooth = @Power(efratio*(fastend - slowend) + slowend,2); {ADAPTIVE MOVING AVERAGE} am = am[1] + smooth*(price - am[1]); Adaptive=am; end; text-objects Origin: omega-listWritten by: Mark Brown Date found: 5 oct 97 { r = resistance last = the last price or current real time price s = support factor = the empirical range of a choppy market lookback = just that a reference in time and space user function adaptive can be substituted with about anything.} input:factor(1.30),lookback(10); var:txtr(0), r(" r - - - - - - - - - - - - - - - - -"); var:txt(0),last(" last - - - - - - - - - - - - - - - - -"); var:txts(0),s(" s - - - - - - - - - - - - - - - - -"); value9=c ; value8=adaptive(l,lookback)-factor; value7=adaptive(h,lookback)+factor; if currentbar=1 then begin txtr= Text_New (d,1,0,"--"+r+r+r+r+r+r+r+r+r+r+r+r+r+r); Text_SetColor(txtr,5); Text_SetStyle(txtr,0,2);end; if currentbar=1 then begin txt= Text_New (d,1,0,"--"+last+last+last+last+last+last+last+last+last+last+last+last+last+last); Text_SetColor(txt,8); Text_SetStyle(txt,0,2);end; if currentbar=1 then begin txts= Text_New (d,1,0,"--"+s+s+s+s+s+s+s+s+s+s+s+s+s+s); Text_SetColor(txts,4); Text_SetStyle(txts,0,2);end; {1=black,2=blue,3=cyan,4=green,5=magenta,6=red,7=yellow,8=white} if c >= 0 then begin Text_SetLocation(txtr,d,1,value7);end; if c >= 0 then begin Text_SetLocation(txt,d,1,value9);end; if c >= 0 then begin Text_SetLocation(txts,d,1,value8);end; plot1(c,""); art of minimizing code Origin: omega-listWritten by: Mark Jurik & Mark Brown Date found: 5 oct 97 {My thanks to Mark Jurik for rewriting some of my code and sending it to me. There is an art form to minimizing code and M.J. is certainly expressing it here. Again thanks to all who have in the past and are in the future posting code and answering questions. Mark} input: NUM(10), avglen(5), thold(10); value1 = H - lowest ( H , 60 ) ; value2 = L - highest ( L , 60 ) ; Value9 =average( MaxList(0,value1),avglen); Value10 =average( MinList(0,value2),avglen); Value11 = (value9 + value10) * SquareRoot(num) ; plot1(value11,"ax"); if value11 < 0 then begin plot2(-thold,"di-"); if Value11 < average(value11[1],2) then plot4(0,"TrendStart"); end; if value11 > 0 then begin plot3( thold,"di+"); if Value11 > average(value11[1],2) then plot4(0,"TrendStart") ; end; to get the very last tick in a tick chart Origin: omega-listWritten by: Mark Brown Date found: 7 oct 97 {To get the very last tick in a tick chart} input:back(10); var:z(0); if date = CurrentDate then begin for z=0 to back-1 begin plot1[z](c,"c"); end; plot2[back](c[1],""); end; {plot1-(color)-point plot2-black-point} colored time-intervals on tick-charts Origin: omega-listWritten by: Rick Saidenberg Date found: 12 oct 97 {This was programmed for me (Mark Brown) by Rick Saidenberg. Before I had all my systems fully automated, I DayTraded using a 5 tick bar chart. I liked the tick bar charts because they smoothed out the indicators and were more responsive to quick jerk moves that time frame based charts would wreck you on. But I always missed the time intervals that a time chart provides. Like knowing every bar = 5 minutes ect. So Rick wrote this paint bar study that paints the bars on a tick bar chart a different color for each time interval. So if you using a 5 tick bar chart and you want the color of the bars to change every 5 minutes then set the rotate input to 5. Mark =====code starts here=====} input:rotate(5); var:go(0),new(0); if d>d[1]or currentbar=1 then begin if go=0 then go=1 else go=0; new=TimeToMinutes(Sess1StartTime)+rotate; end; if TimeToMinutes(t)>new then begin if go=0 then go=1 else go=0; new=new+rotate; end; if go=1 then begin plot1(h,"time"); plot2(l,"rotate"); end; volatility based system + SAR code Origin: omega-listWritten by: Mark Brown Date found: 27 nov 97 { This system code is using volatility to both time the entry of a position and to determine the amount of extra points that should be added to a limit type order. I thought just for fun, I have found when I'm wrong I'm usually really wrong so I added some SAR code that was provided to me by Rich Estrem my partner in the Market Profile Indicator. Which can be seen at <A HREF="http://www.markbrown.com/estrem.html">MB</A> Sorry for the spam but we didn't get a review in S&C, like some. But we are furnishing code here that shows promise and the price is right. Mark } {This could be run on a five minute chart with close all trades at eod and mm of 1-3 pts and pt of 2-5 pts.} input:V1(10),V2(9),AL(5),sar_pts(4); vars: Vola_average(0), Vola_trend(0),p1(0),p2(0),extra(0); P1=Volatility(V1); P2=average(P1,V2); if p1>=1.5 then extra=1.20; if p1<=1.5 then extra=.50; Vola_average=average(P1,V2); if Vola_average>Vola_average[1] and P1>Vola_average then Vola_trend=1 else if Vola_average<Vola_average[1] and P1<Vola_average then Vola_trend=-1 else Vola_trend=Vola_trend[1]; if Vola_trend<0 and Vola_trend[1]>=0 then begin if c crosses below average(c,AL) then begin value1=c - extra; sell tomorrow at value1 Limit; end;end; if Vola_trend<0 and Vola_trend[1]>=0 {Corrected this line of code ; -} then begin if c crosses above average(c,AL) then begin value2=c + extra; buy tomorrow at value2 Limit; end;end; if MarketPosition=1 then sell("Ssar") at EntryPrice(0)-sar_pts stop; if MarketPosition=-1 then buy("Bsar") at EntryPrice(0)+sar_pts stop; Keltner bands Origin: omega-listWritten by: na Date found: 3 dec 97 { ******************************************************************* Indicator: Keltner Bands Provided By : Retrieved from Internet submitted to omega by Mark Brown ********************************************************************} input: Price(close), MALen(10), Const(.8); vars: Centline(0), AvgRange(0), Upper(0), Lower(0); CentLine = average(Price,MALen); AvgRange = average(TrueRange,MALen); Upper = CentLine+(AvgRange*Const); Lower = CentLine-(AvgRange*Const); plot1(Upper,"Upper"); plot2(Lower,"Lower"); FibTimeProjections Origin: omega-listWritten by: Unknown Date found: 20 sep 97 { FibTimeProjections } input: Adate(0), Atime(0), Bdate(0), Btime(0), Width(0), Displace(0), Color(Tool_Red); var: Abar(0), Bbar(0), AB(0); array: proj[3](0); { Width - the thickness of the projected timeline, a value from 0 to 6 Displace - the number of bars back that the projected line will appear (0 for no displacement) Color - the color of the projected timeline } { Associate the barnumber with the date/time input } if date = Adate and time = Atime then Abar = currentbar; if date = Bdate and time = Btime then Bbar = currentbar; { After we have the A and B barnumbers, calculate the projected barnumbers } if Abar <> 0 and Bbar <> 0 and AB = 0 then begin AB = Bbar - Abar; proj[0] = IntPortion(Abar + AB * 1.618); proj[1] = IntPortion(Abar + AB * 2.000); proj[2] = IntPortion(Abar + AB * 2.618); end; { Check the current bar to find out if a projected timeline should be shown } var: ii(0), handl(0); for ii = 0 to 2 begin if currentbar = proj[ii] - displace then begin { Yes, so create it and set its attributes } handl = TL_New(date,time,0,date,time,100); TL_SetExtLeft(handl, true); TL_SetExtRight(handl, true); TL_SetSize(handl, width); TL_SetColor(handl, color); end; end; if false then plot1(0,""); Draw linear regressionlines for two past periods Origin: omega-listWritten by: Earl Adamy Date found: 21 jan 98 { ***************************************************************************** Indicator : i_LRPriceShort Date : 8/19/95 2:56PM Author : Earl Adamy Copyright 1995, all rights reserved. Transfer : o:\omega\inds\lrprice History : 8/19/95 9:06AM create indicator to mark pivot points Purpose : Draw linear regression lines for two past periods Notes : MaxPlotBarsBack must be long enough for pivot extreme to be reversed ***************************************************************************** } inputs : Periods(20); vars : LRValueEnd(0), LRSlopeEnd(0), LRStdDevEnd(0), LRValueBeg(0), PlotBarsBack(0), LRChanWidth(0); LRValueEnd = LinearRegValue(close, Periods, 0); LRSlopeEnd = LinearRegSlope(close, Periods); LRStdDevEnd = stddev(close, Periods); { Print(file("o:\omega\i_LRPrc.log"),Date, BarNumber, " Close ", Close, " LRVal ", LRValueEnd, " LRSlp ", LRSlopeEnd, " LRStd ", LRStdDevEnd); } if date = LastCalcDate then begin {Plot end of last LR period)} PlotBarsBack = 0; LRChanWidth = (2 * LRStdDevEnd[PlotBarsBack]); plot1[PlotBarsBack](LRValueEnd[PlotBarsBack],"LRP Short"); plot2[PlotBarsBack]((LRValueEnd + LRChanWidth)[PlotBarsBack],"LRP S Upper"); plot3[PlotBarsBack]((LRValueEnd - LRChanWidth)[PlotBarsBack],"LRP S Lower"); {Plot begin of last LR period)} LRValueBeg = LRValueEnd[PlotBarsBack] + ((Periods-1) * (LRSlopeEnd[PlotBarsBack] * -1)); PlotBarsBack = Periods - 1; plot1[PlotBarsBack](LRValueBeg, "LRP Short"); plot2[PlotBarsBack]((LRValueBeg + LRChanWidth), "LRP S Upper"); plot3[PlotBarsBack]((LRValueBeg - LRChanWidth), "LRP S Lower"); {Plot end of prev LR period)} plot4[Periods](LRValueEnd[Periods],"LRP S Prev"); {Plot begin of last LR period)} LRValueBeg = LRValueEnd[Periods] + ((Periods-1) * (LRSlopeEnd[Periods] * -1)); PlotBarsBack = (Periods * 2) - 1; plot4[PlotBarsBack](LRValueBeg, "LRP S Prev"); end; Upside/DownSide Volume Origin: omega-listWritten by: Aldo A. Palles Date found: 1 oct 97 { Written by Aldo A. Palles Notes: Upside/DownSide Volume Source: Investor's Business Daily } inputs: N(numericsimple); vars: UpVol(0), DnVol(0), x(0); UpVol = 0; DnVol = 0; for x = 0 to N - 1 begin if close[x] > close[x+1] then UpVol = UpVol + volume[x]; if close[x] < close[x+1] then DnVol = DnVol + volume[x]; end; if DnVol > 0 then UDVolume = UpVol / DnVol; (intra day) Delta Phenomenon Origin: omega-listWritten by: Patrick Mikula Date found: 3 oct 97 {Dear Omega List, Below is an indicator which will plot the colored lines for the intra day Delta Phenomenon. I have provided it in text and ELA form. The text below is actually in the ELA file, please read it before applying the indicator to intra day data. Good Luck Patrick Mikula.} {************************************************************************** Delta Phenomenon Patent Pending? Being a financial astrologer I have always found the moon to be a valuable trigger of market events so I was naturally impressed with Wells Wilder's book The Delta Phenomenon. The problem most traders have with this trading method is simply that the actual entry and exit points are very subjective. For my own personal use I programmed an EasyLanguage system which monitors the intraday, daily and weekly Delta Phenomenon counts and combines them with support and resistance levels, the direction of 2 moving averages and some candle stick patterns to create a fully mechanical version of the Delta Phenomenon. I had planned to release this system but the Delta Phenomenon book written in 1991 claims that it has a patent pending. I called the Delta Society International several times over the course of about 8 months and they always claimed that the patent had in fact been granted but refused to provide the patent number. The fact that the Delta Society International claims the patent was granted means that I will not release any delta system which plots numbers because the lock-in number counts are what makes the Delta Phenomenon the method that it is. The indicator below will plot the four colored lines of the intra day Delta Phenomenon. This is intended to be a time saving aid for traders using this method it is not the actual method. If you want to understand the Delta Phenomenon lock-in number counts please buy the book The Delta Phenomenon written by Wells Wilder. WARNING 1: If there are 4 or more days missing in a row, this indicator will not plot the correct color line. WARNING 2: This indicator plots a trend line from a bars low to high then extends the line upward and downward. If the first bar of the day has the same low and high price none of the trend lines will plot. NOTE 1: The FstColor input should be set to a number between 1 and 4 in order to adjust the color sequence to get it the way you want. As a reference point I believe September 18, 1997 is a red trend line. NOTE 2: I have provided a short line of text above each section of code to explain what the code does. NOTE 3: If you would like an indicator similar to this one but for daily or weekly charts see my web page were I have an astrological add on for TradeStation and SuperCharts which can make the required lunar calculations. http://www.flash.net/~vibri/ THE INDICATOR CODE STARTS BELOW THIS LINE *****************************************************************************} {------------Below sets up the Inputs, Variables and Values-----------------} input: FstColor(2); Variables: Plotted(false), TLColor(0), Counter(0); value1 = DateToJulian(date) - DateToJulian(date[1]); {------Below transfers the input FstColor to the variable TLColor--------} if TLColor = 0 then TLColor = FstColor; {------Below increments the TLColor by the number of days between bars-----} if value1 > 0 then begin TLColor = TLColor + value1; plotted = false; end; {------Below reduces the TLColor when it moves above 4--------} if TLColor > 4 then TLColor = TLColor - 4; {--------Below plots a Red Vertical Line on a days first bar-----------} if TLColor = 1 and plotted = false {TLColor = 1 = Red} then begin Value20 = TL_New(date,time,high,date,time,low); Value21 = TL_SetColor(Value20, Tool_Red); Value22 = TL_SetExtRight(Value20, true); Value23 = TL_SetExtLeft(Value20,true); plot1(high,"delta"); Plotted = true; end; {--------Below plots a Blue Verical line on a days first bar----------} if TLColor = 2 and plotted = false {TLColor = 2 = Blue} hen begin Value20 = TL_New(date,time,high,date,time,low); Value21 = TL_SetColor(Value20, Tool_Blue); Value22 = TL_SetExtRight(Value20, true); Value23 = TL_SetExtLeft(Value20,true); plot1(high,"delta"); Plotted = true; end; {-----------Below plots Dark Yellow Vertical Line on a days first bar-----------} if TLColor = 3 and plotted = false {TLColor = 3 = Yellow} then begin Value20 = TL_New(date,time,high,date,time,low); Value21 = TL_SetColor(Value20, Tool_DarkYellow); Value22 = TL_SetExtRight(Value20, true); Value23 = TL_SetExtLeft(Value20,true); plot1(high,"delta"); Plotted = true; end; {--------Below plots a Dark Green Vertical Line on a days first bar------------} if TLColor = 4 and plotted = false {TTLColor = 4 = Green} then begin Value20 = TL_New(date,time,high,date,time,low); Value21 = TL_SetColor(Value20, Tool_DarkGreen); Value22 = TL_SetExtRight(Value20, true); Value23 = TL_SetExtLeft(Value20,true); plot1(high,"delta"); Plotted = true; end; {END EASYLANGUAGE CODE} Market Mood indicator Origin: omega-listWritten by: Guus Prick Date found: 4 oct 97 {Market Mood - (c) G.Prick 1997 e-mail: guus@iaehv.nl provides a visual representation of market mood by using trendlines} inputs: Flen(100); vars: ax(0),Fhi(0),Flo(0),Midd(0),stem(0),RL(0),LL(0),BLH(0),BRH(0),TLH(0), TRH(0),LA(0),RA(0); if currentbar = 1 then begin Fhi = highest(H,Flen);Flo=lowest(L,Flen); ax = Fhi-Flo; stem = TL_New(date,time,Fhi-.6*ax,date,time,Fhi-.4*ax); RL = TL_New(date,time,Fhi-.4*ax,date,time,Fhi-.2*ax); LL = TL_New(date,time,Fhi-.2*ax,date,time,Fhi-.1*ax); BLH = TL_New(date,time,Fhi-.2*ax,date,time,Fhi-.1*ax); BRH = TL_New(date,time,Fhi-.1*ax,date,time,Fhi-.4*ax); TLH = TL_New(date,time,Fhi-.6*ax,date,time,Fhi-.2*ax); TRH = TL_New(date,time,Fhi-.7*ax,date,time,Fhi-.6*ax); LA = TL_New(date,time,Fhi-.7*ax,date,time,Fhi-.6*ax); RA = TL_New(date,time,Fhi-.3*ax,date,time,Fhi-.2*ax); TL_SetExtLeft(stem, false);TL_SetExtRight(stem, false); TL_SetExtLeft(RL, false);TL_SetExtRight(RL, false); TL_SetExtLeft(LL, false);TL_SetExtRight(LL, false); TL_SetExtLeft(BLH, false);TL_SetExtRight(BLH, false); TL_SetExtLeft(BRH, false);TL_SetExtRight(BRH, false); TL_SetExtLeft(TLH, false);TL_SetExtRight(TLH, false); TL_SetExtLeft(TRH, false);TL_SetExtRight(TRH, false); TL_SetExtLeft(LA, false);TL_SetExtRight(LA, false); TL_SetExtLeft(RA, false);TL_SetExtRight(RA, false); if false then plot1(0,"duh"); end; if currentbar > 1 then begin Fhi = highest(H,Flen);Flo=lowest(L,Flen); ax = Fhi-Flo; Midd = Flen/2; TL_SetEnd(stem,date[Midd],time[Midd],Fhi-.4*ax); TL_SetBegin(stem, date[Midd], time[Midd], Fhi-.6*ax); TL_SetEnd(RL,date[Midd],time[Midd],Fhi-.6*ax); TL_SetBegin(RL, date[Midd-Midd/2], time[Midd-Midd/2], Flo); TL_SetEnd(LL,date[Midd],time[Midd],Fhi-.6*ax); TL_SetBegin(LL, date[Midd+Midd/2], time[Midd+Midd/2], Flo); TL_SetEnd(BLH,date[Midd+Midd/6],time[Midd+Midd/6],Fhi-.2*ax); TL_SetBegin(BLH, date[Midd], time[Midd], Fhi-.4*ax); TL_SetEnd(BRH,date[Midd-Midd/6],time[Midd-Midd/6],Fhi-.2*ax); TL_SetBegin(BRH, date[Midd], time[Midd], Fhi-.4*ax); TL_SetEnd(TLH,date[Midd],time[Midd],Fhi); TL_SetBegin(TLH, date[Midd+Midd/6], time[Midd+Midd/6], Fhi-.2*ax); TL_SetEnd(TRH,date[Midd],time[Midd],Fhi); TL_SetBegin(TRH, date[Midd-Midd/6], time[Midd-Midd/6], Fhi-.2*ax); if close > close[10] then begin TL_SetEnd(LA,date[Flen],time[Flen],Fhi-.2*ax); TL_SetBegin(LA, date[Midd], time[Midd], Fhi-.5*ax); TL_SetEnd(RA,date[1],time[1],Fhi-.2*ax); TL_SetBegin(RA, date[Midd], time[Midd], Fhi-.5*ax); end else begin TL_SetEnd(LA,date[Flen],time[Flen],Fhi-.8*ax); TL_SetBegin(LA, date[Midd], time[Midd], Fhi-.5*ax); TL_SetEnd(RA,date[1],time[1],Fhi-.8*ax); TL_SetBegin(RA, date[Midd], time[Midd], Fhi-.5*ax); end; end; Historical Volatility (GPF's ?) Origin: omega-listWritten by: Craig Nelson Date found: 6 oct 97 { Name: Historical Volatility Created: 10/6/97 02:05 PM } vars: SumSqr(0),Mean(0),Sum(0),counter(0),Hist_Vol(0); inputs: Length(18); array: Stdarray[100](0); if Length > 0 and close > 0 then begin Sum = 0; for counter = 0 to (Length-1) begin Stdarray[counter] = Log(close[counter] / close[counter+1]); Sum = Stdarray[counter] + Sum; end; Mean = Sum / Length; SumSqr = 0; for counter = 0 to (Length-1) begin SumSqr = SumSqr + ((Stdarray[counter] - Mean) * (Stdarray[counter] - Mean)); end; Hist_Vol = SquareRoot(SumSqr / Length)*SquareRoot(250); end else Hist_Vol = 0; plot1(Hist_Vol, "Hist_Vol"); {OK, a little background. This indicator will calculate the correct Historical Volatility, that is the REAL historical volatility based on the daily changes(and not Omega definition of volatility) in closing prices. As far as I know, and based on what I see in my indicator list, there isn't a UF or Indicator that does this. For those that trade options, historical vol is what is compared to market-implied vol to help detect overpriced/underpriced situations and how to figure out if premiums are fat or lean. Anyway, the Indicator verifies OK, but when I try to format the indicator in a chart I get a GPF from TS. I'm not sure if this might be caused by a "stack overflow" from the multitudinous calculations, or if there is a "divide by zero" problem that slipped through the cracks. Can others copy and paste this code into TS and see if they get a GPF? The above code is a combination of "reinventing the wheel", "divide and conquer", and the useful suggestions that poured in after I sent out my initial request. I'm certainly no EL expert, but I'm learning. Thanks to all who helped. Hopefully, if we can get the GPF bug worked out this should be a useful indicator to have, assuming Omega hasn't already included it in TS 4.0 or their next release. My version of TS is 3.51.} Raschke/Connors based Historical Volatility Origin: omega-listWritten by: Robert Adelman Date found: 6 oct 97 {Craig, I did try your Historical Volatility indicator, and it runs just fine. I am not sure why you multiply by sqrt(250). Prior to that point it seems like you have been figuring standard deviation of the log of C/C[1]. Are you trying to annualize the volatility? I have just been writing volatility code in order to look at an idea of Raschke/Connors: the ratio of 6day to 100 day volatility (code below). When I simplify my code to remove the ratio, I end up with the same result as you with a lot less code, and no array (code below). I have also exported the price series into Excel and verified the code, except for the fact that it took me a while to figure out that TS uses log to represent a natural log, ln in Excel.} ******************************************************************* {User function reaHistVol2 Traditional volatility calculation: StdDev(ln(C/C[1]))} inputs:VolLen(numericsimple); Variables: var1(1); Var1 = Log(close/close[1]); reaHistVol2 = stddev(Var1,VolLen); ******************************************************** {Indicator reaHistVol2 Plots volatility as above} inputs: VolLen(18); plot1(reaHistVol2(VolLen),"Hist Vol"); ******************************************************** {User function reaHistVol Computes the ratio of short term/long term volatility} inputs:ShrtVolL(numericsimple),LongVolL(numericsimple); Variables: var1(1),var2(.00001); Var1 = Log(close/close[1]); if Var1 <> 0 then Var2 = Var1 else Var2 = .00001; reaHistVol = stddev(Var2,ShrtVolL)/stddev(Var2,LongVolL); ********************************************************** {Indicator reaHistVol Plots the user function above} inputs: ShrtVolL(6),LongVolL(100); plot1(reaHistVol(ShrtVolL,LongVolL),"HistVol"); *********************************************************** user function for calculating volatility Origin: omega-listWritten by: Jrehler Date found: 7 oct 97 {From: Jrehler, posted by Mark Brown Here is my user function for calculating volatility. Wouldn't it be nice if others were so forth coming? I think the more examples of code you see the better you are able to code and test your theories. I encourage others to publish their code so we all will benefit. (You must name the user function MyVolatility or change the code to a new name) } inputs : Price(numericseries),Length(numericsimple); vars : SumSqr(0),Counter(0),R(0),vari(0),yr_var(0), N(1); if Length <> 0 then begin SumSqr = 0; R = 0; vari = 0; yr_var = 0; N = 1; for counter = 1 to Length begin R = (Price[counter] - Price[counter + 1]) / Price[counter + 1]; r = Log(1 + R); SumSqr = SumSqr + (r - Log(1 + average(R,Length) ) ) * (r - Log(1 + average(R,Length) ) ); end; vari = SumSqr / (Length - 1); if DataCompression = 2 then N = 252 else if DataCompression = 3 then N = 52 else if DataCompression = 4 then N = 12; yr_var = vari * N; HistoricalVolatility = SquareRoot(yr_var); end else HistoricalVolatility = 0; {===end of user function===code for indicator below===} input:price(c),length(25),zone(.150); plot1(HistoricalVolatility(PRICE,LENGTH),"hv"); Cat Tails indicator - FREE Origin: omega-listWritten by: Glenn Orlofsky Date found: 10 oct 97 {This is one of my first indicators which turned into a system. It basically monitors the trend and breakout on a linear regression level using highest highs/lows and a tad a standard deviation. You can modify this for short medium or long term watching. There are two functions that it uses. Try this on a daily chart for starters. The DFrmLstB function counts back the trade days from the last bar (i.e. no Sat or Sun) but doesn't account for Holiday. It will still give an alert even though it can't from on screen because the data is missing **************** Indicator *************} {Raff-Regression Trend Lines Indicator. Created by: G.M. Orlosky, Revised 05/14/97} {TREND LINE INDICATOR. CREATED BY: EMMANUEL LAVELANET, REVISED 07/15/96. Provided by: Omega Research, Inc. (c) Copyright 1996 } {This indicator takes the plot information from a straight Linear Trend Regression Line and plots two parrallel lines using VALDIFF with extensions into the future. The inputs, MAXBACK is the number of days into the past to draw the lines and ANCHOR is the date that you will choose as the point from which your trend line will extend into the past and into the future. If you leave the default of Zero in the input STRENGTH then the number of bars that it will regress for is equal to your chosen MaxbarsBack. If you enter a STRENGTH greater than Zero it will regress to the most recent SwingHigh or SwingLow with that STRENGTH. It projects indefinitely into the future. It also alerts you depending on the condition you enter in the input ALERTIF.} input : BarsBack(numericsimple); var : x(0); if currentbar > 1 then begin value1 = DateToJulian(LastCalcDate); for x = 0 to BarsBack begin value2 = JulianToDate(value1); value3 = DayOfWeek(value2); if value3 = 0 or value3 = 6 then x = x - 1; value1 = value1 - 1; end; DFrmLstB = value2; end; {Instead of entering an offset date for the Anchor input simple type in the function name with the offset; like so... INPUTS : Anchor(DFrmLstB(14)),...;} input:ANCHOR(DFrmLstB(21)),MaxBack(120),AlertIF(false),Strength(0),SwHiOnly(false),SwLoOnly(false); vars:TREND(0),EXTENT(0),TRENDMAX(0),MAXSTREN(MaxBarsBack),HiMark(0),LoMark(0),X(0); Arrays: HiDiff[299](0),LoDiff[299](0),P1Array[299](0); if DataCompression > 1 then begin {1} EXTENT = MaxBack; if Value30 < EXTENT then begin {2} Value30 = Value30 + 1; Value31 = date; end {2}; if date > Value31 then begin {3} if date = ANCHOR then begin {4} if SwHiOnly = true and SwLoOnly = false then begin {5} if STRENGTH > 0 | |||||||||||||||||||||||||||||||||||||||||||||