Simple Coding Help - No Promise.

XRAY27

Well-Known Member
XRAY27

Please change your requirement from the parameters.
:thumb:
in the code there are ema and ma i have changed to Ema but not getting the requirement
see the above chart for your afl and below is the 20 ema high and low

i want above type colour cloud for below chart


 

amitrandive

Well-Known Member
in the code there are ema and ma i have changed to Ema but not getting the requirement
see the above chart for your afl and below is the 20 ema high and low

i want above type colour cloud for below chart


XRAY27

If you want the chart that you have shown , there is no requirement of an AFL for that.You can just drag the EMA20 high and EMA 20 Low on a price chart and change the colour.

Regarding the code I have given, just off the cloud and remove the third EMA you will get the same picture as you have shown.

 

XRAY27

Well-Known Member
XRAY27

If you want the chart that you have shown , there is no requirement of an AFL for that.You can just drag the EMA20 high and EMA 20 Low on a price chart and change the colour.

Regarding the code I have given, just off the cloud and remove the third EMA you will get the same picture as you have shown.

i want the cloud in between the EMA without cloud drag and drop will work and there is no need for afl that i know can you get that cloud in between the H and L this is my question
thanks for patience and due reply for my query
 

mastermind007

Well-Known Member
mastermind007

This code does not work in realtime, It gives the same values in both the column of open=high and open=low :confused:

Who is responsible for setting BuyPrice and SellPrice?
 
Dear Sir,
I am new to AFL and trying to learn. Pl. any friend can help to correct this AFL.The mistake is starting from // EMA line.
Regards.
nms

_SECTION_BEGIN("EMA3 + EMA15 Cross");

EMA5_LineShow = ParamToggle("EMA3 Line", "Hide|Show",1);
EMA15_LineShow = ParamToggle("EMA15 Line", "Hide|Show",1);
CrossArrow_EMA3EMA15 = ParamToggle("CrossArrow-EMA3+EMA15", "Hide|Show",1);
EMA3LineColor = ParamColor("EMA3 Color", colorRose);
EMA15LineColor = ParamColor("EMA15 Color", colorTeal);
BuyTextColor = ParamColor("Buy Text", colorBrightGreen);
SellTextColor = ParamColor("Sell Text", colorRed);
SellTextBgr = ParamColor("Sell Text Bg", colorYellow);
BuyEMA3EMA15 = ParamColor("Buy Arrow", colorBrightGreen);
SellEMA3EMA15 = ParamColor("Sell Arrow", colorLightYellow);

//EMA Line

if(EMA3EMA15 == 0 || EMA3_LineShow == 0) {
Plot(EMA(Close,3),"EMA3 Line",EMA3LineColor, styleLine);
}


if(EMA3EMA15 == 0 || EMA30_LineShow == 0) {
Plot(EMA(Close,15),"EMA15 Line",EMA15LineColor, styleLine);
}


//CrossArrow_EMA3_EMA15

if(EMA3EMA15 == 0 || CrossArrow_EMA3EMA15 == 0) {

Buy=Cross(EMA(Close,3), EMA(Close,15));
Sell=Cross(EMA(Close,15), EMA(Close,3));

dist = 1.5*ATR(10);

for( i = 0; i < BarCount; i++ )
{
if( Buy ) PlotText( "Buy\n@" + C[ i ], i, L[ i ]-dist, BuyTextColor );
if( Sell ) PlotText( "Sell\n@" + C[ i ], i, H[ i ]+dist, SellTextColor, SellTextBgr );
}

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, BuyEMA3EMA15, SellEMA3EMA15 ), 0, IIf( Buy, Low, High ), -30 );
GraphXSpace = 10;
}

_SECTION_END();



This Code will work for EMA 3 & EMA 15 crossover. Change the length of the EMA from the parameters : :thumb:

Code:
_SECTION_BEGIN("BACK COLR");

GfxSetOverlayMode(1); 

GfxSetOverlayMode(1);
GfxSelectFont("Tahoma", Status("pxheight")/20 ); /* Up down name*/
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( ParamColor("Text Color", ColorHSB( 42, 42, 42 ) ));
GfxSetBkMode(0); // transparent
GfxTextOut( Name(), Status("pxwidth")/2, Status("pxheight")/7);
GfxSelectFont("Tahoma", Status("pxheight")/30 );
GfxTextOut( IndustryID(1), Status("pxwidth")/2, Status("pxheight")/5 ); /* Up Down Sector*/

GfxSelectFont("Tahoma", Status("pxheight")/40 );
GfxTextOut( "Golden Cross - BY -conquest1453 istanbul- @ACARLAR33", Status("pxwidth")/2, Status("pxheight")/4);
GfxSelectFont("Tahoma", Status("pxheight")/20 );
GfxTextOut( " Borsayorumla.com ", Status("pxwidth")/2, Status("pxheight")/15 );

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC(C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

_SECTION_BEGIN("MA");


P = ParamField("Price field",-1);
Periods1 = Param("Periods1", 5, 1, 500, 1, 10 );
Periods2 = Param("Periods2", 13, 1, 500, 1, 10 );
Plot( EMA( P, Periods1 ), StrFormat(_SECTION_NAME()+"(%g)", Periods1), ParamColor( "Color1", colorRed ), ParamStyle("Style") ); 
Plot( EMA( P, Periods2 ), StrFormat(_SECTION_NAME()+"(%g)", Periods2), ParamColor( "Color2", colorBlue ), ParamStyle("Style") ); 
Buy = Cross(EMA( P, Periods1 ),EMA( P, Periods2 ) );
Sell = Cross(EMA( P,Periods2 ), EMA( P, Periods1 ) );

PlotShapes(IIf(Buy==1, shapeHollowUpArrow , shapeNone), colorGreen, 0,Low, Offset=-15);	
PlotShapes(IIf(Sell==1, shapeHollowDownArrow, shapeNone), colorRed, 0,High, Offset=-15);

PlotOHLC( Null,EMA( P, Periods1 ),EMA( P, Periods2 ),Null, "", IIf(EMA( P, Periods1 )>EMA( P, Periods2 ) ,colorLime,colorRose), styleCloud);

Color = IIf( EMA(p,periods1) > EMA(p,periods2) , colorLime, IIf( EMA(p,periods2) > EMA(p,periods1), colorPink, colorGrey50 )); 
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 30 );

_SECTION_END();
 

Similar threads