Support Board
Date/Time: Sun, 22 Dec 2024 10:29:48 +0000
Post From: Possible Bug -- Executing Study from Wrong Chart?
[2015-02-16 19:45:54] |
Israel Gottlieb - Posts: 14 |
Dear Sierra, Generally, I find the software fast & reliable. This one however, has given me a lot of headache -- please advise if it is a bug, or if I'm just not appreciating your intention. I have a chartbook open that includes 2 charts for the same symbol. In chart1 I have a TradeSystem coded in ascil, in chart2 I have an ordinary study - also coded in ascil. Both log output lines to an external file (the same file). I've discovered that when I run a bar-based backtest on the tradeSystem of chart1, just before the very last simulation cycle, execution jumps to the study in chart2 -- for no apparent reason. The reason I caught this is because all the output from the backtest was being trashed just before the end, and I would see only output from the chart2 study. The study opens the file in truncate mode, while the TradeSystem opens it in append mode -- to accumulate output from all simulation cycles. When execution jumps to the study, the file is re-opened in trunc mode, and all the contents are discarded. This is not speculation. I used the MSVC debugger and actually saw the exection happening in the chart2 study. I can trace execution exiting the TradeSystem code when sc.Index = BaseArraySize-1 for the 3rd time, i.e. after the 3rd of 4 backtest cycles, it then jumps to the entry point of the study in the other chart, completes execution there, and then returns to execute cycle #4 of the backtest for the same value of sc.Index. As far as I know, there's is no option in the SC API that supports a study jumping directly to another study -- so this is not happening in my code. This phenomenon seems to occur only when both charts are loaded w/ the same symbol. It does not seem to matter in what order the charts appear in the chartbook, nor what chart number they have. Is this a bug? Or have I missed something? Thanks for any help, IG |