PLEASE HELP ME MODIFY FOR BUY SELL ARROWS

#1
please help me modify below AFL For BUY ?SELL Arrows ( condition Buy when MA line changes color from white to blue, condition SEll when MA line changes color blue to white)


_SECTION_BEGIN("MA Swing");
SetBarsRequired(200,0);

GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k = Optimize("K",Param("K",1,0.25,5,0.25),0.25,5,0.25);
Per= Optimize("atr",Param("atr",4,13,20,1),3,20,1);
HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorBlack, styleCandle | styleNoLabel );
j=Haclose;
//TIME FRAME CALCULATION
H1 =TimeFrameGetPrice("H", inDaily, -1); // yesterdays high
L1 =TimeFrameGetPrice("L", inDaily, -1); // low
C1=TimeFrameGetPrice("C", inDaily, -1); // close
DayO =TimeFrameGetPrice("O", inDaily); // current day open

//PlotDT();


icol = IIf (MA (Close,25) > Ref (MA (Close,25),-1),colorBlue,colorWhite);

Plot( MA( High, 25 ),"", icol, styleThick);




_SECTION_END();
 

Romeo1998

Well-Known Member
#2
This seems like a very good system, but will have to test it thoroughly.
I have changed the whitecolour of MA to orange colour as I was not able to see it
This is its chart
1569940967651.png


and this is its changed code

Code:
_SECTION_BEGIN("MA Swing");
SetBarsRequired(200,0);

GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k = Optimize("K",Param("K",1,0.25,5,0.25),0.25,5,0.25);
Per= Optimize("atr",Param("atr",4,13,20,1),3,20,1);
HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorBlack, styleCandle | styleNoLabel );
j=Haclose;
//TIME FRAME CALCULATION
H1 =TimeFrameGetPrice("H", inDaily, -1); // yesterdays high
L1 =TimeFrameGetPrice("L", inDaily, -1); // low
C1=TimeFrameGetPrice("C", inDaily, -1); // close
DayO =TimeFrameGetPrice("O", inDaily); // current day open

//PlotDT();


icol = IIf (MA (Close,25) > Ref (MA (Close,25),-1),colorBlue,colorOrange);

Plot( MA( High, 25 ),"", icol, styleThick);

Buy = MA (Close,25) > Ref (MA (Close,25),-1);
Sell = MA (Close,25) < Ref (MA (Close,25),-1);

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

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),1,0,HaLow,-12);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),1,0,HaHigh,-15);

_SECTION_END();
Best of Luck :)
 
#3
THANKS A LOT SIR,
CAN U HELP ME BY ADDING VERTICAL LINE SHOWING PREVIOUS DAYS CLOSE PRICE ON SAME AFL

IT WILL BE A ANOTHER BIG POSITIVE TO MY THIS AFL

WAITING FOR
 
#8
Sir,can u help me buy plotting buy sell arrows on below mentioned afl also


_SECTION_BEGIN("HEIKENASHI");

SetChartOptions(0,chartShowArrows | chartShowDates);

HaClose = (O + H + L + C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
xDiff = (HaHigh - Halow) * 10000;
barcolor = IIf(HaClose >= HaOpen,colorGreen,colorRed);
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "", barcolor, styleCandle );
_SECTION_BEGIN("Small Triggers");
p1 = Param("TL 1 Periods", 20, 5, 50, 1);
p2 = Param("TL 2 Periods", 5, 3, 25, 1);
TL1 = LinearReg(C, p1);
TL2 = EMA(TL1, p2);
Col1 = IIf(TL1 > TL2, ParamColor("TL Up Colour", colorBrightGreen), ParamColor("TL Dn Colour", colorCustom12));
Plot(TL1, "TriggerLine 1", Col1, styleLine|styleThick|styleNoLabel);
Plot(TL2, "TriggerLine 2", Col1, styleLine|styleThick|styleNoLabel);


_SECTION_END();