How to write buy sell signals

bunti_k23

Well-Known Member
#1
PLZ TELL ME HOW TO WRITE BUY AND SELL SIGNALS TO THIS SIMPLE AFL,ALSO TELL ME HOW TO ADD BACKTESTING FUNCTION.:D

SetChartOptions(0,chartShowArrows | chartShowDates);
_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();


/////////////////////////////////////



res=HHV(High,4);
sup=LLV(Low,4);
tsl=IIf(ValueWhen(IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0))!=0,IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0)),1)==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), colorWhite, styleStaircase);
 

vu22rps

Active Member
#2
This will give you buy and sell arrow.
You will also be able to scan to spot the scrips fitting your criteria.
Hope this helps you..

SetChartOptions(0,chartShowArrows | chartShowDates);
_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();


/////////////////////////////////////



res=HHV(High,4);
sup=LLV(Low,4);
tsl=IIf(ValueWhen(IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0))!=0,IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0)),1)==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), colorWhite, styleStaircase);
Buy=Cross(C,tsl);
Sell=Cross(tsl,C);
PlotShapes(shapeUpArrow*Buy,colorGreen);
PlotShapes(shapeDownArrow*Sell,colorRed);
 

bunti_k23

Well-Known Member
#4
Thanks bro for the help.
 

Similar threads