Posted By: SBGuy
loadStatus to inspect TRD file elements - 08/27/19 00:08
I'm trying to use loadStatus() to look at some open trade information and hopefully fix a TradePriceOpen in one of the trades.
The while loop in this code somehow randomly matches assets for the current_trades printout. The TradeID, TradeLots, and other variable appear to be correct, but the matched asset seems to be random. Meaning an open trade for APPL is printed out an a random asset with every push of the "Test" button.
Any thoughts?
Thanks.
The while loop in this code somehow randomly matches assets for the current_trades printout. The TradeID, TradeLots, and other variable appear to be correct, but the matched asset seems to be random. Meaning an open trade for APPL is printed out an a random asset with every push of the "Test" button.
Any thoughts?
Thanks.
Code
void run() { set(LOGFILE); loadStatus("Data\\Jon1.trd"); SaveMode = SV_TRADES+SV_ALGOVARS+SV_HTML; assetList("Assets-J-Stocks.csv"); algo("J-Stocks_BuyLow"); string tempAsset; while (tempAsset = loop(Assets)) { asset(tempAsset); for (current_trades) { printf("\n---- %s -----------------------\n",Asset); printf("[%s] TradeID = %d\n",Asset, (int) TradeID); printf("[%s] TradeDate = %s\n",Asset, strdate("%y-%m-%d %H:%M:%S",TradeDate)); printf("[%s] TradePriceOpen = %.2f\n",Asset, (var) TradePriceOpen); printf("[%s] TradeLots = %d\n",Asset, (int) TradeLots); printf("[%s] TradeStopLimit = %.2f\n",Asset, (var) TradeStopLimit); printf("[%s] TradeTrailLimit = %.2f\n",Asset, (var) TradeTrailLimit); printf("[%s] TradeProfit = %.2f\n",Asset, (var) TradeProfit); } } quit("ok!"); }