Generate insert sql for OHLC

hi,
I am new to amibroker. Any comments are appreciated.
I am try to generate insert SQL statements but it is giving me the same OHLC values for every line.
(refer to image)

Filter =  Ref(High,-1) > Ref(HHV(High,260),-2); //Yesterday High higher than 52 week high of the day before (-2)
InsSQL = "INSERT INTO QUOTETABLE (QUOTESYMBOL,QUOTEDATE,Open,High,Low,Close) VALUES (";

InsSQL = InsSQL + "'" + Name()        + "'" + ",";
InsSQL = InsSQL + "'" + Date()        + "'" + ",";
InsSQL = InsSQL       + Open                + ",";
InsSQL = InsSQL       + High                + ",";
InsSQL = InsSQL       + Low                 + ",";
InsSQL = InsSQL       + Close               + ")";

AddColumn(Open, "Open");
AddColumn(High, "High");
AddColumn(Low, "Low");
AddColumn(Close, "Close");

AddTextColumn(InsSQL,"SQL");

Thanks again2021-12-30 InsertSQL

AddTextColumn adds just ONE TEXT (one string representing "SELECTED VALUE") per symbol. You can use AddTextColumn to display per-symbol (not per-bar) data such as full name, address, etc. You cannot add different texts for every bar on SAME symbol using AddTextColumn.

It is explained in the Knowledge Base:

The only way to do what you want is to use AddRow() function that adds a row of any text.

https://www.amibroker.com/guide/afl/addrow.html

More info available by searching:
https://forum.amibroker.com/search?q=addrow

https://forum.amibroker.com/search?q=addtextcolumn

Since you apparently want to create an SQL FILE to be imported, you should also consider generating file DIRECTLY, via fopen/fputs/fclose

http://www.amibroker.com/f?fopen
http://www.amibroker.com/f?fputs
http://www.amibroker.com/f?fclose

There are examples in the Knowledge Base that show you how:

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.