Strange Strategy behaviour in Beta

Questions about MultiCharts and user contributed studies.
Chris
Posts: 150
Joined: 17 Nov 2005

Strange Strategy behaviour in Beta

Postby Chris » 04 Aug 2006

I encountered a very strange behaviour of a strategy which I can't figure out.

The strategy doens't give a thing on the rules, it just seem to take entries at will :roll: . I have done a visual check, there are a lot more entries, but the strategy does only do 1 in 20 days. This entry even is not a valid one according to the rules programmed - I have checked this using the print statement.

I have created an indicator using the exact same code than the strategy - only that I have changed Buy/SellShort to Plot. The results are the following: There are a lot more potential signals like you can see in the screenshot below and the one where the strategy enters is not a valid one!

Please advise how I can overcome this strange habit.

Thank you,

Chris
Attachments
StrategyStrange.png
(66.23 KiB) Downloaded 866 times

User avatar
Stanley Miller
Posts: 556
Joined: 26 Jul 2005
Has thanked: 3 times

Postby Stanley Miller » 04 Aug 2006

The best way to find and solve the problem is to send us both the strategy and indicator, we guarantee the confidentiality. Also you can reproduce the problem on the simplified code and send it to us. Thank you for your input.

Chris
Posts: 150
Joined: 17 Nov 2005

Postby Chris » 04 Aug 2006

The best way to find and solve the problem is to send us both the strategy and indicator, we guarantee the confidentiality. Also you can reproduce the problem on the simplified code and send it to us. Thank you for your input.
I knew that you would say this :) . I have created a simple test strategy which is showing the exact strange behaviour (like you can see in the attached picture). Again only 1 trade in 20 days.

Here is the strategy code:

Code: Select all

inputs: Length( 20 ), NumDevsDn( 2 ), NumDevsUp( 2 ) ;
variables: LowerBand( 0 ), UpperBand( 0 ), LTF_LowerBand( 0, Data2 ), LTF_UpperBand( 0, Data2 );

LowerBand = BollingerBand( Close, Length, -NumDevsDn ) ;

UpperBand = BollingerBand( Close, Length, NumDevsUp ) ;

LTF_LowerBand = BollingerBand( Close, Length, -NumDevsDn )Data2 ;

LTF_UpperBand = BollingerBand( Close, Length, NumDevsUp )Data2;

if CurrentBar > 1 and Low crosses over LTF_LowerBand and Low > LowerBand then
{ CB > 1 check used to avoid spurious cross confirmation at CB = 1 }
Buy ( "BBandLE" ) next bar at LowerBand stop ;

if CurrentBar > 1 and High crosses under LTF_UpperBand and High < UpperBand then
{ CB > 1 check used to avoid spurious cross confirmation at CB = 1 }
Sell Short ( "BBandSE" ) next bar at UpperBand stop ;
And the indicator simulating the strategy behaviour:

Code: Select all

inputs: Length( 20 ), NumDevsDn( 2 ), NumDevsUp( 2 ) ;
variables: LowerBand( 0 ), UpperBand( 0 ), LTF_LowerBand( 0, Data2 ), LTF_UpperBand( 0, Data2 );

LowerBand = BollingerBand( Close, Length, -NumDevsDn ) ;

UpperBand = BollingerBand( Close, Length, NumDevsUp ) ;

LTF_LowerBand = BollingerBand( Close, Length, -NumDevsDn )Data2 ;

LTF_UpperBand = BollingerBand( Close, Length, NumDevsUp )Data2;

if CurrentBar > 1 and Low crosses over LTF_LowerBand and Low > LowerBand then
{ CB > 1 check used to avoid spurious cross confirmation at CB = 1 }
Plot1(+1);

if CurrentBar > 1 and High crosses under LTF_UpperBand and High < UpperBand then
{ CB > 1 check used to avoid spurious cross confirmation at CB = 1 }
Plot1(-1);
Thank you,

Chris

P.S.: Like you can see on the picture I have overlayed two data increments.
Attachments
StrategyStrange2.png
(59.82 KiB) Downloaded 857 times

Chris
Posts: 150
Joined: 17 Nov 2005

Postby Chris » 04 Aug 2006

I am aware that the strategy won't take all signals that the indicator is showing, because it's not meant to take trades in the same direction, but as you can see there are a couple of reversal signals, which I'd exspect the strategy to act on.

User avatar
Stanley Miller
Posts: 556
Joined: 26 Jul 2005
Has thanked: 3 times

Postby Stanley Miller » 04 Aug 2006

Thank you much. What is data 2 in your case?

Chris
Posts: 150
Joined: 17 Nov 2005

Postby Chris » 04 Aug 2006

Thank you much. What is data 2 in your case?
Data1 is 20 days 343 Share Bars CME Euro
Data2 is 20 days 49 Share Bars CME Euro

User avatar
Stanley Miller
Posts: 556
Joined: 26 Jul 2005
Has thanked: 3 times

Postby Stanley Miller » 04 Aug 2006

Chris, thank you very much for participating in testing, you found a real bug 8)

It seems presently strategies do not work properly on 2 data streams with different resolutions. We'll try fixing this before the new version is released, please keep an eye out for forum announcements.

Chris
Posts: 150
Joined: 17 Nov 2005

Postby Chris » 04 Aug 2006

Thanks for the update. Let's hope that this needs only small changes and nothing major.


Return to “MultiCharts”