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 . 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
Strange Strategy behaviour in Beta
- Stanley Miller
- Posts: 556
- Joined: 26 Jul 2005
- Has thanked: 3 times
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.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.
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 ;
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);
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
- Stanley Miller
- Posts: 556
- Joined: 26 Jul 2005
- Has thanked: 3 times
- Stanley Miller
- Posts: 556
- Joined: 26 Jul 2005
- Has thanked: 3 times