Permission denied!

Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Ribbon for Amibroker (AFL)
reb
over 14 years ago
Amibroker (AFL)

Rating:
5 / 5 (Votes 1)
Tags:
trading system, amibroker

For EOD trade combination of other afls. Displays lots of different signals in different colors.

Similar Indicators / Formulas

EMA crossover
Submitted by Ketan-0 almost 14 years ago
Kase Peak Osc. V2 batu
Submitted by batu1453 over 10 years ago
Kase CD V2batu
Submitted by batu1453 over 10 years ago
Ichimoku
Submitted by prashantrdx over 10 years ago
Pride System Modified
Submitted by niladri almost 13 years ago
Adaptive Price Zone (APZ)
Submitted by AndrewThomas almost 14 years ago

Indicator / Formula

Copy & Paste Friendly




/////////////////////////////// 
// CCI Panel for Amibroker Dr. Bob
// Codded/Added by Dennis, Kris, Wring
// Last Update: 11/25/2007
/////////////////////////////// 
// Go to www.tradershaven.net to learn everything about this system.
// You must be a registered user to see the images and downloads.
/////////////////////////////// 
// Setup Axes and Grid section (right click on chart panel, click on Parameters):
// Scaling: Custom , Min=-250  Max=250
// Show Date Axis = Yes , Show Middle Lines = No
/////////////////////////////// 
// To activate the timer properly, make sure the following is set:
// click on Tools==>Preferences==>Intraday....
// make sure "Allign minute bars to market hours" is checked...
// make sure "Start time of interval" is checked...
// make sure "Override: Weekly/monthly bars use day of last trade" is checked.
/////////////////////////////// 
// Tic/PIP values: YM=1.0, ER2=0.10, NQ=0.25, EUR/USD=.0001, USD/JPY=0.01, Stocks=0.01
// Rangebar Settings :
// ER2 1.50 
// YM 25  
// ES 3 
// NQ 3.75 
// DAX 5  
// ZG 1.5  
/////////////////////////////// 
// Discalimer: For educational purposes only. Trade at your own risk.
///////////////////////////////

// Timer

TTMperiod = 6; 
Low_ma = EMA(L, TTMperiod); 
High_ma = EMA(H, TTMperiod); 
Low_third = (High_ma - Low_ma) / 3 + Low_ma; 
High_third = 2 * (High_ma - Low_ma) / 3 + Low_ma; 
tempnum = Now( 4 ) - TimeNum(); 
TimeRem = Interval() - ((int(tempnum[BarCount - 1] / 100) * 60) + (tempnum[BarCount - 1] - int(tempnum[BarCount - 1] / 100) * 100)); 
if (TimeRem[BarCount - 1] < 0) TimeRem = 0; 
MinuteVar = int(TimeRem / 60); 
SecondsVar = int(frac(TimeRem / 60) * 60); 
if (TimeRem[BarCount - 1] > 60) 
{ 
TitleTimeRem = EncodeColor(colorWhite) + MinuteVar + ":" + WriteIf(SecondsVar > 9, "", "0") + SecondsVar; 
} 
else if (TimeRem[BarCount - 1] > 20) 
{ 
TitleTimeRem =  EncodeColor(colorYellow) + MinuteVar + ":" + WriteIf(SecondsVar > 9, "", "0") + SecondsVar; 
} 
else 
{ 
TitleTimeRem = EncodeColor(colorRed) + MinuteVar + ":" + WriteIf(SecondsVar > 9, "", "0") + SecondsVar; 
}  

// Background colors

//SetChartBkColor(ParamColor("Panel color ",colorPaleBlue)); 

// CCI Colors

zcolor=ParamColor("WCCI color",colorBlack);
z6color=ParamColor("TCCI color",colorBrown);
patterncolor=ParamColor("Pattern trace color",colorWhite);

// Tic/PIP value

TicMult= Param("Tic multiplier(ER2=10,YM=1,ES=4,FOREX=1)",1,0,1000000);
TicDiv= Param("Tic or PIP value(ER2=0.1,YM=1,FOREX=1)",1,0,1000000);

// Spread

spread= Param("Spread (included in stop)",0,0,1000000); 

// Stop value

stopval= Param("Stop above/below entry bar",2,0,1000000); 

// CCI periods

zperiod=Param("WCCI Period",14,0,100);
z = CCI(zperiod); 
z6period=Param("TCCI Period",6,0,100);
z6 = CCI(z6period); 
z50period=Param("Long Term CCI Period",50,0,1000);
z50 = CCI(z50period); 

// Rangebar interval

rbint= Param("Rangebar interval:(YM=25.0,AB=1.5,NQ=3.75,ES=3.0)",1.0,0.25,1000000);

// Rangebar counter

rbcounter= round(((rbint-(H-L))) * ticmult);
rbcounterpercent= round((rbcounter/(rbint * ticmult))*100);

// Timer/counter title

timercode= Param("Timer:(minutes=1,rangebar=2)",1,1,2);
timetitle= WriteIf(timercode==1,TitleTimeRem, EncodeColor(colorWhite) + "Countdown  " + rbcounter + "  (" + rbcounterpercent + "%)"); 

// Plot grids

PlotTheGrids = ParamToggle("Plot grids","No|Yes",0); 
if (PlotTheGrids ==1) 
{ 
PlotGrid(0); 
PlotGrid(-100); 
PlotGrid(100);
PlotGrid(-200); 
PlotGrid(200); 
} 

// EMA 34

EMA34 = EMA(C,34); 

// Color the bars for Woodies Trend Following 

Plusbars = BarsSince(z < 0); 
Minusbars = BarsSince(z > 0); 
TrendBarCount = 6; 
Color[0] = colorDefault; 
Trend[0] = 0; 
for( i = 1; i < BarCount; i++ ) 
{ 
if (Plusbars[i] >= TrendBarCount) 
{ 
Trend[i] = 1; 
} 
else if (Minusbars[i] >= TrendBarCount) 
{ 
Trend[i] = -1; 
} 
else 
{ 
Trend[i] = Trend[i - 1]; 
} 

if (Trend[i] == 1) 
{ 
if (Minusbars[i] == TrendBarCount - 1) 
{ 
Color[i] = colorYellow; 
} 
else if (z[i] < 0) 
{ 
Color[i] = colorGrey40; 
} 
else 
{ 
Color[i] = colorBlue; 
} 
} 
else if (Trend[i] == -1) 
{ 
if (Plusbars[i] == TrendBarCount - 1) 
{ 
Color[i] = colorYellow; 
} 
else if (z[i] >= 0) 
{ 
Color[i] = colorGrey40; 
} 
else 
{ 
Color[i] = colorRed; 
} 

} 
else 
{ 
Color[i] = colorDefault; 
} 
} 

// Plot the 100s 

//Plot(100,"", colorLightGrey , styleLine | styleThick | styleNoLabel); 
//Plot(-100,"", colorLightGrey , styleLine | styleThick | styleNoLabel); 

// Plotthe 200s

//Plot(200,"", colorLightGrey, styleLine | styleThick | styleNoLabel); 
//Plot(-200,"", colorLightGrey, styleLine | styleThick | styleNoLabel);

// zero line 25lsma 

Plot(0,"", colorLightGrey , styleLine | styleThick | styleNoLabel); 

// Price Panel

Lastpricetitlehi= WriteIf(H>Ref(H,-1),EncodeColor(colorBrightGreen) + Ref(H,-1) + "  " + H , EncodeColor(colorWhite)+ Ref(H,-1) + "  " + H);
Lastpricetitlelo= WriteIf(L<Ref(L,-1),EncodeColor(colorRed) + Ref(L,-1) + "  " + L , EncodeColor(colorWhite) + Ref(L,-1) + "  " + L);

// Pattern codes

z50limitlong= LLV(z50,BarsSince(z>0))>0;
z50limitshort= HHV(z50,BarsSince(z<0))<0;

// 5014 Long 

CCIhook_long5014= LLV(Ref(z,-1),BarsSince(Ref(z,-1)<0)); 
Long5014= z50limitlong AND ((Ref(z,-1)<-75 AND Z>-75 AND CCIhook_long5014<-75 AND CCIhook_long5014>=-100) OR (Ref(z,-1)<-100 AND Z>-100 AND CCIhook_long5014<-100)) AND Z50>0;

// 5014 Short 

CCIhook_short5014=HHV(Ref(z,-1),BarsSince(Ref(z,-1)>0)); 
Short5014= z50limitshort AND ((Ref(z,-1)>75 AND Z<75 AND CCIhook_short5014>75 AND CCIhook_short5014<=100) OR (Ref(z,-1)>100 AND Z<100 AND CCIhook_short5014>100)) AND Z50<0;

// 50140 Long 

CCIhook_long50140= LLV(Ref(z,-1),BarsSince(Ref(z,-1)<0)); 
Long50140= z50limitlong AND z50>0 AND z>0 AND CCIhook_long50140<-75;

// 50140 Short 

CCIhook_short50140=HHV(Ref(z,-1),BarsSince(Ref(z,-1)>0)); 
Short50140= z50limitshort AND z50<0 AND z<0 AND CCIhook_short50140>75;

// Slingshot Long

z6pivotlong= LLV(z6,BarsSince(Ref(z6,-1)>0))<=-100 AND z6>0 AND Ref(z6,-1)<0;
zpivotlong= LLV(z,BarsSince(Ref(z,-1)>-100)) AND LLV(z,BarsSince(z>-100))<50 AND z>Ref(z,-1) AND z>0;
slingshotlong= z6pivotlong AND zpivotlong AND trend==1 AND z50>0 AND z<120;

// Slingshot Short

z6pivotshort= HHV(z6,BarsSince(Ref(z6,-1)<0))>=100 AND z6<0 AND Ref(z6,-1)>0;
zpivotshort= HHV(z,BarsSince(Ref(z,-1)<100))<100 AND HHV(z,BarsSince(Ref(z,-1)<100))>-50 AND z<Ref(z,-1) AND z<0;
slingshotshort= z6pivotshort AND zpivotshort AND trend==-1 AND z50<0 AND z>-120;

// Signal Title 

PatCode1=ParamToggle("Plot 5014 (1)","No|Yes",1); 
PatCode2=ParamToggle("Plot 50140 (2)","No|Yes",1); 
PatCode3=ParamToggle("Plot Slingshot (3)","No|Yes",1); 
Signaltitle= 
WriteIf(PatCode1==1 AND Long5014 AND NOT Long50140,EncodeColor(colorRed) + "\n" + "*** ALERT -- 5014 ***" + "\n",
WriteIf(PatCode1==1 AND Short5014 AND NOT short50140,EncodeColor(colorRed) + "\n" +  "*** ALERT -- 5014 ***" + "\n", 
WriteIf(PatCode2==1 AND Long50140,EncodeColor(colorRed) + "\n" +  "*** ALERT -- 50140 ***" + "\n",  
WriteIf(PatCode2==1 AND Short50140,EncodeColor(colorRed) + "\n" +  "*** ALERT -- 50140 ***" + "\n",
WriteIf(PatCode3==1 AND slingshotlong,EncodeColor(colorRed) + "\n" +  "*** ALERT -- SLINGSHOT ***" + "\n",
WriteIf(PatCode3==1 AND slingshotshort,EncodeColor(colorRed) + "\n" +  "*** ALERT -- SLINGSHOT ***" + "\n",""))))));

// Pattern signal codes

//PlotShapes(IIf(PatCode1==1 AND Long5014 AND NOT Long50140,shapeDigit1,shapeNone),colorBlue,0,0,-40); 
//PlotShapes(IIf(PatCode1==1 AND Short5014 AND NOT short50140,shapeDigit1+ shapePositionAbove,shapeNone),colorRed,0,0,-40);
//PlotShapes(IIf(PatCode2==1 AND Long50140,shapeDigit2,shapeNone),colorBlue,0,0,-25); 
//PlotShapes(IIf(PatCode2==1 AND Short50140,shapeDigit2+ shapePositionAbove,shapeNone),colorRed,0,0,-25) ;
//PlotShapes(IIf(PatCode3==1 AND slingshotlong,shapeDigit3,shapeNone),colorBlue,0,0,-10); 
//PlotShapes(IIf(PatCode3==1 AND slingshotshort ,shapeDigit3+ shapePositionAbove,shapeNone),colorRed,0,0,-10) ;

// CCI Exit
HookExitLong= z<=Ref(z,-1);
HookExitShort= z>=Ref(z,-1);

// 100 Line Cross Exit
Cross100long= Ref(z,-1)>100 AND z<100;
Cross100short= Ref(z,-1)<-100 AND z>-100;

// Mplay Exit 

MplayExitLong= z<Ref(z,-1) AND Ref(z,-1)<Ref(z,-2) AND C<O; 
MplayExitShort= z>Ref(z,-1) AND Ref(z,-1)>Ref(z,-2) AND C>O; 

// Heikin-Ashi Exit

HaClose =EMA((O+H+L+C)/4,3); 
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); 
HaHigh = Max( H, Max( HaClose, HaOpen ) ); 
HaLow = Min( L, Min( HaClose, HaOpen ) );
HExitConLong=  HaLow < HaOpen;
HExitConShort=  HaHigh > HaOpen;

// Exit code
ExitCode= Param("Exits:Hook=1,100x=2,Mplay=3,H-Ashi=4",1,1,4);
ExitCodeTitleLong=
IIf(ExitCode==1,HookExitLong,IIf(Exitcode==3,MplayExitLong,IIf(Exitcode==4,HExitConLong,IIf(Exitcode==2,Cross100long,0))));
ExitCodeTitleShort=IIf(ExitCode==1,HookExitShort,IIf(Exitcode==3,MplayExitShort,IIf(Exitcode==4,HExitConShort,IIf(Exitcode==2,Cross100short,0))));
AllPatterns =(Long50140 AND patcode2==1) OR (Long5014 AND patcode1==1) OR (slingshotlong AND patcode3==1)  OR (short50140 AND patcode2==1) OR (short5014 AND patcode1==1) OR (slingshotshort AND patcode3==1) ; 
BuyPattern = (Long50140 AND patcode2==1) OR (Long5014 AND patcode1==1) OR (slingshotlong AND patcode3==1);;
SellPattern= ExitCodeTitleLong;
ShortPattern = (short50140 AND patcode2==1) OR (short5014 AND patcode1==1) OR (slingshotshort AND patcode3==1);
CoverPattern = ExitCodeTitleShort;

//Plot Sell/Cover Arrows 

Sell1=ExRem(SellPattern,BuyPattern); 
Cover1=ExRem(CoverPattern,ShortPattern); 
SellCode=ParamToggle("Plot sell/cover arrows ","No|Yes",0); 
//PlotShapes(IIf(Sell1 AND SellCode==1,shapeHollowDownArrow,shapeNone),colorBlue,0,200,10); 
//PlotShapes(IIf(Cover1 AND SellCode==1,shapeHollowDownArrow,shapeNone),colorRed,0,200,10); 

// Calculate pattern hilites

// Long

AsellL= BuyPattern;
BsellL= Sell1;
bs_AsellL= BarsSince(AsellL);
bs_BsellL= BarsSince(BsellL);
bars_sellL= IIf(bs_ASellL<= bs_BsellL,bs_AsellL,0);

//Short
AsellS= ShortPattern;
BsellS= Cover1;
bs_AsellS= BarsSince(AsellS);
bs_BsellS= BarsSince(BsellS);
bars_sellS= IIf(bs_ASellS<= bs_BsellS,bs_AsellS,0);
hilitecode=ParamToggle("Hi-lite patterns","No|Yes",0);

// CCI Line 

CCIcolor= IIf(((bars_sellL OR bars_sellS) OR AllPAtterns) AND hilitecode==1,patterncolor,zcolor);
//Plot(round(z),"WCCI", CCIcolor , styleLine | styleThick);

// Turbo CCI 

//Plot(round(z6),"TCCI", z6color, styleLine); 

// CCI Histogram 

//Plot(z,"",Color,styleHistogram | styleThick | styleNoLabel); 

// BackTest Long

LastPatLong= BuyPattern;
LastPatBarLong= BarsSince(LastPatLong);
DDL=IIf((((LLV(L,LastPatBarLong)-Ref(C,-LastPatBarLong))))/ticdiv>=0,0,(((LLV(L,LastPatBarLong)-Ref(C,-LastPatBarLong))))/ticdiv);
BTExitLong= (((C-Ref(C,-LastPatBarLong))))/ticdiv; 
PeakLong=IIf((((HHV(H,LastPatBarLong)-Ref(C,-LastPatBarLong))))/ticdiv<=0,0,(((HHV(H,LastPatBarLong)-Ref(C,-LastPatBarLong))))/ticdiv);
StopLong1= Ref(C,-LastPatBarLong) - (Ref(L,-LastPatBarLong) - (stopval*ticdiv) -  (spread*ticdiv));
stoplong= (((StopLong1)))/ticdiv;
BackTestLongTitle= WriteIf(Sell1,EncodeColor(colorBlue) + "\n" +
"Stop:   " + round(stoplong) + "\n" +
"DD:     " + round(DDL) + "\n" + 
"Exit:      " + round(BTExitLong)+ "\n" +
"Peak:   " +  round(PeakLong) +"\n",EncodeColor(colorBlue) + "\n" +
"Stop:   " + round(stoplong) + "\n" +
"DD:     " + round(DDL) + "\n" + 
"Exit:      " + round(BTExitLong)+ "\n" +
"Peak:   " +  round(PeakLong) +"\n"); 

// BackTest Short

LastPatShort= ShortPattern;
LastPatBarShort= BarsSince(LastPatShort);
DDS= IIf((((Ref(C,-LastPatBarShort)-HHV(H,LastPatBarShort))))/ticdiv>=0,0,(((Ref(C,-LastPatBarShort)-HHV(H,LastPatBarShort))))/ticdiv);
BTExitShort= (((Ref(C,-LastPatBarShort)-C)))/ticdiv; 
PeakShort= IIf((((Ref(C,-LastPatBarShort)-LLV(L,LastPatBarShort))))/ticdiv<=0,0,(((Ref(C,-LastPatBarShort)-LLV(L,LastPatBarShort))))/ticdiv);
StopShort1= (Ref(H,-LastPatBarShort) + (Stopval*ticdiv) + (spread*ticdiv)) - Ref(C,-LastPatBarShort);
StopShort= (((StopShort1)))/ticdiv;
BackTestShortTitle= WriteIf(Cover1,EncodeColor(colorRed) + "\n" +
"Stop:   " + round(StopShort) + "\n" +
"DD:     " + round(DDS) + "\n" + 
"Exit:      " + round(BTExitShort)+ "\n" +
"Peak:   " +  round(PeakShort) +"\n",EncodeColor(colorRed)+ "\n" + 
"Stop:   " + round(StopShort) + "\n" +
"DD:     " + round(DDS) + "\n" + 
"Exit:      " + round(BTExitShort)+ "\n" + 
"Peak:   " +  round(PeakShort) +"\n");

// Backtest title

BackTestCode= ParamToggle("Display Stop,DD,Peak,Exit stats","No|Yes",0); 
BackTestTitle= WriteIf((bars_sellL>0 OR Sell1) AND BackTestCode==1,BackTestLongTitle ,WriteIf((bars_sellS>0 OR Cover1 )AND BackTestCode==1,BackTestShortTitle ,""));

// Stop in

Longbar= L+rbint;
Shortbar= H-rbint;

// Stop in title

stopincode= ParamToggle("Display stop-in for range bar mode","No|Yes",0);
sstoptitle=WriteIf(stopincode==1, EncodeColor(colorBlue) + "\n" + "Stop In Long:  " + Longbar + EncodeColor(colorRed) + "\n" + "Stop In Short:  " + Shortbar ,"");

// Title

Title = "\n" + "" + EncodeColor(colorWhite) + "14 CCI" + "\n" + EncodeColor(colorWhite) + Date() + "\n" + "\n" +
timetitle + "\n" + "\n" + Lastpricetitlehi + "\n" + EncodeColor(colorWhite) +  " " + Close + "\n" + 
Lastpricetitlelo + "\n" +  BackTestTitle + Signaltitle + sstoptitle;



Color = IIf( (z6<-100 ), colorRed, IIf( z6>100 , colorBrightGreen, colorGrey50 ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 20);






/* Larry William's Volatility Channels 
Right Click select Param "parameters" and select variable you need..*/

/* AFL code by Prakash Shenoi*/

// Enable radio button "middle" for grid lines.


MaxGraph = 4;
Vc= Param("Volatility channel -",10,2,14);
Up=HHV(((((H+L+C)/3)*2)- H),Vc);
Lo=LLV(((((H+L+C)/3)*2)- L),Vc);
/*Graph0=C;
Graph0Style=128+4;
Graph0BarColor = IIf( Close > Ref( Close, -1 ), colorDarkGreen, colorDarkRed );
Graph0Style = styleDots;
Graph0 = Close;
Graph1=Up;
Graph1Style=styleLine;
Graph1Color=colorBlue;
Graph2=Lo;
Graph2Style=styleLine;
Graph2Color=colorBlue;
Title=Name() + "  Volatiltiy Channels - LC" + WriteVal( Graph2 )+ ", UC" + WriteVal( Graph1 )+
", Close" + WriteVal( Graph0 );
*/

Color = IIf( C>up, colorGreen, IIf( C<Lo , colorDarkRed, colorGrey50 ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 10);



_SECTION_BEGIN("Name");
GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/6 );
GfxSetTextAlign( 6 );// center alignment
//GfxSetTextColor( ColorRGB( 200, 200, 200 ) );
GfxSetTextColor( ColorHSB( 42, 42, 42 ) );
GfxSetBkMode(0); // transparent
//GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/12 );
GfxSelectFont("Tahoma", Status("pxheight")/12 );
GfxTextOut( "nick analysis", Status("pxwidth")/2, Status("pxheight")/3 );
/////////////////////GfxSelectFont("Tahoma", Status("pxheight")/36 );
//GfxTextOut( "www.vpanalysis.blogspot.com", Status("pxwidth")/2, Status("pxheight")/2 );
_SECTION_END();








//------------------------------------------------------------------------------
//
//  Formula Name:    ATR Volatility System
//  Author/Uploader: Marcelin 
//  E-mail:          marcelint@xnet.ro
//
//------------------------------------------------------------------------------
//
//  ATR trading system for short terms tradings. You can use it with Absolute
//  Strength Index for confirmation of signals.
//
//------------------------------------------------------------------------------

_SECTION_BEGIN("NewSystem ATR");
   /*Writed & composed by Tudor Marcelin - Art Invest*/
   n=Param( "perioada", 14, 5 , 20, 1 );
   k=Param( "factor de multiplicare", 1.4, 0.5 , 2.5, 0.1 );

  f=ATR(n);
    
/*R rezistenta pentru ziua curenta*/
    R[0] = C[0]; 
/*S rezistenta pentru ziua curenta*/ 
    S[0] = C[0];
  
for( i = n+1; i < BarCount; i++ ) 
{ 

    R[i]=R[i-1];
    S[i]=S[i-1];
    if (( S[i-1]<=C[i-1]) AND (C[i-1] <=R[i-1] ) AND (C[i-1]+k*f[i-1])<=RV)
 
        r[i] = C[i-1]+k*f[i-1];
   
     if (( S[i-1]<=C[i-1]) AND (C[i-1]<=R[i-1] ) AND  (C[i-1]-k*f[i-1])>=SV)

        s[i]= C[i-1]-k*f[i-1];
  


  


    if ( C[i-1] >R[i-1] )
{
       r[i] = C[i-1]+k*f[i-1];
       s[i]= C[i-1]-k*f[i-1];
       RV=r[i];
       SV=s[i]; 
}   
    if ( C[i-1] <S[i-1] )
{
       r[i] = C[i-1]+k*f[i-1];
       s[i]= C[i-1]-k*f[i-1];
       RV=r[i];
       SV=s[i]; 

} 


 Buy=Close>R;
 Sell=Close<S;
 
Cump=IIf(Close>R,1,0);
Vanz=IIf(Close<S,1,0);
}


Buy = ExRem( Buy, Sell ); //Elimina semnalele buy consecutive
Sell = ExRem( Sell, Buy ); //Elimina semnalele sell consecutive



Color = IIf( Vanz OR Sell, colorDarkRed, IIf(Buy,colorGreen,colorGrey50)); 

Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 6 );

GraphXSpace = 3;

Title=EncodeColor(colorBlue)+"Volatility System"+EncodeColor(colorBlack)+ " Open:"+O+" High:"+H+" Low:"+L+" Close:"+C+EncodeColor(colorGreen)+" Rez:"+R+EncodeColor(colorRed)+" Sup:"+S+EncodeColor(colorBlue)+
	" \nDate: "+EncodeColor(colorRed)+Date();
_SECTION_END();
/////////////////////





//In "Using Implied Volatility And Volume," Scott Castleman presents an interesting trading system that blends option volatility index movement with price AND Volume data to produce more reliable signals. 

//Implementing such a system is relatively easy in Afl, the language for AmiBroker. Listing 1 shows the code that should be entered in the Automatic Analysis formula window. We use the "Foreign" function to reference other symbols' data. Various data vendors use different symbols for indices. for example, "!VIX" is a symbol used by the QuotesPlus database for SP100 implied volatility, while Yahoo! Finance uses "^VIX." You may need to adjust the code according to the symbol used by your data vendor. 
  

//LISTING 1
/////////////////////////////////
// Implied volatility AND Volume
/////////////////////////////////
RefLength1 = 29;
RefLength2 = 25;
LookBackIV=252;
LookBackVolume=50;
// the line below should be adjusted depending on
// data source you are using
// !VIX is for Quotes Plus database
// ^VIX is for Yahoo (AmiQuote)
CurrentIV = Foreign("!VIX", "C");
LowestIV = LLV( CurrentIV, LookbackIV );
HighestIV = HHV( CurrentIV, LookbackIV );
AvgVolume = MA( Volume, 10 );
LowestVolume = LLV( Volume, LookbackVolume );
HighestVolume = HHV( Volume, LookbackVolume );
RangeIV = HighestIV - LowestIV;
RangeVolume = HighestVolume - LowestVolume;
DayLengthLong = int( RefLength1 - 0.5 * RefLength2* Nz( ( CurrentIV - LowestIV )/RangeIV +( AvgVolume - LowestVolume )/RangeVolume, 1 ) );
DayLengthShort = int( RefLength1 - 0.5 * RefLength2* Nz( ( HighestIV - CurrentIV )/RangeIV +( HighestVolume - AvgVolume )/RangeVolume, 1 ) );
SetTradeDelays( 1, 1, 1, 1 );
BuyPrice = SellPrice = ShortPrice = CoverPrice = Open;
Buy = High > HHV( Ref( High, -1 ), DayLengthLong );
Sell = Low < LLV( Ref( Low, -1 ), DayLengthShort );
Short = Sell;
Cover = Buy;





Color = IIf( Cover, colorGreen, IIf( Short , colorDarkRed, colorGrey50 ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1,4);





/////////////
/*THE TRUTH ABOUT VOLATILITY - Feb2005 S&C

In "The Truth About Volatility," Jim Berg presents how to use several well-known volatility measures 
such as average True range (ATR) to calculate entry, trailing stop, AND profit-taking levels. 
Implementing techniques presented in the article is very simple using the AmiBroker Formula Language (Afl), 
AND takes just a few lines of code.

Listing 1 shows the formula that the plots color-coded price chart, trailing stop, AND profit-taking lines, 
as well as a colored ribbon showing volatility-based entry AND exit signals. The relative strength 
index (RSI) used by Berg is a built-in indicator in AmiBroker, so no additional code is necessary.

*/
EntrySignal = C > ( LLV( L, 20 ) + 2 * ATR( 10 ) );
ExitSignal = C < ( HHV( H, 20 ) - 2 * ATR( 10 ) );
Color = IIf( EntrySignal, colorBlue, IIf( ExitSignal, colorOrange, colorGrey50 ));
TrailStop = HHV( C - 2 * ATR(10), 15 );
ProfitTaker = EMA( H, 13 ) + 2 * ATR(10);
/* plot price chart and stops */


/* plot color ribbon */
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 3 );
/////////////////////














//* ATR Study:  <<<BU?*/

Exclude = MA(V,50)<200 ;
MaxGraph = 12;
//Graph0 = C;
//Graph0Color = 1;
//Graph0Style = 64;

BuyOffSet = 18;//Optimize("BuyOffSet",18,15,20,1);
SellOffset = BuyOffSet;//Optimize("SellOffset",2,2,14,2);
RegLength = 5;//Optimize("RegLength",5, 2,11,2);
BuyATRPeriod = 2;//Optimize("BuyATRPeriod",2,2,5,1);
SellATRPeriod = BuyATRPeriod;//Optimize("SellATRPeriod",4,2,11,2);
ATRMultiplier = 1;//Optimize("ATRMultiplier",1,0.7,1.25,.05);


Graph = HHV(H-ATRMultiplier*ATR(BuyATRPeriod),BuyOffset);   /* RED */
Graph_ = LLV(L+ATRMultiplier*ATR(SellATRPeriod),SellOffset);  /*  GREEN */


//Graph9Color=  5;  /* 5 is green */
//Graph8Color = 4;  /* 4 is red */





/* plot color ribbon */
Color = IIf( C>Graph AND C>Graph_ AND LinRegSlope(EMA(C,17),2)>0, colorOrange, IIf( C<Graph_, colorGreen, colorGrey50 ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 2.5 );


m=10;

x=HHV(C,m);xx=LLV(C,m);

Plot(C,"C",5,1);

h1=C;L1=C;

for(i=1;i<m;i++)

{

h1=Max(h1,Ref(C,-i));

L1=Min(L1,Ref(C,-i));

}

Color = IIf( C>L1 AND C<H1 , colorGrey50, IIf( C==h1 , colorYellow, colorBrightGreen ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 2.3);









Type = ParamList("Chart Type",
    "Price Bands|Price Band Oscillator|Stochastic Channel|Raw Stochastic");
Periods = Param("Periods", 14, 2, 100, 1 );
Smoothed = ParamToggle("Smoothed", "No|Yes", 1 );
IsStochType = ( Type == "Stochastic Channel" OR Type == "Raw Stochastic" );
// if stochastic - include today's bar
PH = IIf( IsStochType, H, Ref( H, -1 ) );
PL = IIf( IsStochType, L, Ref( L, -1 ) );
if( Type == "Price Bands" OR Type == "Stochastic Channel" )
{

}
else
{
 // plot oscillator
 Range = HHV( PH, Periods ) - LLV( PL, Periods );
 Position = C - LLV( PL, Periods );
 if( Smoothed )
 {
   Slow = 100 * Sum( Position, 3 ) / Sum( Range, 3 );

 }
 else
 {
   Raw = 100 * ( Position / Range );

 }
} 
 
 


Color = IIf( Close<LLV( PL, Periods ), colorBrightGreen, IIf(Close>HHV( PH, Periods ), colorYellow, colorGrey50 ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 2.1 );
///////////////////////////////

 
////  Vchart
//This was converted from code created for TradeStation by Mark W. Helweg ofValueCharts.com
VarNumbars = Param("Number of Bars",5,2,1000,1);
Color = Param("Bar Color",colorBlue);
Top = Param("Top Chart Line",8);
TopMid = Param("Top Mid Chart Line",4);
BottomMid = Param("Bottom Mid Chart Line",-4);
Bottom = Param("Bottom Chart Line",-8);


LRange = 0;
	VarP = round(VarNumBars/5);
if (VarNumBars > 7) 
{
	VarA=HHV(H,VarP)-LLV(L,VarP);
	VarR1 = IIf(VarA==0 AND VarP==1,abs(C-Ref(C,-Varp)),VarA);
	VarB=Ref(HHV(H,VarP),-VarP+1)-Ref(LLV(L,VarP),-VarP);
	VarR2 = IIf(VarB==0 AND VARP==1,abs( Ref(C,-VarP)-Ref(C,-Varp*2) ),VarB);
	VarC=Ref(HHV(H,VarP),-VarP*2)-Ref(LLV(L,VarP),-VarP*2);
	VarR3 = IIf(VarC == 0 AND VarP==1,abs(Ref(C,-Varp*2)-Ref(C,-Varp*3)),VarC);  
	VarD = Ref(HHV(H,VarP),-VarP*3)-Ref(LLV(L,VarP),-VarP*3);
	VarR4 = IIf(VarD == 0 AND VarP==1,abs(Ref(C,-Varp*3)-Ref(C,-Varp*4)),VarD);	
	VarE = Ref(HHV(H,VarP),-VarP*4)-Ref(LLV(L,VarP),-VarP*4);
	VarR5 = IIf(VarE == 0 AND VarP==1,abs(Ref(C,-Varp*4)-Ref(C,-Varp*5)),VarE);	
	LRange=((VarR1+VarR2+VarR3+VarR4+VarR5)/5)*.2;
};


CDelta = abs(C - Ref(C,-1));
if (VarNumBars <=7)
{
	Var0 = IIf(CDelta > (H-L) OR H==L,CDelta,(H-L));
	LRange = MA(Var0,5)*.2;
}
MidBarAverage = MA( (H+L)/2,VarNumbars);
VOpen = (Open- MidBarAverage)/LRange;
VHigh = (High-MidBarAverage)/LRange;
VLow = (Low-MidBarAverage)/LRange; 
VClose = (Close-MidBarAverage)/LRange; 
//PlotOHLC(VOpen,VHigh,VLow,VClose,"ValueChart",color,styleBar | styleThick
//,-12,12);
//Title= Name() + " " + WriteVal( DateTime(), formatDateTime )+
	//"\nVOpen " + VOpen + "\n"+ " VHigh "+ VHigh + "\n"+ " VLow " + Vlow  + "\n"+ "
//VClose " + VClose;

Color = IIf( VClose>4, colorGreen, IIf( VClose<-4 , colorRed, colorGrey50 ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 1.9);
Color = IIf( VClose>8, colorDarkGreen, IIf( VClose<-8 , colorDarkRed, colorGrey50 ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 1.7);



_SECTION_BEGIN("Multiline Stochastic ");

/* Multiline Stochastic 

This was recommendeed by Judith in post 45268 
Use a multiple line STOCH with the SK set on 3 and SD set on 1 
Plot periods  2,5,8,12,17,20,27 and 37. 
Plot 2 and 37 in red as borders with 2 solid and 37 dashed. These are my fences.

When all of these lines converge below 20 or above 80, I bet the farm. This has
been successful for me because I usually have the configuration the day before a
shift in direction and it lasts anywhere from 3 to 30 days. But the movement is
very noticeable and highly dependable. I've poured over charts in it for some 6
months but now I have something that works for me.

If it is a premature or immature breakout/fakeout, the 2 runs ahead of the group
and I know better than to follow it. 

Sometimes, in the sideways ups and downs, the 37 will remain behind the others.
That tells me the movement is way too choppy for my tastes -- gets into day
trading in my mind, rightly or wrongly.

When the lines are all over the place, like a bowl of spaghetti, don't waste any
time on it. Go to the next chart.

*/
tgl = ParamToggle("Select", "Chart|Signal", 0);
kSmooth = Param("kSmooth",3,1,10,1);
dSmooth = Param("dSmooth",1,1,10,1);
pA = Param("Period A",3,1,3,1); 
pB = Param("Period B",5,3,7,1); 
pC = Param("Period C",8,5,12,1); 
pD = Param("Period D",12,8,17,1); 
pE = Param("Period E",17,12,21,1); 
pF = Param("Period F",21,17,26,1); 
pG = Param("Period G",26,21,31,1); 
pH = Param("Period H",31,26,35,1); 
pI = Param("Period I",35,31,39,1); 

/* old values
sA 	= StochD( 2, 3, 1); 
sB 	= StochD( 5, 3, 1); 
sC 	= StochD( 8, 3, 1); 
sD = StochD( 12, 3, 1); 
sE = StochD( 17, 3, 1); 
sF = StochD( 20, 3, 1); 
sG = StochD( 27, 3, 1); 
sH = StochD( 31, 3, 1); 
sI = 0
*/

sA = StochD( pA, kSmooth, dSmooth); // 3 default
sB = StochD( pB, kSmooth, dSmooth); // 5
sC = StochD( pC, kSmooth, dSmooth); // 7
sD = StochD( pD, kSmooth, dSmooth); // 12 
sE = StochD( pE, kSmooth, dSmooth); // 17 
sF = StochD( pF, kSmooth, dSmooth); // 21
sG = StochD( pG, kSmooth, dSmooth); // 26
sH = StochD( pH, kSmooth, dSmooth); // 31
sI = StochD( pI, kSmooth, dSmooth); // 35

if(!tgl)
/*{
Plot(sA,  "Stochastic Multi-line(" + NumToStr(kSmooth,1.0) + "," + NumToStr(dSmooth,1.0) + ") - " + NumToStr(pA,1.0) + " " , colorRed);
Plot(sB,  NumToStr(pB,1.0), colorLightBlue);
Plot(sC,  NumToStr(pC,1.0), colorBlue);
Plot(sD,  NumToStr(pD,1.0), colorIndigo);
Plot(sE,  NumToStr(pE,1.0), colorBrown);
Plot(sF,  NumToStr(pF,1.0), colorViolet);
Plot(sG,  NumToStr(pG,1.0), colorBrightGreen);
Plot(sH,  NumToStr(pH,1.0), colorTeal); 
Plot(sI,  NumToStr(pI,1.0), colorRed, styleDashed); 
Plot(20, "", colorBlack, styleLine);
Plot(80, "", colorBlack, styleLine);
}
else
{
Buy   = Cover = sA < 20 AND sB < 20 AND sC < 20 AND sD < 20 AND sE < 20 AND sF < 20 AND sG < 20 AND sH < 20 AND sI < 20;
Short = Sell  = sA > 80 AND sB > 80 AND sC > 80 AND sD > 80 AND sE > 80 AND sF > 80 AND sG > 80 AND sH > 80 AND sI > 80;
Plot(Buy, "Stochastic Multi-line - Oversold", colorGreen);
Plot(-Short, "Overbought", colorRed);
}*/
_SECTION_END();
//agora=sA < 20 AND sB < 20 AND sC < 20 AND sD < 20 AND sE < 20 AND sF < 20 AND sG < 20 AND sH < 20 AND sI < 20;
agora=sA > 20 AND sB > 20 AND sC > 20 AND sD >  20 AND sE <  20 AND sF <  20 AND sG <  20 AND sH <  20 AND sI <  20;
pwlhsh=sA > 80 AND sB > 80 AND sC > 80 AND sD > 80 AND sE > 80 AND sF > 80 AND sG > 80 AND sH > 80 AND sI > 80;



bc=sA < 20 AND sB < 20 AND sC < 20 AND sD < 20 AND sE < 20 AND sF < 20 AND sG < 20 AND sH < 20 AND sI < 20;
ss=sA > 80 AND sB > 80 AND sC > 80 AND sD > 80 AND sE > 80 AND sF > 80 AND sG > 80 AND sH > 80 AND sI > 80;
Cond1=sa>sc;
Cond2=sg>sh;


color = IIf(  bc OR Cond1 OR Cond2, colorGrey50, IIf( ss , colorBlack, colorGrey50 ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 1.5 );
//MAmisio
color = IIf(  agora, colorGreen, IIf( pwlhsh , colorDarkRed, colorGrey50 ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 1.3 );



//////////////
Title=" ";
/////////////////////


function PercentR( periods )
{
 return 100 * ( HHV( H, periods ) - C )/( HHV( H, periods ) - LLV( L, periods ) ); 
}

Plot( PercentR( Param("Periods", 10, 2, 100 ) ),
		_DEFAULT_NAME(),
		ParamColor("Color", ColorCycle ) );

Plot( 90, "", colorBlue, styleDashed);
Plot( 10, "", colorBlue, styleDashed );
Plot( 80, "", colorGreen, styleNoLabel);
Plot( 20, "", colorGreen, styleNoLabel);

"Statistics of " + Name() + " as of " + Date();
"";
"Closing price = " + WriteVal( Close );
"Change since yesterday = " + WriteVal( Close - Ref( Close, -1 ) );
"Percent chg. since yesterday = " + WriteVal( ROC( Close, 1 ) ) + " %";
"R% = " + WriteVal ( PercentR( Param("Periods", 14, 2, 100 ) ));
"";
"BUY when 90 or Higher.";

"";

"SELL when 10 or Lower.";
"";

"An excellent Trading Indicator. Needless to say the signals MUST be varied/compared with Bollinger Bands and any of Mr. Chaikin's Indicators.";
"";
"All things being equal, which unfortunately they are not, I would enter a BUY between 80-90 or above, and liquidate my position between 20-10 or below.";
"";
"GOOD TRADING";
"";
"Mubashar Virk, mavirk@gmail.com";


Color = IIf( PercentR( Param("Periods", 10, 2, 100 ))>=90, colorBrightGreen,
        IIf( PercentR( Param("Periods", 10, 2, 100 ))<=10 AND Ref(PercentR( Param("Periods", 10, 2, 100 )),-1)>10, colorRed, colorGrey50 ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 1);








Title="nick analysis";

2 comments

1. morgen

Usefull…what for?

2. mhjwisestocktrader

how does it work?

Leave Comment

Please login here to leave a comment.

Back