- ago
I have two charts streaming the same C# strategy, two symbols. Running fine this morning, getting signals and showing my indicators. I went to the browser to do something else for about 10 minutes, then looked back at WL. My two charts now don't show my indicators, but I can get them back if I change to a different bar time frame. Then I can change to the bar frame I was trading. Does this mean the whole strategy "went dark", or just the indicator plots, therefore I can expect to still receive my buy/sell signals ?
0
1,089
30 Replies

Reply

Bookmark

Sort
- ago
#1
Without knowing what indicators were on the chart and what code was being executed on certain data range, I can speculate that there could be an unexpected value (e.g. double.NaN or something) causing this effect. Provided there are more details we could try to reproduce and fix.
0
- ago
#2
The issue is intermittent, meaning that the indicators disappear when some new bars appear, but do not disappear for others, so I suspect it is a data issue. Maybe incomplete data is being sent by IQ Feed ? This may help: I looked at Streaming Providers in Data Manager. When I enter a new symbol and click "Stream Data", sometimes there is data shown, and sometimes it says "streaming closed".
0
Glitch8
 ( 10.59% )
- ago
#3
Is this build 9?
0
- ago
#4
Dion, topic starter has downloaded build 9.

QUOTE:
The issue is intermittent, meaning that the indicators disappear when some new bars appear, but do not disappear for others,

A {good} change is made in build 9 which "broke" SwingHi/Lo/HiLo indicators by virtue of a code defect in these indicators.
https://www.wealth-lab.com/Discussion/SwingLo-indicator-no-longer-works-in-build-9-6218
There's a slight chance the indicators you're using may be affected in a similar fashion, especially if they aren't some very popular ones like RSI or SMA and/or come from TASC, PowerPack and other extension libraries.

I don't imply that the "streaming closed" issue does not have to do with this but knowing the indicators may help screen them for this defect.
0
- ago
#5
I removed the TASC indicators, but the strategy still disappears when a new bar appears (but not always). I also used the IQ Feed Snap Quote utility, and verified that the data is constantly streaming.
0
- ago
#6
Can you take screenshots of the strategy with indicators working as expected and when they disappear from streaming charts?
0
- ago
#7
Here is before, and then after:



0
- ago
#8
Thanks. First and foremost, there are no "indicators" on your charts and so removing TASC does not apply. By "indicators" you mean the icons of trades. To avoid confusion it's important to agree on definitions first :)

The 2nd screenshot tells a story: unlike the regular candlestick chart (screenshot #1), it suddenly becomes what seems to be Heikin Ashi bars to me? Being synthetic data they may not even be tradeable. However, the chart style dropdown indicates "Candlestick" and that's a discrepancy.

Dion may have an idea what's going wrong here?
0
Glitch8
 ( 10.59% )
- ago
#9
I immediately noticed the same thing. How in the world is the chart suddenly Heikin Ashi???
0
- ago
#10
Hmm can the strategy be modifying the charted bars programmatically?
https://www.wealth-lab.com/Discussion/Two-Price-Panes-for-Heikin-Ashi-and-regular-price-5495
0
- ago
#11
No, I am not modifying the charted bars programmatically.

I commented-out the plots of the indicators, some of which were TASC, thinking that the plots or indicators were the culprit.

The icons of the trades disappear. I can get them back if I change to a different bar interval, and then change back to my original interval.

I can also get the trade icons back if I drag and drop the strategy onto the chart again.

The strategy appears to remain, because if I remove it, then change the bar interval, there are no trade icons.
0
- ago
#12
Here is more information that may help:

After the trade icons disappear, I notice that when I change the bar intervals on one chart, they also change on the other chart.

0
Glitch8
 ( 10.59% )
- ago
#13
Is there any way you can email us your strategy so we can troubleshoot?
0
- ago
#14
Yes, what is the email address ?
0
Glitch8
 ( 10.59% )
- ago
#15
Support@wealth-lab.com
0
- ago
#16
QUOTE:
No, I am not modifying the charted bars programmatically.

Your strategy code does modify the charted bars programmatically in the manner of Heikin Ashi. It's right after the Execute() block starts.
0
- ago
#17
I am not intending to modify any charted bars, but rather just calculating some values from the bar history. Are you saying that variables such as HA are reserved words, thus using them affect charts ?

I changed the variables HO, HH, HL and HC to HAO, HAH, HAL and HAC, however the strategy still disappears after an hourly bar appears.
0
- ago
#18
Reserved words might be a good guess but it's not true. The real issue here IMHO is the modification of the properties of the Bars object (bars.Open, High etc.) which your strategy does inadvertently.

What if you replace this and other related TimeSeries...
CODE:
HO = bars.Open;

...with something like this:
CODE:
TimeSeries HO = new TimeSeries(bars.DateTimes, 0); ... for (int bar = 0; bar < bars.Count; bar++)          {             HO[bar] = bars.Open[bar]; ...          }
0
- ago
#19
Thanks, I made those changes, and get a successful compile, but when I backtest, now get the infamous "Object reference not set to an instance of an object" error message for the line:

bar = idx;

0
- ago
#20
Then I can say that you did something wrong.🤷‍♂️

As a side note, this construct in your code isn't required:
CODE:
int bar = 0; ... bar = idx;

It can be replaced by this simple change (yes it's possible):
CODE:
//public override void Execute(BarHistory bars, int idx) public override void Execute(BarHistory bars, int bar)
0
- ago
#21
Thanks. I removed the unnecessary bar = idx and related code, and commented-out all code related to the calculations similar Heikin Ashi.

Backtests are fine, however the streaming chart issue remains: Every couple of bars or so, the strategy appears to disappear because the moving average plots and buy/sell icons disappear, and no further signals occur.

When I change the bar frequency, the plots and icons reappear, and the strategy seems to "re-start".
0
Glitch8
 ( 10.59% )
- ago
#22
Do any errors appear in the Event Log under the Tools menu?
0
- ago
#23
No, there are no errors or warnings.
0
- ago
#24
Let me suggest you cover the code with as many WriteToDebugLog statements as possible and note the debug output to try isolate the culprit in the code.
0
- ago
#25
Ok, I will try that, but what am I looking for ? There are no issues during the backtest, it is only during the streaming charts. Somehow when streaming, the code may be calculating different values ?
0
- ago
#26
QUOTE:
but what am I looking for ?

Reviewing the debug output may be the clue to help understand what makes the strategy get 'removed' from the chart.
0
- ago
#27
Adding many WriteToDebug statements did not uncover anything. Instead, I commented-out various portions of the strategy and discovered that the EMA's are causing the issue. I have EMA(2) and EMA(5). When all references to EMA's are removed, the strategy does not disappear.
1
- ago
#28
Interesting. I see on your screenshots there are ~3K bars loaded so it's enough to build your EMAs. Does it only happen on SOXS 60-min or maybe some other symbol(s)?

Your code already had the plotting of EMAs commented out so it's presumably not an issue with plotting.
0
- ago
#29
Yes, it happens with other symbols and other time period bars.

Also happens with HMA.

I have isolated the cause of the issue:

hma_2 = new HMA(bars.AveragePriceOHLC, 14);

If use bars.Close instead of bars.AveragePriceOHLC, the strategy keeps running.

However, I want bars.AveragePriceOHLC, so please look into this.

It took many hours to figure this out, so maybe you can throw out an error message showing the problematic code line in the future ?
0
Glitch8
 ( 10.59% )
- ago
#30
Very sorry for this difficult to find issue, but I'm happy we figured it out, it's already resolved for Build 12! Appreciate the patience!
0

Reply

Bookmark

Sort