// Downloaded From https://www.WiseStockTrader.com m = Param("Pds", 17, 10, 30, 1 ); SetChartOptions(0,chartShowArrows|chartShowDates); _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g,Hi %g,Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) )); barcolor =IIf(C>O, ParamColor("Up candlestick", colorBrightGreen ), ParamColor("Down candlestick", colorOrange )); Plot( C, "Close", barColor, 64); a=MA(Close,m)+abs(MA(Close,m)-Ref(MA(Close,m),-1)); b=MA(Close,m)+MA(Close,m)-Ref(MA(Close,m),-1); balance=IIf(MA(Close,m)sig); pm=MA(C,5); pmcolor=IIf(pm>Ref(pm,-1),10, 11); Plot(pm,"PM", pmcolor,4); Linecolor = IIf(Cross(pm,sig) OR (pm>Ref(pm,-1) AND Ref(pm,-1)<=Ref(pm,-2)), colorBrightGreen, IIf(Cross(sig,pm) OR (pm=Ref(pm,-2)), colorRed, 3)); Plot(5, "",Linecolor, styleOwnScale|styleArea|styleNoLabel,-0.5, 350 ); _SECTION_BEGIN("Volume"); Plot( Volume, "Volume", ParamColor("Color", colorLightGrey ), 2 | 32768 ); _SECTION_END(); _SECTION_BEGIN("Exploration"); Buy = Cross(pm,sig) OR (pm>Ref(pm,-1) AND Ref(pm,-1)<=Ref(pm,-2)); Sell =Cross(sig,pm) OR (pm=Ref(pm,-2)); pfrom = Param("Price From", 0, 0, 1000, 0.5 ); pto = Param("Price To", 1000, 0, 1000, 0.5 ); Minv = Param("Minimum Volume (K)", 500, 0, 1000, 50); dd = Param("Decimal Digits", 1.2, 1, 1.7, 0.1 ); Filter = (Buy OR Sell) AND C>pfrom AND C1000*Minv; Color = IIf(Close>Open, colorGreen, colorRed); bcolor = IIf(Buy, colorGreen, 1); scolor = IIf(Sell, colorRed, 1); AddColumn(Buy , "Buy" , 1.1, bcolor); AddColumn(Sell , "Sell", 1.1, scolor); AddColumn(O, "Open", dd, textColor = Color); AddColumn(C, "Close", dd, textColor = Color); AddColumn(V, "Volume", 1, textColor = Color); AddTextColumn(FullName(),"Name"); _SECTION_END(); _SECTION_BEGIN("Chaloke.com Peak"); //Chaloke.com Peak-Trough System + Auto ATR + Position sizing+Varible Sensitivity// // Last Update 16 Oct 05 By Kook// PctVlt=(ATR(14)/C)*100;//PercentVolatility PK=IIf(PctVlt<0.5,Peak(Close,0.5,1), IIf( PctVlt>=0.5 AND PctVlt< 1.0 ,Peak(Close,0.70,1), IIf( PctVlt>=1.0 AND PctVlt< 1.5 ,Peak(Close,0.90,1), IIf( PctVlt>=1.5 AND PctVlt< 2.0 ,Peak(Close,1.10,1), IIf( PctVlt>=2.0 AND PctVlt< 2.5 ,Peak(Close,1.30,1), IIf( PctVlt>=2.5 AND PctVlt< 3.0 ,Peak(Close,1.50,1), IIf( PctVlt>=3.0 AND PctVlt< 3.5 ,Peak(Close,1.70,1), IIf( PctVlt>=3.5 AND PctVlt< 4.0 ,Peak(Close,2.00,1), Peak(Close,2.20,1) )))))))); TGH=IIf(PctVlt<0.5,Trough(Close,0.5,1), IIf( PctVlt>=0.5 AND PctVlt< 1.0 ,Trough(Close,0.75,1), IIf( PctVlt>=1.0 AND PctVlt< 1.5 ,Trough(Close,1.00,1), IIf( PctVlt>=1.5 AND PctVlt< 2.0 ,Trough(Close,1.25,1), IIf( PctVlt>=2.0 AND PctVlt< 2.5 ,Trough(Close,1.50,1), IIf( PctVlt>=2.5 AND PctVlt< 3.0 ,Trough(Close,1.75,1), IIf( PctVlt>=3.0 AND PctVlt< 3.5 ,Trough(Close,2.00,1), IIf( PctVlt>=3.5 AND PctVlt< 4.0 ,Trough(Close,2.25,1), Trough(Close,2.50,1) )))))))); Sens=IIf(PctVlt<0.5,0.5, IIf( PctVlt>=0.5 AND PctVlt< 1.0 ,0.75, IIf( PctVlt>=1.0 AND PctVlt< 1.5 ,1.00, IIf( PctVlt>=1.5 AND PctVlt< 2.0 ,1.25, IIf( PctVlt>=2.0 AND PctVlt< 2.5 ,1.50, IIf( PctVlt>=2.5 AND PctVlt< 3.0 ,1.75, IIf( PctVlt>=3.0 AND PctVlt< 3.5 ,2.00, IIf( PctVlt>=3.5 AND PctVlt< 4.0 ,2.25, 2.50 )))))))); Color=IIf(BarsSince(Cross(C,Ref(PK,-1))) even,triangularOdd,TriangularEven); Color=colorBrightGreen;//select Moving average line color tickercolor=colorBlack;//select price color Plot(finalMov_avg,"",IIf(C < finalmov_avg,colorRed,Color),styleDots|styleThick) ; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Previous Days HI LO // DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// yesterdays high DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low DayC = TimeFrameGetPrice("C", inDaily, -1); // yesterdays close DayO = TimeFrameGetPrice("O", inDaily); // current day open DayH2= TimeFrameGetPrice("H", inDaily, -2); DayH2I = LastValue (DayH2,1); // Two days before high DayL2= TimeFrameGetPrice("L", inDaily, -2); DayL2I = LastValue (DayL2,1); // Two days before low DayH3= TimeFrameGetPrice("H", inDaily, -3); DayH3I = LastValue (DayH3,1); // Three days before high DayL3= TimeFrameGetPrice("L", inDaily, -3); DayL3I = LastValue (DayL3,1); // Three days before low numbars = LastValue(Cum(Status("barvisible"))); hts = -33.5; YHL = ParamToggle("Yesterday HI LO","Show|Hide",1); if(YHL==1) { Plot(DayL,"YL",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(DayH,"YH",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle); PlotText(" YH " , LastValue(BarIndex())-(numbars/Hts), DayHI, colorTurquoise); PlotText(" YL " , LastValue(BarIndex())-(numbars/Hts), DayLI, colorTurquoise); } TDBHL = ParamToggle("2/3Days before HI LO","Show|Hide",0); if(TDBHL==1) { Plot(DayL2,"2DBL",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(DayH2,"2DBH",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(DayL3,"3DBL",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(DayH3,"3DBH",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle); PlotText(" 2DBH " , LastValue(BarIndex())-(numbars/Hts), DayH2I, colorTurquoise); PlotText(" 2DBL " , LastValue(BarIndex())-(numbars/Hts), DayL2I, colorTurquoise); PlotText(" 3DBH " , LastValue(BarIndex())-(numbars/Hts), DayH3I, colorTurquoise); PlotText(" 3DBL " , LastValue(BarIndex())-(numbars/Hts), DayL3I, colorTurquoise); } // Pivot Levels // PP = (DayL + DayH + DayC)/3; PPI = LastValue (PP,1); // Pivot R1 = (PP * 2) - DayL; R1I = LastValue (R1,1); // Resistance 1 S1 = (PP * 2) - DayH; S1I = LastValue (S1,1); // Support 1 R2 = PP + R1 - S1; R2I = LastValue (R2,1); // Resistance 2 S2 = PP - R1 + S1; S2I = LastValue (S2,1); // Support 2 R3 = PP + R2 - S1; R3I = LastValue (R3,1); // Resistance 3 S3 = PP - R2 + S1; S3I = LastValue (S3,1); // Support 3 ppl = ParamToggle("Pivot Levels","Show|Hide",1); if(ppl==1) { Plot(PP, "PP",colorYellow,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(R1, "R1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(S1, "S1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(R2, "R2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(S2, "S2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(R3, "R3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(S3, "S3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle); PlotText(" Pivot ", LastValue(BarIndex())-(numbars/Hts), PPI, colorYellow); PlotText(" R1 " , LastValue(BarIndex())-(numbars/Hts), R1I, colorViolet); PlotText(" S1 " , LastValue(BarIndex())-(numbars/Hts), S1I, colorViolet); PlotText(" R2 " , LastValue(BarIndex())-(numbars/Hts), R2I, colorViolet); PlotText(" S2 " , LastValue(BarIndex())-(numbars/Hts), S2I, colorViolet); PlotText(" R3 " , LastValue(BarIndex())-(numbars/Hts), R3I, colorViolet); PlotText(" S3 " , LastValue(BarIndex())-(numbars/Hts), S3I, colorViolet); } // Camerilla Levels // rg = (DayH - DayL); H5=DayC+1.1*rg; H5I = LastValue (H5,1); H4=DayC+1.1*rg/2; H4I = LastValue (H4,1); H3=DayC+1.1*rg/4; H3I = LastValue (H3,1); H2=DayC+1.1*rg/6; H2I = LastValue (H2,1); H1=DayC+1.1*rg/12; H1I = LastValue (H1,1); L1=DayC-1.1*rg/12; L1I = LastValue (L1,1); L2=DayC-1.1*rg/6; L2I = LastValue (L2,1); L3=DayC-1.1*rg/4; L3I = LastValue (L3,1); L4=DayC-1.1*rg/2; L4I = LastValue (L4,1); L5=DayC-1.1*rg; L5I = LastValue (L5,1); pcl = ParamToggle("Camerilla Levels","Show|Hide",0); if(pcl==1) { Plot(H5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(H4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(H3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(H2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(H1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(L1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(L2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(L3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(L4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle); Plot(L5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle); PlotText(" H5 = " , LastValue(BarIndex())-(numbars/Hts), H5I +0.05, colorRose); PlotText(" H4 = " , LastValue(BarIndex())-(numbars/Hts), H4I +0.05, colorRose); PlotText(" H3 = " , LastValue(BarIndex())-(numbars/Hts), H3I +0.05, colorRose); PlotText(" H2 = " , LastValue(BarIndex())-(numbars/Hts), H2I +0.05, colorRose); PlotText(" H1 = " , LastValue(BarIndex())-(numbars/Hts), H1I +0.05, colorRose); PlotText(" L1 = " , LastValue(BarIndex())-(numbars/Hts), L1I +0.05, colorRose); PlotText(" L2 = " , LastValue(BarIndex())-(numbars/Hts), L2I +0.05, colorRose); PlotText(" L3 = " , LastValue(BarIndex())-(numbars/Hts), L3I +0.05, colorRose); PlotText(" L4 = " , LastValue(BarIndex())-(numbars/Hts), L4I +0.05, colorRose); PlotText(" L5 = " , LastValue(BarIndex())-(numbars/Hts), L5I +0.05, colorRose); } // Current Days Hi Lo // THL = ParamToggle("Todays Hi Lo","Show|Hide",1); if(THL==1) { isRth = TimeNum() >= 084500 & TimeNum() <= 085959; isdRth = TimeNum() >= 084500 & TimeNum() <= 160000; aRthL = IIf(isRth, L, 1000000); aRthH = IIf(isdRth, H, Null); aRthLd = IIf(isdRth, L, 1000000); DayH = TimeFrameCompress( aRthH, inDaily, compressHigh ); DayH = TimeFrameExpand( DayH, inDaily, expandFirst ); DayL = TimeFrameCompress( aRthLd, inDaily, compressLow ); DayL = TimeFrameExpand( DayL, inDaily, expandFirst ); Bars = BarsSince(TimeNum() >= 94500 AND TimeNum() < 095959);//,BarIndex(),1); // AND DateNum()==LastValue(DateNum()); x0 = BarCount-LastValue(Bars); x1 = BarCount-1; DayHline=LineArray(x0,LastValue(DayH),x1,LastValue (DayH),0); DayLline=LineArray(x0,LastValue(DayL),x1,LastValue (DayL),0); DayHlineI = LastValue (DayHline,1); DayLlineI = LastValue (DayLline,1); Plot(DayHline,"DayH",colorYellow,styleBar|styleNoRescale|styleNoTitle); Plot(DayLline,"DayL",colorYellow,styleBar|styleNoRescale|styleNoTitle); PlotText(" Day Hi " , LastValue(BarIndex())-(numbars/Hts), DayHlineI +0.05, colorYellow); PlotText(" Day Lo " , LastValue(BarIndex())-(numbars/Hts), DayLlineI +0.05, colorYellow); } /////////////////////////////////////////////////////////////////////////////////////////////////////////// _SECTION_BEGIN("RI Auto Trading System"); acc = Param("Acceleration", 0.1, 0, 1, 0.001 ); accm = Param("Max. acceleration", 0.06, 0, 1, 0.001 ); Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( "Color", colorDarkGreen ), ParamStyle("Style", styleLine | styleLine, maskDefault | styleLine | styleLine ) ); Buy = Cross(Open, SAR(acc,accm)); Sell = Cross(SAR(acc,accm), Open ); PlotShapes(IIf(Buy,shapeUpArrow,shapeNone), colorYellow, 0, Low, Offset=-15); PlotShapes(IIf(Buy,shapeSmallCircle,shapeNone), colorBrightGreen, 0, Low, Offset=-28); PlotShapes(IIf(Sell, shapeDownArrow,shapeNone), colorWhite, 0, High, Offset=-15); PlotShapes(IIf(Sell, shapeSmallCircle,shapeNone), colorRed, 0, High, Offset= 28); AlertIf( Buy, "SOUND C:\\Windows\\Media\\Chord.wav", "Audio alert", 2 ); AlertIf( Sell, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 ); _SECTION_END(); /////////////////////////////////////////////////////////////////////////////////////////////////////////// _SECTION_BEGIN("Break Outs"); //{Buy} x1=5; x2=4; x3=3; x4=2; x5=1; x6=.5; //{Lowest price stock <5} AA=IIf(C<5,Cross(C,ValueWhen(Peak(H,x1,1) !=Ref(Peak(H,x1,1),-1),H,1)), //{Price between 5 AND 20} IIf(C>5 AND C<20,Cross(C,ValueWhen(Peak(H,x2,1) !=Ref(Peak(H,x2,1),-1),H,1)), //{Price between 20 AND 70} IIf(C>20 AND C<70,Cross(C,ValueWhen(Peak(H,x3,1) !=Ref(Peak(H,x3,1),-1),H,1)), //{Price between 70 AND 150} IIf(C>70 AND C<150,Cross(C,ValueWhen(Peak(H,x4,1) !=Ref(Peak(H,x4,1),-1),H,1)), //{Price between 150 AND 300} IIf(C>150 AND C<300,Cross(C,ValueWhen(Peak(H,x5,1) !=Ref(Peak(H,x5,1),-1),H,1)), //{Price over 300} Cross(C,ValueWhen(Peak(H,x6,1)!=Ref(Peak(H,x6,1),-1),H,1))))))); //{Sell } x1=5; x2=4; x3=3; x4=2; x5=1; x6=.5; //{Lowest price stock <5} BB=IIf(C<5,Cross(ValueWhen(Trough(L,x1,1) !=Ref(Trough(L,x1,1),-1),L,1),C), //{Price between 5 AND 20} IIf(C>5 AND C<20,Cross(ValueWhen(Trough(L,x2,1) !=Ref(Trough(L,x2,1),-1),L,1),C), //{Price between 20 AND 70} IIf(C>20 AND C<70,Cross(ValueWhen(Trough(L,x3,1) !=Ref(Trough(L,x3,1),-1),L,1),C), //{Price between 70 AND 150} IIf(C>70 AND C<150,Cross(ValueWhen(Trough(L,x4,1) !=Ref(Trough(L,x4,1),-1),L,1),C), //{Price between 150 AND 300} IIf(C>150 AND C<300,Cross(ValueWhen(Trough(L,x5,1) !=Ref(Trough(L,x5,1),-1),L,1),C), //{Price over 300} Cross(ValueWhen(Trough(L,x6,1)!=Ref(Trough(L,x6,1) ,-1),L,1),C)))))); Color=IIf(BarsSince(AA)>BarsSince(BB),colorRed,IIf (RSI()>70,colorCustom11,colorDarkGreen)); ///////////////////////////////////////////////////////////////////////////////////////////////// ///// Trailing Stop Module ///// P6=Param("Trailing Stop Risk",2.5,2,3.5,0.1); P7=Param("Trailing Stop LookBack",2,5,25,1); P8=Param("Trailing Stop PrevLow Switch",0,0,1,1); PrevLow=IIf(P8==1, Ref(C,-TroughBars(C,3,1)) ,Null); //Plot(PrevLow,"",colorRed); //Position sizing// MyTotalPort = Param("MyTotalPort",1000000,10000,10000000,100000) ; AcceptableRisk = Param("AcceptableRisk",0.5,0.1,3,0.1); BarsFromStart = BarsSince(Cross(AA,BB)AND Ref(Color,-1)==colorRed) ; InitialStopLoss =Ref( H - P6*ATR(P7),-BarsFromStart); PositionSizing = 0.01*AcceptableRisk*MyTotalPort/( C - InitialStopLoss ); PPP = IIf( HHV(H - P6*ATR(P7),BarsFromStart+1) lastHPIdx) { // -- Bar and price info for candidate pivot candIdx = curBar - aHHVBars[curBar]; candPrc = aHHV[curBar]; if ( lastHPH < candPrc AND candIdx > lastLPIdx AND candIdx < curBar) { // -- OK, we'll add this as a pivot... aHPivs[candIdx] = 1; // ...and then rearrange elements in the // pivot information arrays for (j=0; j candPrc AND candIdx > lastHPIdx AND candIdx < curBar) { // -- OK, we'll add this as a pivot... aLPivs[candIdx] = 1; // ...and then rearrange elements in the // pivot information arrays for (j=0; j lastHPIdx) { // -- Bar and price info for candidate pivot candIdx = curBar - aHHVBars[curBar]; candPrc = aHHV[curBar]; if ( lastHPH < candPrc AND candIdx > lastLPIdx AND candIdx < curBar) { // -- OK, we'll add this as a pivot... aHPivs[candIdx] = 1; // ...and then rearrange elements in the // pivot information arrays for (j=0; j candPrc AND candIdx > lastHPIdx AND candIdx < curBar) { // -- OK, we'll add this as a pivot... aLPivs[candIdx] = 1; // ...and then rearrange elements in the // pivot information arrays for (j=0; jMDI()AND Signal()PDI()AND Signal()>MACD(); Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon", IIf( uptrend, colorGreen, IIf( downtrend, colorRed, colorBlack )), /* choose color */ styleOwnScale|styleArea|styleNoLabel, -0.5, 100 ); _SECTION_END(); GraphXSpace=15; //////////////////////////////////////////////////////////////////////////////