Buy on current candle if price is increased more than 5% of Previous Close

#1
Please Make a afl formula for bank nifty, condition for buy is mentioned below:
Buy on current candle if price is increased more than 5% of Previous Close and Sell vice versa
 
#2
Yes, it's not a bad option for a deal, but of course there are some nuances, it does not always work, the main thing to pay attention to the levels, because there may be a situation where the price has significantly jumped, but a strong indicator to buy or sell has not yet given.
 
#3
Thanks for your comments.
Yes you are right so I have again thought and working on a new formula which would be a give more good and accurate result but I am not a programmer so I was stuck on a few points. If you help me I can share with you afl formula.

Thanks in advance.
 
#5
Dear seniors, Help me, How to Insert Sell signal for the condition "High Price of the Intraday -20%" in Amibroker AFL.

_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();


// Current Day High Low//
_SECTION_BEGIN("PreDay HLC");
function CDL( array )
{
doy = DayOfYear();
Lastdoy = doy == LastValue( doy );
Dayline = array * Lastdoy;

return IIf( Dayline, Dayline, Null );
}

//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

//PLOTS
Plot( cdl( H1 ), "", colorRed, styleLine + styleThick + styleNoRescale + styleNoLabel );
PlotText("High",BarCount,LastValue(TimeFrameGetPrice( "H", inDaily, 1 ),True),colorBlue);

Plot( cdl( L1 ), "", colorBrightGreen, styleLine + styleThick + styleNoLabel );
PlotText("Low",BarCount,LastValue(TimeFrameGetPrice( "L", inDaily, 1 ),True),colorRed);


_SECTION_END();
 
#6
It looks like momentum strategy. However, your trading strategy should be more complex and include indicators along with S&R levels. The whole idea can work but all the signals should be justified by indicators and charts.
 
#7
Please help me seniors I am getting Buy side continuous Buy signal on chart. Please remove excess signal of Buy on chart. Intra Day Trading with 15 minutes chart on Nifty Call Option. This is Ribbon Bar Trading when ribbon bar color change signal generate. I have tried but getting excess signal on buy side on chart.

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//TRENDING RIBBON
// Paste the code below to your price chart somewhere and green ribbon means both
// both MACD and ADX trending up so if the red ribbon shows up the MACD and the ADX
// are both trending down.
_SECTION_BEGIN("trending ribbon");
uptrend= PDI()>MDI() AND MACD()>Signal() ;
downtrend= MDI()>PDI() AND Signal()>MACD() ;
Plot( 2, /* defines the height of the ribbon in percent of pane width */"",
IIf( uptrend AND EMA(C,50)>=Ref(EMA(C,50),-1), colorLime, IIf( downtrend OR EMA(C,50)<Ref(EMA(C,50),-1),
colorRed, colorAqua )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );


//Buy Sell Condition-----------------------------------------
Buy = IIf( uptrend AND EMA(C,50)>=Ref(EMA(C,50),-1),colorLime,0) AND NOT GapUp();// AND TimeNum() >= TrdBegin1 AND TimeNum() <= TrdEnd1;
Sell = IIf( downtrend AND EMA(C,50)<=Ref(EMA(C,50),-1),colorRed,colorAqua);// OR TimeNum() >= SqOff; // AND NOT GapDown();

//Non Repainting - Signals happens only after the close of the current
Buy = Ref(Buy,-1);
Sell = Ref(Sell,-1);

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

// Buy Sell Arrow-----------------------------------------------------------------------------------------
shape1 = Buy * shapeUpArrow + Sell * shapeDownArrow;
Plot(C, "Close", colorDefault, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
PlotShapes( shape1, IIf( Buy, colorLime, colorLightOrange ), 0, IIf( Buy, Low, High ), -15 );

ExRem(Buy,0);
ExRem(Sell,0);

_SECTION_END();
//-----------------------------------------------------------------------------------------
 
Last edited:

bunti_k23

Well-Known Member
#8
KYA BOLTE MAJA AAYA?