Help needed to add arrows

amitrandive

Well-Known Member
#1
Dear All

Below code for Smooth stochastic, I have added the Buy, Sell arrows, but they do not come at the proper location.Please help.

Code:
_SECTION_BEGIN("StochasticsSmooth");
grid_day = IIf(Day()!=Ref(Day(),-1),1,0);  
Plot(grid_day,"",colorDarkGrey,styleHistogram|styleDashed|styleNoLabel|styleOwnScale);
 
SetChartOptions(0,chartShowArrows|chartShowDates);
d1=StochK(18, 9);//, 18) ;
d2=StochD(18,9,3);//, 20);
qw=WMA(d1, 1); wq=WMA(d2, 1);
ww=WMA(qw, 2); ee=WMA(wq, 2);
p1=WMA(ww, 3); p2=WMA(ee, 3);
Plot(p1, "price", colorGreen,styleThick);
Plot(p2, "price", colorRed,styleThick);
 
Overbought = 80 ;
Oversold =20 ;
Center = 50 ;

 
Plot(Overbought, "",colorRed,styleThick) ;
Plot(Oversold, "",colorGreen,styleThick) ;
Plot(Center, "",colorBlue, styleDashed,styleThick) ;
Buy=Cross(p1, p2) ;
Sell=Cross(p2, p1);
PlotShapes(IIf( Sell, shapeDownArrow , shapeNone), colorRed,0, Offset=Null) ;
PlotShapes(IIf( Buy, shapeUpArrow , shapeNone), colorBlue,0, Offset=Null) ;
Cover=Buy; Short=Sell;
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);


BuyPrice=ValueWhen(Buy, C);
SellPrice=ValueWhen(Sell, C);

Filter=Buy OR Sell ;
 
 
                SetOption("NoDefaultColumns", True);
                AddTextColumn(Name(), "Symbol", 77, colorDefault, colorDefault, 120);
                AddColumn(DateTime(), "Trigger Date", formatDateTime);
 
 
 
                AddColumn(IIf(Buy, 66, 83), "Signal", formatChar, colorYellow, IIf(Buy, colorGreen, colorRed));
               AddColumn(IIf(Buy, BuyPrice, SellPrice),  "Entry", 6.2);
 AddColumn(LastValue(C), "C. M. P.", 6.2);

 
_SECTION_END();
 

Similar threads