Weird interaction between signals using two data streams

Questions about MultiCharts and user contributed studies.
PD Quig
Posts: 190
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Weird interaction between signals using two data streams

Postby PD Quig » 07 Apr 2014

Generic question:

I've got a trend line trading signal that has worked bug-free for a few months now. I have a trailing stop signal that I use in conjunction with the TL signal and they play nicely together. No bugs or issues in at least two months.

Today I added the TL signal to a 3-min chart and it worked fine. I decided, however, that I want to continue to use the trailing stop based on the 5-min time frame. Accordingly, I added a second data stream (the same instrument but 5-min). I modified the trailing stop code to activate when BarStatus(2) = 2. No changes were made to the TL code.

Oddly, the trail stop signal is now stepping on the TL signal. There are now times when the TL is broken on the 3-min chart but the entry does not happen until the next 5-min bar opens. When I turn the trail stop off everything works fine again. What the heck?
Attachments
2014-04-07_2238.png
Here is with trail stop signal turned off
(7.58 KiB) Downloaded 626 times
2014-04-07_2237.png
New 5-min bar and now entry displays
(11.95 KiB) Downloaded 620 times
2014-04-07_2236.png
TL has been broken but no entry yet
(11.87 KiB) Downloaded 612 times

User avatar
TJ
Posts: 7235
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

Re: Weird interaction between signals using two data streams

Postby TJ » 08 Apr 2014

Generic question:

I've got a trend line trading signal that has worked bug-free for a few months now. I have a trailing stop signal that I use in conjunction with the TL signal and they play nicely together. No bugs or issues in at least two months.

Today I added the TL signal to a 3-min chart and it worked fine. I decided, however, that I want to continue to use the trailing stop based on the 5-min time frame. Accordingly, I added a second data stream (the same instrument but 5-min). I modified the trailing stop code to activate when BarStatus(2) = 2. No changes were made to the TL code.

Oddly, the trail stop signal is now stepping on the TL signal. There are now times when the TL is broken on the 3-min chart but the entry does not happen until the next 5-min bar opens. When I turn the trail stop off everything works fine again. What the heck?
You have to be very careful and very precise in demarcating the data1/data2 calculations.

User avatar
furytrader
Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Weird interaction between signals using two data streams

Postby furytrader » 08 Apr 2014

I agree with what TJ is saying. The problem may be exacerbated by the fact that when the 5 minute bar closes, the 3 minute bar is still "open" since 5 is not evenly divisible by 3.

I wonder if you would continue to see this problem if you used a 6 minute bar as your second data series (I'm not recommending this from a trading standpiont, but rather from a testing standpoint).

PD Quig
Posts: 190
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Re: Weird interaction between signals using two data streams

Postby PD Quig » 08 Apr 2014

When printing variable values to output, barstatus values changed in unexpected ways: sometimes barstatus(2) changed when barstatus(1) changed and occasionally neither changed at the proper time. I don't want to mess with my TL signal so I guess I'll continue to dink around with the trail stop. Good idea, Fury. I'll try a 6-min bar just to see if it behaves again.

It's a classic SW issue: intermittent unexpected behavior.

User avatar
furytrader
Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Weird interaction between signals using two data streams

Postby furytrader » 08 Apr 2014

I wonder if the intermittent behavior occurs because some 3 minute bar chart times ARE divisible by both 5 and 3 (like 15, 45) ... ?

User avatar
TJ
Posts: 7235
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

Re: Weird interaction between signals using two data streams

Postby TJ » 08 Apr 2014

I found most of the errors can be traced to syntax issues.


Return to “MultiCharts”