Simple Coding Help - No Promise.

hmp

Well-Known Member
Hi
Following AFL is excellent for positional trading. Only buy/sell arrows & scanning is missing.Can some expert pl. add this features to it?
Regards
Code:
_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

t=Param("t", 240, 1, 5000, 1);

/*Top = Sum(High, t) / t;
Bottom = Sum(Low, t) / t;
*/
Top = EMA(High, t) ;
Bottom = EMA(Low, t);

av=(Top+Bottom)/2;
mc=IIf(av>C, ParamColor("Trigger line Up Color", colorGold), ParamColor("Trigger line Dn Color", colorBlue));
Plot(av, "\nTrigger : ", mc, ParamStyle("Trigger line Style",styleStaircase,maskAll),0,0,0,9);

_SECTION_END();
 

vijkris

Learner and Follower
Hi
Following AFL is excellent for positional trading. Only buy/sell arrows & scanning is missing.Can some expert pl. add this features to it?
Regards
Code:
_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

t=Param("t", 240, 1, 5000, 1);

/*Top = Sum(High, t) / t;
Bottom = Sum(Low, t) / t;
*/
Top = EMA(High, t) ;
Bottom = EMA(Low, t);

av=(Top+Bottom)/2;
mc=IIf(av>C, ParamColor("Trigger line Up Color", colorGold), ParamColor("Trigger line Dn Color", colorBlue));
Plot(av, "\nTrigger : ", mc, ParamStyle("Trigger line Style",styleStaircase,maskAll),0,0,0,9);

_SECTION_END();
hi, can u be more specific abt when to buy and when to short?
pls check the code below.
use timeframe of 15 min and above.
thanks,
regards

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

t=Param("t", 240, 1, 5000, 1);

/*Top = Sum(High, t) / t;
Bottom = Sum(Low, t) / t;
*/
Top = EMA(High, t) ;
Bottom = EMA(Low, t);

av=(Top+Bottom)/2;
mc=IIf(av>C, ParamColor("Trigger line Up Color", colorGold), ParamColor("Trigger line Dn Color", colorBlue));
Plot(av, "\nTrigger : ", mc, ParamStyle("Trigger line Style",styleStaircase,maskAll),0,0,0,9);

Buy = C>av;
Short = av>C;
Buy = ExRem(Buy,Short);
Short = ExRem(Short,Buy);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);



_SECTION_END();
 

hmp

Well-Known Member
Dear Vijkris good attempt.
Can we avoid 2 buy or sell repeat arrows at some places? Also we need arrows only at changing of line color.
Thanks & regards.
 

vijkris

Learner and Follower
Dear Vijkris good attempt.
Can we avoid 2 buy or sell repeat arrows at some places? Also we need arrows only at changing of line color.
Thanks & regards.
hi, can u pls post screenshot of the above. 2 buy/sell arrows wont come....in sideways condition this method fails, thats y u wil see many arrows clubbed together..
thanks.
 

vijkris

Learner and Follower
i m referring to this as sideways. if u look closely 2 buy arrows are not there. each buy arrow wil have sell arrow next. arrows wil appear only when close crosses the gold or blue line.
regards.
 

vijkris

Learner and Follower
Dear Vijkris
Pl. refer this also
ya, this is the basic flaw of strategy in sideways market. 1 bar closes above the line so green arrow, next bar closes below the line so red arrow comes alternatively. we may have to use some other filter which identifies sideways thus reducing false signals..
thanks,
regards
 

Similar threads