lundi 2 janvier 2017

afl code

hi

i need help



i want to add (Buy) when close >= hv

can someone help me

Code:

// define reusable function
function SupResLevels( bars, colorUp, ColorDn )
{
  bi = BarIndex();
  lvbi = LastValue( bi );

  // return HHV value only for bars starting from the bar where HHV level was established
  hv = IIf( bi >= lvbi - LastValue( HHVBars( High, bars )), LastValue( HHV( High, bars ) ), Null );
     
     
  // the same approach for LLV
  lv = IIf( bi >= lvbi - LastValue( LLVBars( Low, bars ) ), LastValue( LLV( Low, bars ) ), Null );

  // plot levels
  Plot( hv,"", colorUp, styleDashed );
  Plot( lv, "",ColorDn, styleDashed );
}
// call function with various parameters
SupResLevels( 10, colorGreen, colordarkRed );
SupResLevels( 15, colorGreen, colordarkRed );
SupResLevels( 20, colorGreen, colordarkRed );
SupResLevels( 25, colorGreen, colordarkRed );
SupResLevels( 30, colorGreen, colordarkRed );
SupResLevels( 35, colorGreen, colordarkRed );
SupResLevels( 40, colorGreen, colordarkRed );
SupResLevels( 45, colorGreen, colordarkRed );
SupResLevels( 50, colorGreen, colordarkRed );
SupResLevels( 55, colorGreen, colordarkRed );
SupResLevels( 100, colorGreen, colordarkRed );
SupResLevels( 200, colorGreen, colordarkRed );
_SECTION_END();

_SECTION_BEGIN("Price");
// price plot
//Plot( Close, "Close", colorDefault, styleBar );
Plot( C, "Close", ParamColor("Color", colorBlue ),ParamStyle("Styel",styleCandle,styleCandle|styleBar|styleThick)) ;
_SECTION_END();


e1=SupResLevels( 10, colorGreen, colordarkRed );
e2=SupResLevels( 15, colorGreen, colordarkRed );
e3=SupResLevels( 20, colorGreen, colordarkRed );
e4=SupResLevels( 25, colorGreen, colordarkRed );
e5=SupResLevels( 30, colorGreen, colordarkRed );
e6=SupResLevels( 35, colorGreen, colordarkRed );
e7=SupResLevels( 40, colorGreen, colordarkRed );
e8=SupResLevels( 45, colorGreen, colordarkRed );
e9=SupResLevels( 50, colorGreen, colordarkRed );
e10=SupResLevels( 55, colorGreen, colordarkRed );
e11=SupResLevels( 100, colorGreen, colordarkRed );
e12=SupResLevels( 200, colorGreen, colordarkRed );



Buy=close>=e1 AND Ref(C,-1)<=e1;
PlotShapes( Buy*shapeUpArrow, colorGreen,L,-1);

 
 
 SetChartBkGradientFill( ParamColor("Top", ColorRGB( 255,255,224 )),
ParamColor("Bottom", ColorRGB( 255,255,224 )),ParamColor("Title",ColorRGB( 255,255,224 )));


_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( C, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorOrange ), ParamStyle("Style") );
_SECTION_END();



afl code

Aucun commentaire:

Enregistrer un commentaire