Can Amiquote be auto updated through AFL for closing gaps?

Hello everyone, my technical charts always face an issue when next day opens with big gap up/down. It happens almost every 2-3 days. I usually manually fill the gap by exporting data from Amibroker to Excel, applying my formula to rationalize the gap over “n” periods, adding OHLC values of “n” periods to the exported data and re-import the new “gap adjusted” data to Amibroker. I only a trade a few strikes in Nifty & Bank Nifty Options but adjusting the database every other morning for 6-7 strikes in under 5 minutes becomes challenging. Can this be done via an AFL at market open, taking into account yesterday’s close, today’s open plus my formula for closing the gap and update quotes in Amiquote automatically? It’ll save me a mountain of work. Thanks in advance!

This can be easily done using Windows script host or Windows powershell. The script will auto run at 9:20, open the AmiBroker database, fix the O price of the scrip, close database and refresh database. Everything will be automatic.

Hello @coder_kamal . Thank you for your reply. I was hoping my post got your attention. Being a new member, i wasn’t able to contact you. Well i’m not a techie but i did try automating some tasks with AutoIt. Failed after a few attempts. Just read up on Windows Script Host. Yes, the task can be automated this way. However, there’s more to it than just modifying the Open price. The idea is to rationalize the indicator values at 9.20 am. I’ll brief you what i currently do. For eg, i use a 21 period MA, Previous Close is 100 and today’s Open is 105. Now, i need atleast 21 candles to get the MA absolutely flat at open. So i construct 6 candles in excel and fill the gap (105-100= 5) between these 6 candles (it can be done in 1 candle too but its an old excel sheet so i havent bothered to change). Then i construct another 26 candles with a Close of 105 to make the MA completely flat. In total, about 32 candles since previous close. Then i add these data rows to previous day’s close. My last candle in 5 minute timeframe has a time stamp of 3.25 pm. So when i add these additional rows, its gets me to approx 6.05 pm. I then import this csv file into the database. Two files attached for your reference. One is a gap fill calculation sheet, the other is the updated data in RED. In csv file NIFTY14AUG1911000CE, please observe rows 2685-2718. These data rows need to be added to Amiquote automatically. Also attached is a screen shot. The big question, how do i do this? And would you be able to help me do it? Thanks. Hell… cant upload csv files here or more than 1 image…attaching 1 screenshots. Sending another 2 screen shots in trail post. How does one contact you?

This will have to be coded and tested, Creation of 26 candles, but it can be done. Here is the skeleton code for Windows Shell Host JScript.

var AmiBroker;
var stock;


AmiBroker = new ActiveXObject( "Broker.Application" );

stock = AmiBroker.Stocks.Open( "NIFTY14AUG1911000CE" ); 


	  quote = stock.Quotations.Add( date.getVarDate() );
	  
	  quote.Open = parseFloat( fields[ 1 ] );
	  quote.High  = parseFloat( fields[ 2 ] );
	  quote.Low   = parseFloat( fields[ 3 ] );
	  quote.Close = parseFloat( fields[ 4 ] );
	  quote.Volume = parseInt( fields[ 5 ] );
	  

AmiBroker.RefreshAll();