last works ...
This commit is contained in:
+15
-4
@@ -75,11 +75,22 @@ int OnInit()
|
||||
return INIT_PARAMETERS_INCORRECT;
|
||||
}
|
||||
|
||||
// //
|
||||
// // Initial Providers ...
|
||||
// if (!InitialProviders())
|
||||
// {
|
||||
// return INIT_PARAMETERS_INCORRECT;
|
||||
// }
|
||||
|
||||
//
|
||||
// Initial Providers ...
|
||||
if (!InitialProviders())
|
||||
{
|
||||
return INIT_PARAMETERS_INCORRECT;
|
||||
// Testing SymbolsTotal ...
|
||||
string symbols[];
|
||||
int symbolsCount = FilterUSDSymbols(
|
||||
symbols
|
||||
);
|
||||
if (symbolsCount > 0) {
|
||||
//
|
||||
ArrayPrint(symbols);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -3141,6 +3141,197 @@ double GetAppliedPrice(
|
||||
return (0);
|
||||
}
|
||||
|
||||
//
|
||||
// Symbols ...
|
||||
|
||||
//
|
||||
// Retrieve Available Symbols ...
|
||||
int GetAllSymbols(
|
||||
string &symbols[], // Hold Result
|
||||
bool onlyInWatchList = false, // Specified Retrieve only Symbols which in Watch List
|
||||
bool forceClean = true // Force To Clean Result Array
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (forceClean)
|
||||
{
|
||||
Clean(symbols);
|
||||
}
|
||||
|
||||
//
|
||||
int beforeSize = ArraySize(symbols);
|
||||
|
||||
//
|
||||
int symbolsCount = SymbolsTotal(onlyInWatchList);
|
||||
if (symbolsCount <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < symbolsCount; i++)
|
||||
{
|
||||
//
|
||||
string iSymbol = SymbolName(
|
||||
i,
|
||||
onlyInWatchList
|
||||
//
|
||||
);
|
||||
if (!IsValid(iSymbol))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
iSymbol,
|
||||
symbols
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
int afterSize = ArraySize(symbols);
|
||||
|
||||
//
|
||||
result = afterSize - beforeSize;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// This is a Global Way to Filter Symbols
|
||||
// you can pass Specific string as Query or a List String for Filtering ...
|
||||
int FilterSymbols(
|
||||
string query, // Which Query to Search Symbol
|
||||
string &symbols[], // Hold Result
|
||||
bool onlyInWatchList = false, // Specified Retrieve only Symbols which in Watch List
|
||||
bool forceClean = true, // Force To Clean Result Array
|
||||
bool ignoreCase = true, // Ignore Case
|
||||
string querySeparator = "," // If Provided means query is a COllection of Queries and need to be Splitted
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (forceClean)
|
||||
{
|
||||
Clean(symbols);
|
||||
}
|
||||
|
||||
//
|
||||
if (!IsValid(query))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Query is an String array or not ...
|
||||
string mQueries[];
|
||||
int queriesCount = 0;
|
||||
if (IsValid(querySeparator) && Contains(querySeparator, query, true))
|
||||
{
|
||||
//
|
||||
queriesCount = SplitContent(
|
||||
mQueries,
|
||||
query,
|
||||
querySeparator
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
int beforeSize = ArraySize(symbols);
|
||||
|
||||
//
|
||||
string allSymbols[];
|
||||
int allSymbolsCount = GetAllSymbols(
|
||||
allSymbols,
|
||||
onlyInWatchList,
|
||||
forceClean);
|
||||
if (allSymbolsCount <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Loop Through all Symbols ...
|
||||
for (int i = 0; i < allSymbolsCount; i++)
|
||||
{
|
||||
//
|
||||
string iSymbol = allSymbols[i];
|
||||
|
||||
//
|
||||
bool isFilterPassed = false;
|
||||
if (queriesCount == 0)
|
||||
{
|
||||
//
|
||||
isFilterPassed = Contains(
|
||||
query,
|
||||
iSymbol,
|
||||
ignoreCase
|
||||
//
|
||||
);
|
||||
}
|
||||
else if (queriesCount > 0)
|
||||
{
|
||||
//
|
||||
isFilterPassed = Contains(
|
||||
mQueries,
|
||||
iSymbol,
|
||||
ignoreCase
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
if (isFilterPassed)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iSymbol,
|
||||
symbols
|
||||
//
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
int afterSize = ArraySize(symbols);
|
||||
|
||||
//
|
||||
result = afterSize - beforeSize;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int FilterUSDSymbols(
|
||||
string &symbols[], // Hold Result
|
||||
bool onlyInWatchList = false, // Specified Retrieve only Symbols which in Watch List
|
||||
bool forceClean = true, // Force To Clean Result Array
|
||||
bool ignoreCase = true, // Ignore Case
|
||||
string querySeparator = "," // If Provided means query is a COllection of Queries and need to be Splitted
|
||||
)
|
||||
{
|
||||
//
|
||||
return FilterSymbols(
|
||||
"USD",
|
||||
symbols,
|
||||
onlyInWatchList,
|
||||
forceClean,
|
||||
ignoreCase,
|
||||
querySeparator
|
||||
//
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Time / Date ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user