Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

Tams

Market Wizard
  • Content Count

    4075
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Tams

  1. go to the respective exchange's website. e.g. euro/us$ http://www.cme.com
  2. go to Format Study, you will see that I have entered the description of the 2 plots as "bar high" and "bar low". (mine is MultiCharts, TradeStation should be the same.) .
  3. you have to set these 2 plots as "bar high" and "bar low" Plot1[Displace]( var3, "bar high" ) ; <--- set this as bar high Plot2[Displace]( var2, "bar low" ) ; <--- set this as bar low if you go to Format Study, you will see that I have entered the description of the 2 plots as "bar high" and "bar low".
  4. you can mimic painting the background by layering a thick bar behind the price bars as background color. give this a try: set the first 2 plots as "bar high" and "bar low". inputs: BollingerPrice( Close ), TestPriceUBand( Close ), TestPriceLBand( Close ), Length( 20 ), NumDevsUp( 2 ), NumDevsDn( -2 ), Displace( 0 ) ; variables: var0( 0 ), var1( 0 ), var2( 0 ), var3( 0 ) ; var0 = AverageFC( BollingerPrice, Length ) ; var1 = StandardDev( BollingerPrice, Length, 1 ) ; var3 = var0 + NumDevsUp * var1 ; var2 = var0 + NumDevsDn * var1 ; condition1 = Displace >= 0 or CurrentBar > AbsValue( Displace ) ; if condition1 then begin Plot1[Displace]( var3, "bar high" ) ; Plot2[Displace]( var2, "bar low" ) ; Plot4[Displace]( var3, "UpperBand" ) ; Plot5[Displace]( var2, "LowerBand" ) ; Plot6[Displace]( var0, "MidLine" ) ; if Displace <= 0 then begin condition1 = TestPriceLBand crosses over var2 ; if condition1 then Alert( "Price crossing over lower price band" ) else begin condition1 = TestPriceUBand crosses under var3 ; if condition1 then Alert( "Price crossing under upper price band" ) ; end; end ; end ;
  5. check out this yahoo group. http://finance.groups.yahoo.com/group/TWSAPI/
  6. here's one by ABC. (EasyLanguage) this must be the best rendition I have seen. You can program the start and end time. . abc_floor_trader_pivots_v3-1.txt
  7. {Adaptive CCI From the book 'Rocket Science for Traders' by John Ehlers modified with new cycle measurement method from 'Cybernetic Analysis for Stocks and Futures' mmillar, July 2004 Price - the current price - only used by the Cycle Period measurement, not by the CCI calculation Length - used by the Cycle Period measurement - John Ehlers uses alpha but I have replaced it with the more intuitive Length, where alpha=2/(Length+1) CycPart - allows you to change how much of the cycle period should be used in the CCI calculation - usually 1 } Inputs: Price((H+L)/2), Length(19), CycPart(1); Vars: oResult1(0), oResult2(0); value1=_Oscillators(18, Price, Length, CycPart, 1, 0, 1, oResult1, oResult2); Plot1(oResult1, "AdaptCCI"); _Oscillators function: {A collection of oscillators by John Ehlers by mmillar, July 2004 1-15 are taken from 'Cybernetic Analysis for Stocks and Futures' 16-18 are taken from 'Rocket Science for Traders' and updated using a new cycle period measurement method This function calls the function '_CyclePeriod' to calculate the Dominant Cycle for use in adaptive strategies Oscillator Types 1 - Cyber Cycle 2 - CG Oscillator 3 - Relative Vigor Index (RVI) 4 - Stochastic RSI 5 - Stochastic Cyber Cycle 6 - Stochastic CG 7 - Stochastic RVI 8 - Fisher Cyber Cycle 9 - Fisher CG 10 - Fisher RVI 11 - Adaptive Cyber Cycle 12 - Adaptive CG 13 - Adaptive RVI 14 - Sinewave Indicator 15 - Laguerre RSI 16 - Adaptive RSI 17 - Adaptive Stochastic 18 - Adaptive CCI This function is called with OscType - one of the above Price - some indicators can use a price input e.g. (H+L)/2, Close etc, otherwise this can be set to 0 Length - the length or period that you wish to measure. In some instances John Ehlers uses 'alpha' as his input but I have standardised all inputs using Length and then converted, where necessary, with alpha=2/(Length+1) Length2 - this is a catch all used when an additional input variable is needed (just because everything is done in one function) RSILength, StocLength, WMALength - only used by Stochastic RSI (OscType=4) oResult1, oResult2 - are the results returned by the function } Inputs: OscType(Numeric), Price(Numeric), Length(Numeric), Length2(Numeric), {general inputs} RSILength(Numeric), StocLength(Numeric), WMALength(Numeric), {only used by OscType=4} oResult1(NumericRef), oResult2(NumericRef); {results to return} Vars: alpha(0), count(0), Num(0), Denom(0), Smooth(0), Cycle(0), {for OscType=1, 5, 8, 11} CG(0), {for OscType=2, 6, 9, 12} RVI(0), {for OscType=3, 7, 10, 13} MaxVal(0), MinVal(0), {for OscType=5-10} Period(0), {for OscType=11-18} Cycle1(0), {for OscType=11-18 but only used in 14} Smooth1(0), {for OscType=11-18 but only used in 11} DCPeriod(0), RealPart(0), ImagPart(0), DCPhase(0), {for OscType=14} L0(0), L1(0), L2(0), L3(0), {for OscType=15} vRSI(0), CU(0), CD(0), {for OscType=15, 16} vStoch(0), HH(0), LL(0), {for OscType=17} vCCI(0), Avg(0), MD(0), MPrice(0); {for OscType=18} If ( OscType=1 ) then Begin {Cyber Cycle} alpha=2/(Length+1); Smooth=(Price+2*Price[1]+2*Price[2]+Price[3])/6; Cycle=(1-0.5*alpha)*(1-0.5*alpha)*(Smooth-2*Smooth[1]+Smooth[2])+2*(1-alpha)*Cycle[1]-(1-alpha)*( 1-alpha)*Cycle[2]; If currentbar<7 then Cycle=(Price-2*Price[1]+Price[2])/4; oResult1=Cycle; oResult2=Cycle[1]; end else If ( OscType=2 ) then Begin {CG Oscillator} Num=0; Denom=0; For count=0 to Length-1 Begin Num=Num+(1+count)*Price[count]; Denom=Denom+Price[count]; end; If Denom<>0 then CG=-Num/Denom+(Length+1)/2; oResult1=CG; oResult2=CG[1]; end else If ( OscType=3 ) then Begin {Relative Vigor Index} Value1=((Close-Open)+2*(Close[1]-Open[1])+2*(Close[2]-Open[2])+(Close[3]-Open[3]))/6; Value2=((High-Low)+2*(High[1]-Low[1])+2*(High[2]-Low[2])+(High[3]-Low[3]))/6; Num=0; Denom=0; For count=0 to Length-1 Begin Num=Num+Value1[count]; Denom=Denom+Value2[count]; end; If Denom<>0 then RVI=Num/Denom; oResult1=RVI; oResult2=RVI[1]; end else If ( OscType=4 ) then Begin {Stochastic RSI} Value1=RSI(Close, RSILength)-Lowest(RSI(Close, RSILength), StocLength); Value2=Highest(RSI(Close, RSILength), StocLength)-Lowest(RSI(Close, RSILength), StocLength); If Value2<>0 then Value3=Value1/Value2; Value4=2*(WAverage(Value3, WMALength)-0.5); oResult1=Value4; oResult2=Value4[1]; end else If ( OscType=5 ) then Begin {Stochastic Cyber Cycle} alpha=2/(Length+1); Smooth=(Price+2*Price[1]+2*Price[2]+Price[3])/6; Cycle=(1-0.5*alpha)*(1-0.5*alpha)*(Smooth-2*Smooth[1]+Smooth[2])+2*(1-alpha)*Cycle[1]-(1-alpha)*(1-alpha)*Cycle[2]; If currentbar<7 then Cycle=(Price-2*Price[1]+Price[2])/4; MaxVal=Highest(Cycle, StocLength); MinVal=Lowest(Cycle, StocLength); If MaxVal<>MinVal then Value1=(Cycle-MinVal)/(MaxVal-MinVal); Value2=(4*Value1+3*Value1[1]+2*Value1[2]+Value1[3])/10; Value2=2*(Value2-0.5); oResult1=Value2; oResult2=0.96*(Value2[1]+0.02); end else If ( OscType=6 ) then Begin {Stochastic CG} Num=0; Denom=0; For count=0 to Length-1 Begin Num=Num+(1+count)*Price[count]; Denom=Denom+Price[count]; end; If Denom<>0 then CG=-Num/Denom+(Length+1)/2; MaxVal=Highest(CG, Length); MinVal=Lowest(CG, Length); If MaxVal<>MinVal then Value1=(CG-MinVal)/(MaxVal-MinVal); Value2=(4*Value1+3*Value1[1]+2*Value1[2]+Value1[3])/10; Value2=2*(Value2-0.5); oResult1=Value2; oResult2=0.96*(Value2[1]+0.02); end else If ( OscType=7 ) then Begin {Stochastic RVI} Value1=((Close-Open)+2*(Close[1]-Open[1])+2*(Close[2]-Open[2])+(Close[3]-Open[3]))/6; Value2=((High-Low)+2*(High[1]-Low[1])+2*(High[2]-Low[2])+(High[3]-Low[3]))/6; Num=0; Denom=0; For count=0 to Length-1 Begin Num=Num+Value1[count]; Denom=Denom+Value2[count]; end; If Denom<>0 then RVI=Num/Denom; MaxVal=Highest(RVI, Length); MinVal=Lowest(RVI, Length); If MaxVal<>MinVal then Value3=(RVI-MinVal)/(MaxVal-MinVal); Value4=(4*Value3+3*Value3[1]+2*Value3[2]+Value3[3])/10; Value4=2*(Value4-0.5); oResult1=Value4; oResult2=0.96*(Value4[1]+0.02); end else If ( OscType=8 ) then Begin {Fisher Cyber Cycle} alpha=2/(Length+1); Smooth=(Price+2*Price[1]+2*Price[2]+Price[3])/6; Cycle=(1-0.5*alpha)*(1-0.5*alpha)*(Smooth-2*Smooth[1]+Smooth[2])+2*(1-alpha)*Cycle[1]-(1-alpha)*(1-alpha)*Cycle[2]; If currentbar<7 then Cycle=(Price-2*Price[1]+Price[2])/4; MaxVal=Highest(Cycle, Length2); MinVal=Lowest(Cycle, Length2); If MaxVal<>MinVal then Value1=(Cycle-MinVal)/(MaxVal-MinVal); Value2=(4*Value1+3*Value1[1]+2*Value1[2]+Value1[3])/10; Value3=0.5*Log((1+1.98*(Value2-0.5))/(1-1.98*(Value2-0.5))); oResult1=Value3; oResult2=Value3[1]; end else If ( OscType=9 ) then Begin {Fisher CG} Num=0; Denom=0; For count=0 to length-1 Begin Num=Num+(1+count)*(Price[count]); Denom=Denom+(Price[count]); end; If Denom<>0 then CG=-Num/Denom+(Length+1)/2; MaxVal=Highest(CG, Length); MinVal=Lowest(CG, Length); If MaxVal<>MinVal then Value1=(CG-MinVal)/(MaxVal-MinVal); Value2=(4*Value1+3*Value1[1]+2*Value1[2]+Value1[3])/10; Value3=0.5*Log((1+1.98*(Value2-0.5))/(1-1.98*(Value2-0.5))); oResult1=Value3; oResult2=Value3[1]; end else If ( OscType=10 ) then Begin {Fisher RVI} Value1=((Close-Open)+2*(Close[1]-Open[1])+2*(Close[2]-Open[2])+(Close[3]-Open[3]))/6; Value2=((High-Low)+2*(High[1]-Low[1])+2*(High[2]-Low[2])+(High[3]-Low[3]))/6; Num=0; Denom=0; For count=0 to Length-1 Begin Num=Num+Value1[count]; Denom=Denom+Value2[count]; end; If Denom<>0 then RVI=Num/Denom; MaxVal=Highest(RVI, Length); MinVal=Lowest(RVI, Length); If MaxVal<>MinVal then Value3=(RVI-MinVal)/(MaxVal-MinVal); Value4=(4*Value3+3*Value3[1]+2*Value3[2]+Value3[3])/10; Value5=0.5*Log((1+1.98*(Value4-0.5))/(1-1.98*(Value4-0.5))); oResult1=Value5; oResult2=Value5[1]; end else If ( OscType=11 ) then Begin {Adaptive Cyber Cycle} alpha=2/(Length+1); Period=_CyclePeriod(Price, alpha, Cycle1, Smooth1); alpha=2/(Period+1); Cycle=(1-0.5*alpha)*(1-0.5*alpha)*(Smooth1-2*Smooth1[1]+Smooth1[2])+2*(1-alpha)*Cycle[1]-(1-alpha)*(1-alpha)*Cycle[2]; If currentbar<7 then Cycle=(Price-2*Price[1]+Price[2])/4; oResult1=Cycle; oResult2=Cycle[1]; end else If ( OscType=12 ) then Begin {Adaptive CG} alpha=2/(Length+1); Period=_CyclePeriod(Price, alpha, Cycle1, Smooth1); Value1=IntPortion(Period/2); {use half the cycle period} Num=0; Denom=0; For count=0 to Value1-1 Begin Num=Num+(1+count)*(Price[count]); Denom=Denom+(Price[count]); end; If Denom<>0 then CG=-Num/Denom+(Value1+1)/2; oResult1=CG; oResult2=CG[1]; end else If ( OscType=13 ) then Begin {Adaptive RVI} alpha=2/(Length+1); Period=_CyclePeriod(Price, alpha, Cycle1, Smooth1); Value3=IntPortion((4*Period+3*Period[1]+2*Period[3]+Period[4])/20); Value1=((Close-Open)+2*(Close[1]-Open[1])+2*(Close[2]-Open[2])+(Close[3]-Open[3]))/6; Value2=((High-Low)+2*(High[1]-Low[1])+2*(High[2]-Low[2])+(High[3]-Low[3]))/6; Num=0; Denom=0; For count=0 to Value3-1 Begin Num=Num+Value1[count]; Denom=Denom+Value2[count]; end; If Denom<>0 then RVI=Num/Denom; oResult1=RVI; oResult2=RVI[1]; end else If ( OscType=14 ) then Begin {Sinewave Indicator} alpha=2/(Length+1); Period=_CyclePeriod(Price, alpha, Cycle1, Smooth1); DCPeriod=IntPortion(Period); RealPart=0; ImagPart=0; For count=0 to DCPeriod-1 Begin RealPart=RealPart+Sine(360*count/DCPeriod)*(Cycle1[count]); ImagPart=ImagPart+Cosine(360*count/DCPeriod)*(Cycle1[count]); end; If AbsValue(ImagPart)>0.001 then DCPhase=Arctangent(RealPart/ImagPart); If AbsValue(ImagPart)<=0.001 then DCPhase=90*Sign(RealPart); DCPhase=DCPhase+90; If ImagPart<0 then DCPhase=DCPhase+180; If DCPhase>315 then DCPhase=DCPhase-360; oResult1=Sine(DCPhase); oResult2=Sine(DCPhase+45); end else If ( OscType=15 ) then Begin {Laguerre RSI} L0=(1-Length2)*Close+Length2*L0[1]; L1=-Length2*L0+L0[1]+Length2*L1[1]; L2=-Length2*L1+L1[1]+Length2*L2[1]; L3=-Length2*L2+L2[1]+Length2*L3[1]; CU=0; CD=0; If L0>=L1 then CU=L0-L1 else CD=L1-L0; If L1>=L2 then CU=CU+L1-L2 else CD=CD+L2-L1; If L2>=L3 then CU=CU+L2-L3 else CD=CD+L3-L2; If CU+CD<>0 then vRSI=CU/(CU+CD); oResult1=vRSI; oResult2=0; end else If ( OscType=16 ) then Begin {Adaptive RSI} alpha=2/(Length+1); Period=_CyclePeriod(Price, alpha, Cycle1, Smooth1); CU=0; CD=0; For count=0 to (Period*Length2)-1 Begin If Close[count]-Close[count+1]>0 then CU=CU+(Close[count]-Close[count+1]); If Close[count]-Close[count+1]<0 then CD=CD+(Close[count+1]-Close[count]); end; If CU+CD<>0 then vRSI=100*CU/(CU+CD); oResult1=vRSI; oResult2=0; end else If ( OscType=17 ) then Begin {Adaptive Stochastic} alpha=2/(Length+1); Period=_CyclePeriod(Price, alpha, Cycle1, Smooth1); HH=High; LL=Low; For count=0 to IntPortion(Period*Length2)-1 Begin If High[count]>HH then HH=High[count]; If Low[count]<LL then LL=Low[count]; end; If HH-LL<>0 then vStoch=(Close-LL)/(HH-LL); oResult1=vStoch; oResult2=0; end else If ( OscType=18 ) then Begin {Adaptive CCI} alpha=2/(Length+1); Period=_CyclePeriod(Price, alpha, Cycle1, Smooth1); Value1=IntPortion(Period*Length2); MPrice=(High+Low+Close)/3; Avg=0; For count=0 to Value1-1 Begin Avg=Avg+MPrice[count]; end; If Value1<>0 then Avg=Avg/Value1; MD=0; For count=0 to Value1-1 Begin MD=MD+AbsValue(MPrice[count]-Avg); end; If Value1<>0 then MD=MD/Value1; If MD<>0 then vCCI=(MPrice-Avg)/(0.015*MD); oResult1=vCCI; oResult2=0; end; _Oscillators=1; _cycleperiod function {Cycle Period Measurement From the book 'Cybernetic Analysis for Stocks and Futures' by John Ehlers mmillar, July 2004 This function is called with Price - the current price, such as (H+L)/2 or Close alpha - the alpha (which is related to the measurement period/length) oCycle - a return variable that is needed by some indicators } Inputs: Price(numeric), alpha(numeric), oCycle(numericref), oSmooth(numericref); Vars: Smooth(0), Cycle(0), Q1(0), I1(0), DC(0), DeltaPhase(0), MedianDelta(0), InstPeriod(0), Period(0); Smooth=(Price+2*Price[1]+2*Price[2]+Price[3])/6; Cycle=(1-0.5*alpha)*(1-0.5*alpha)*(Smooth-2*Smooth[1]+Smooth[2])+2*(1-alpha)*Cycle[1]-(1-alpha)*(1 -alpha)*Cycle[2]; If currentbar<7 then Cycle=(Price-2*Price[1]+Price[2])/4; Q1=(0.0962*Cycle+0.5769*Cycle[2]-0.5769*Cycle[4]-0.0962*Cycle[6])*(0.5+0.08*InstPeriod[1]); I1=Cycle[3]; If Q1<>0 and Q1[1]<>0 then DeltaPhase=(I1/Q1-I1[1]/Q1[1])/(1+I1*I1[1]/(Q1*Q1[1])); If DeltaPhase<0.1 then DeltaPhase=0.1; If DeltaPhase>1.1 then DeltaPhase=1.1; MedianDelta=Median(DeltaPhase, 5); If MedianDelta=0 then DC=15 else DC=6.28318/MedianDelta+0.5; InstPeriod=0.33*DC+0.67*InstPeriod[1]; Period=0.15*InstPeriod+0.85*Period[1]; oCycle=Cycle; oSmooth=Smooth; _CyclePeriod=Period;
  8. I have added up/down color [LegacyColorValue = true]; Input: LongLeg(35), ShortLeg(5), MultiLeg(10), MultiW(1), Show_print(false); input: upcol(blue), dncol(red); Var: SyncShort(0), SyncLong(0), SyncMulti(0); Var: TempSyncS(0), TempSyncL(0), TempSyncM(0), MultiOsc(0); Var: LongWeight(0), ShortWeight(0), MultiWeight(0), MultiHigh(0), MultiLow(0); var: DateLock(980116); ShortWeight = 2/(ShortLeg + 1); LongWeight = 2/(LongLeg + 1); if TempSyncS = 0 then Begin SyncShort = Close; SyncLong = Close; end Else Begin SyncShort = TempSyncS * (1 - ShortWeight) + (ShortWeight * Close); SyncLong = TempSyncL * (1 - LongWeight) + (LongWeight * Close); end; TempSyncS = SyncShort; TempSyncL = SyncLong; MultiOsc = (100 * ( (SyncShort / SyncLong) - 1) ); plot1(MultiOsc, "MO"); MultiWeight = 2/(MultiLeg + 1); if TempSyncM = 0 then SyncMulti = MultiOsc Else SyncMulti = (AbsValue(TempSyncM) * (1 - MultiWeight)) + (MultiWeight * MultiOsc); TempSyncM = SyncMulti; MultiHigh = SyncMulti * MultiW; MultiLow = -1 * MultiHigh; Plot2(MultiHigh,"MH"); Plot3(MultiLow,"ML"); if SHOW_print then Print("MO:", MultiOsc, " MH: ", MultiHigh, " ML: ", MultiLow); if MultiOsc > MultiHigh then SetPlotColor(1, upcol) else if MultiOsc < Multilow then SetPlotColor(1, dncol); plot4(0, "Zero");
  9. which platform do you want to use this counter? if you can write out your logic in pseudo code, you are half way there.
  10. what platform you are using?
  11. The indicator and function VERIFIED ! That's the important thing; that means the code was good. You have achieved a mile stone. Congratulations, Give yourself a pad on the back. The error message "tried to reference future data" means the indicator is a very sensitive one: you need to adjust the variables to meet the chart's volatility. Go into Format Study and change the "Len" to 30. You can use this as a starting point to fine tune the indicator.
  12. TL_Setsize will only apply to trendlines. if you bracket out all statements with "text_setsize", the text will be in the default size. they will be a bit small, but perfectly readable. Sorry for the oversight and inconvenience. :-(
  13. 1. every time you import, you must verify the codes before they can be used. (another term for verify is "compile"). 2. please first delete the "Triangle" function from your computer. The function needs to be set to TrueFalse. This will be done automatically when you import from ELS. I have imported the above codes to MultiCharts and they compile with no problem.
  14. I have posted an EasyLanguage Candle Pattern Identification indicator here: http://www.traderslaboratory.com/forums/f56/free-easylanguage-indicators-5418.html#post59489 This indicator prints the candle name on the bottom of the screen. .
  15. Candle Patterns This program prints the candle pattern on the bottom of the screen. . Candle_Patterns(TS).txt
  16. The function Triangle returns a True or False condition. When you set up the new function, TS would ask you for the return type. Select TrueFalse.
  17. Good news. Fredd has posted an ELD here: http://www.traderslaboratory.com/forums/f56/free-easylanguage-indicators-5418.html#post59382
  18. Man, you are fast. Thank a million!
  19. Here's the SPM strategy in EasyLanguage. Someone can run it through the mill and see for himself. inputs: FAVG(3),SAVG(9); vars: FA(0),SA(0),FA1(0),SA1(0); FA=average(close,FAVG); SA=average(close,SAVG); value1=0; FA1=0; SA1=0; if FA<SA then begin while FA1<=SA1 begin value1=value1+1; FA1=((FA*(FAVG-1))+(c+(value1*tick)))/FAVG; SA1=((SA*(SAVG-1))+(c+(value1*tick)))/SAVG; end; buy next bar at c+(value1*tick) stop; end; if FA>SA then begin while FA1>=SA1 begin value1=value1+1; FA1=((FA*(FAVG-1))+(c-(value1*tick)))/FAVG; SA1=((SA*(SAVG-1))+(c-(value1*tick)))/SAVG; end; sell short next bar at c-(value1*tick) stop; end;
  20. Awesome Oscillator Bill Williams This oscillator is popular with forex traders, but can be applied to any market. Both the AO (Awesome Oscillaor) and AC (Accelarator) are included in this indicator. Just format the option to either True or False. Bill William had the moving averages set at 5, 34. I have made it user adjustable, so that you can experiment with your own settings. . AO_AC_(TS).txt
  21. Please give this a try. This is the original written in TradeStation. (It does not have the lines I added.) . HH_LL_TradeStation.txt
  22. The settings for the Ergodic Indicator are: 49, 147, 49
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.