My use of IsDirty flag is not working. How simple could it be?
Tomasz said:
"
You need to know that AB caches data.
If you are writing directly to quote array thru OLE you need to
set "IsDirty" flag, after you are done with writing to given symbol.
target.IsDirty = True;
"
I put in the flag, as
for( i = 0; i < BarCount; i++ )
{
k = 1;
for( sig = bo.GetFirstSignal( i ); sig; sig = bo.GetNextSignal( i ) )
{
// Line = sig.Symbol + "," + DateTimeToStr(dt[i]) + "," + k + "\n";
// fputs(Line, fh);
target = ab.Stocks(sig.Symbol);
qt = target.Quotations(DateTimeToStr(dt[i]));
if(qt)
{
if(run == 1)
qt.OpenInt = k;
else
qt.OpenInt += k;
}
target.isDirty = True;
k++;
}
}
Result: code processes fine. Open whatever the current symbol is in the
Symbol Editor and the OI field has been changed as the code says. Click to
another symbol (in the same Watchlist) and the OI field is empty. Click
back to the original symbol and the OI field is empty.
I have tried different locations of the target-isdirty = True; statement.
None worked.
Obviously, there is something else to do in order to get the OI field to
save. I have tried, Refreshing, also Saving, also exiting the application
and clicking Save on exit, also saving the entire db using Save As. All
result in nothing in the OI field although it does get set once.
Any suggestions from anyone with experience with this flag?
Or, Tomasz??