How to create a algo to buy when ltp is above 9.25 am cande high( 2nd 5 min candle of day)?
Here is the skeleton AFL Code. Buy when any 5 min’s candle high is greater than 9:25 candle’s high and square off at 3:15
//Author: kamal.delhi.india at the rate gmail
_SECTION_BEGIN("DayNineTwentyFive");
RequestTimedRefresh( 1 );
t=TimeNum();tt=int(t/100);
Buy=Short=Sell=Cover=0;
buyopen=False;
locktimeprice=100000;
lockday=999;
todaysdate = Day();
for (i = 0; i < BarCount ; i++) {
if ( tt[i] <= 925 ) {
locktimeprice = H[i];
lockday = todaysdate[i];
}
if ( tt[i] > 925 AND tt[i] < 1515)
{
if(H[i]>locktimeprice AND lockday==todaysdate[i])
{Buy[i] = True;
buyopen = True;
lockday=999;
}
}
if ( tt[i] > 1515)
{
if(buyopen==True)
Sell[i] = True;
}
}
buy = ExRem( buy, sell );
sell = ExRem( sell, buy );
Filter = Buy OR Sell;
AddColumn(Buy, "Buy", 1.0,colorDefault,IIf(Buy,colorGreen, colorDefault),40);
AddColumn(Sell, "Sell", 1.0,colorDefault,IIf(Sell,colorRed, colorDefault),40);
_SECTION_END();
Hi Kamal,
Thanks for this code. Is it possible to write this in Streak? If not, where do you trade using this AFL code? Using Kite Connect API or something else?
Regards,
Ajinkya
Hi @AjinkyaRelekar, currently this is not possible since Streak does not support candle marking feature. This will be added in the future.
Hello
Can this be written using pine script for trading view?
thanks
arun
Can be written in pine but Amibroker connects seamlessly with Zerodha via KiteAPI or AFL bridge.