Simple Coding Help - No Promise.

cellclinic

Well-Known Member
I will adjust averages but still need afl code to plot price oscilator like others ...

Hoping to get it soon as it is not that tough for you like me :)

Thanks For Helping A kid who not even knows the C of coding :)

:thanx:

& GOD BLESS YOU
 
Do you done a google search ????
This is not new, already there are many codes regarding divergence,
More over marking the high/lows are subjective. So do some back test and come with which indicator suits your need.
I know sir, most of the one available (including the one i posted on page 375) are for normal divergence. What i was looking for is hidden divergence.
 
Is there a way for me to know the Colors that are set in preferences from within an AFL?

Have checked help manual for both Status function and Prefs function but that seems to provide no clues.
 
Last edited:
Hi all,

Can some one help me with the following AFL wih the Buy and Sell conditions.

Buy on the bar after trigger bar i.e. buy if the Price is higher than trigger bar which is (C>MA(C,P1) AND C>MA(C,P2)) and sell if the price is lower than the trigger bar which is (C<MA(C,P1) AND C<MA(C,P2)).


SetChartBkColor(ParamColor("Outer panel color ",colorLightGrey));

SetChartOptions(0,chartShowArrows|chartShowDates);
SetPositionSize(2, spsShares);

_SECTION_BEGIN("Price");

_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", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();


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

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

color = IIf(C>MA(C,P1) AND C>MA(C,P2),colorBlue,IIf(C<MA(C,P1) AND C<MA(C,P2),colorRed, colorBlack));
Plot( C, "Close", color, styleNoTitle |styleCandle );

Col=IIf(MA(C,P1)>MA(C,P2),colorLightBlue,colorYell ow);
PlotOHLC( 0,MA(C,P1), MA(C,P2), 0, "Cloud", col, styleCloud );

Buy = (C>MA(C,P1) AND C>MA(C,P2));
Short =(C<MA(C,P1) AND C<MA(C,P2));

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorBlue, 0,L,Offset=-15);
PlotShapes(IIf(Sell, shapeStar, shapeNone),colorGold, 0, H, Offset=15);




Thanks
Amruta
 
Hi friends,

I have one afl its good for delivery trading but some time these afl give false signal. please help me to remove these false signal. out of 10 only 1 signal is false remaning 9 is accurate so please modify and enjoy all for these good afl. Here i paste alf below.

_SECTION_BEGIN("123");
z=Param("zig",0.4,0.01,3,0.01);
Plot(C,"",colorLightGrey,styleBar);
Plot( Zig(C, z), _DEFAULT_NAME(), colorYellow, styleLine );

p=Peak(C,z,1);
t=Trough(C,z,1);

Buy=Cross(C,p)AND TimeNum()>100000 ;
stop=ValueWhen(Buy,t,1);
Entry=ValueWhen(Buy,p,1);
Target=(Entry+(Entry-stop));
Sell=Cross(stop,C) OR Cross(t,C) OR Cross(C,Target) OR TimeNum()>152500 ;

Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

PlotShapes(shapeUpArrow*Buy,colorGreen,0, L,-5 );
PlotShapes(shapeDownArrow*Sell,colorRed,0, H,-5 );

Short=Cross(t,C)AND TimeNum()>100000;
stop1=ValueWhen(Short,p,1);
Entry1=ValueWhen(Short,t,1);
Target1=(Entry1-(stop1-Entry1));
Cover=Cross(C,stop1) OR Cross(C,p) OR Cross(Target1,C) OR TimeNum()>152500;

Short = ExRem( Short, Cover );
Cover = ExRem( Cover, Short );

PlotShapes(shapeSmallUpTriangle*Cover,colorRed,0,L,-30 );
PlotShapes(shapeSmallDownTriangle*Short,colorGreen,0,H,-30 );

finalb = Flip( Buy, Sell );
finals = Flip( Short, Cover );

Plot(IIf(finalb==1,Ref(Entry,1),IIf(finals==1,Entry1,Null)),"",colorGreen,styleDashed);
Plot(IIf(finalb==1,stop,IIf(finals==1,stop1,Null)),"",colorRed,styleDashed);
Plot(IIf(finalb==1,Target,IIf(finals==1,Target1,Null)),"",colorBlue,styleDashed);


z=Param("zig",0.4,0.01,3,0.01);
Plot(C,"",colorLightGrey,styleBar);
Plot( Zig(C, z), _DEFAULT_NAME(), colorYellow, styleLine );

p=Peak(C,z,1);
t=Trough(C,z,1);

Buy=Cross(C,p)AND TimeNum()>100000 ;
stop=ValueWhen(Buy,t,1);
Entry=ValueWhen(Buy,p,1);
Target=(Entry+(Entry-stop));
Sell=Cross(stop,C) OR Cross(t,C) OR Cross(C,Target) OR TimeNum()>152500 ;

Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

PlotShapes(shapeUpArrow*Buy,colorGreen,0, L,-5 );
PlotShapes(shapeDownArrow*Sell,colorRed,0, H,-5 );

Short=Cross(t,C)AND TimeNum()>100000;
stop1=ValueWhen(Short,p,1);
Entry1=ValueWhen(Short,t,1);
Target1=(Entry1-(stop1-Entry1));
Cover=Cross(C,stop1) OR Cross(C,p) OR Cross(Target1,C) OR TimeNum()>152500;

Short = ExRem( Short, Cover );
Cover = ExRem( Cover, Short );

PlotShapes(shapeSmallUpTriangle*Cover,colorRed,0,L,-30 );
PlotShapes(shapeSmallDownTriangle*Short,colorGreen,0,H,-30 );

finalb = Flip( Buy, Sell );
finals = Flip( Short, Cover );

Plot(IIf(finalb==1,Ref(Entry,1),IIf(finals==1,Entry1,Null)),"",colorGreen,styleDashed);
Plot(IIf(finalb==1,stop,IIf(finals==1,stop1,Null)),"",colorRed,styleDashed);
Plot(IIf(finalb==1,Target,IIf(finals==1,Target1,Null)),"",colorBlue,styleDashed);











































































































































































































































































































































































































































































_SECTION_END();
 

xsis

Active Member
Hello traders and coders

I need your help please. I want to plot moving average with a delay of 'n' minutes.

For example - on a 1-minute chart, if a moving average at the end of 9:30am is showing 8085 reading, then the indicator should plot the line till 9:29 am with the reading of 8085 only i.e. the moving average on chart will end at 9:29am with the reading of 9:30am. In short with a delay of 1 minute.

I hope I have explained it without ambiguity

Thanks guys....
 

xsis

Active Member
In short the moving average should plot the current value a bar late.

Hello traders and coders

I need your help please. I want to plot moving average with a delay of 'n' minutes.

For example - on a 1-minute chart, if a moving average at the end of 9:30am is showing 8085 reading, then the indicator should plot the line till 9:29 am with the reading of 8085 only i.e. the moving average on chart will end at 9:29am with the reading of 9:30am. In short with a delay of 1 minute.

I hope I have explained it without ambiguity

Thanks guys....
 

Similar threads