#property copyright "Pfunzo Nefale"
#property link "https://www.mql5.com/en/users/pfunzonefale"
#property version "1.00"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
string _table;
void OnStart()
{
string filename="Special_Bars_Power.sqlite";
//--- create or open the database in the common terminal folder
int db=DatabaseOpen(filename, DATABASE_OPEN_READWRITE | DATABASE_OPEN_CREATE |DATABASE_OPEN_COMMON);
if(db==INVALID_HANDLE)
{
Print("DB: ", filename, " open failed with code ", GetLastError());
return;
}
_table="Period_H1";
//--- if table exists, return
if(DatabaseTableExists(db,_table))
{
Alert("Delete Database First");
return;
}
//--- if the table does not exists
if(!DatabaseTableExists(db,_table))
{
//--- create the AUDCHF table
if(!DatabaseExecute(db, "CREATE TABLE "+_table+" ("
"PAIR VARCHAR(6),"
"Doji_Long_Legged INTEGER(3),"
"Doji_Gravestone INTEGER(3),"
"Doji_Dragonfly INTEGER(3),"
"Hammer INTEGER(3),"
"Hammer_Inverted INTEGER(3),"
"Marubozu_Bullish INTEGER(3),"
"Marubozu_Bearish INTEGER(3),"
"Big_White_Candle INTEGER(3),"
"Big_Black_Candle INTEGER(3),"
"Pinbar_Bullish INTEGER(3),"
"Pinbar_Bearish INTEGER(3),"
"Pinbar_Inverted_Bullish INTEGER(3),"
"Pinbar_Inverted_Bearish INTEGER(3));"
))
{
Print("DB: ", filename, " create table failed with code ", GetLastError());
}
}
//---------------------------------------------------------------
DatabaseClose(db);
}
//+------------------------------------------------------------------+
Comments