Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 10-21-2009, 03:41 AM   #1

Join Date: Jul 2009
Location: Paphos
Posts: 36
Ignore this user

Thanks: 9
Thanked 6 Times in 1 Post

No Signals On BB System

Hi all,

I have coded the following to get a system to buy a low bolinger band and sell a high bollinger band, but it will not take any trades.

If I change the code to say If close¨of 1 bar ago is less than the lower band and the close is now above the lower band, then buy at market, and visa versa for shorts, then it does take the trades, but I want it to enter as it hits the lower band from below and the upper band from above, not wait till a close.


Here is my code.....

inputs:
Length( 20 ),
NumDevsUp( 2 ),
NumDevsDn( 2 );
variables:
Avg( 0 ),
SDev( 0 ),
LowerBand( 0 ),
UpperBand( 0 ),BollingerPrice(0),Trade Line(0);

BollingerPrice=Close of data1 / close of data2;
TradeLine= Close of data1 / close of data2;

Avg = AverageFC( BollingerPrice, Length ) ;
SDev = StandardDev( BollingerPrice, Length, 1 ) ;
UpperBand = Avg + NumDevsUp * SDev ;
LowerBand = Avg - NumDevsDn * SDev ;

if Tradeline< Lowerband then Buy next bar at Lowerband stop;
if Tradeline> Upperband then Sellshort next bar upperband stop;

if Marketposition>=1 and tradeline<Upperband then sell next bar at upperband stop;
if Marketposition<=-1 and tradeline>Lowerband then buytocover next bar at Lowerband stop;



Many thanks.
nab999 is offline  
Reply With Quote
Old 10-21-2009, 09:39 AM   #2

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: No Signals On BB System

look up IntrabarOrderGeneration
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 10-21-2009, 10:14 AM   #3

Join Date: Jul 2009
Location: Paphos
Posts: 36
Ignore this user

Thanks: 9
Thanked 6 Times in 1 Post

Re: No Signals On BB System

Hi Tams,

Yes I already had this enabled for the strategy, but still no trades
nab999 is offline  
Reply With Quote
Old 10-21-2009, 11:08 AM   #4

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: No Signals On BB System

Quote:
Originally Posted by nab999 »
Hi Tams,

Yes I already had this enabled for the strategy, but still no trades

do you have this code in an indicator?

if not, change the following code:

Code:
if Tradeline< Lowerband then Buy next bar at Lowerband stop;
if Tradeline> Upperband then Sellshort next bar upperband stop;
to

Code:
if Tradeline< Lowerband then plot10(Lowerband, "B-Lowerband");
if Tradeline> Upperband then plot10(upperband, "S-upperband");

set the plot type to a large dot... you should be able to see if your logic is firing.
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
Old 10-22-2009, 05:43 AM   #5

Join Date: Jul 2009
Location: Paphos
Posts: 36
Ignore this user

Thanks: 9
Thanked 6 Times in 1 Post

Re: No Signals On BB System

Hi,

I made the indicator and it is plotting correctly, i.e. a red dot when over the upperband and a green dot when under the lowerband, so it is detecting when the conditions for entry are met, it is just that the system will not take any entries, as described in my first post

Many thanks for your help.
Attached Thumbnails
No Signals On BB System-ind.gif  
nab999 is offline  
Reply With Quote
Old 10-22-2009, 07:18 AM   #6

Blu-Ray's Avatar

Join Date: Nov 2006
Location: England
Posts: 508
Ignore this user

Thanks: 164
Thanked 292 Times in 105 Posts

Re: No Signals On BB System

What you're best off doing is......

Post a chart ( zoomed in ) showing BOTH symbols and timeframes with the indicators on, annotate the chart where there should be an entry and we'll have a better idea of what's what.

Cheers

Blu-Ray
__________________

“ Search is the ultimate expression of the power of the individual, using a computer, looking at the world, and finding exactly what they want ” – Eric Schmidt, Google
Blu-Ray is offline  
Reply With Quote
The Following User Says Thank You to Blu-Ray For This Useful Post:
Tams (10-22-2009)
Old 10-22-2009, 09:25 AM   #7

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: No Signals On BB System

the error is here

just remove the stop below:


Quote:
if Tradeline< Lowerband then Buy next bar at Lowerband stop;
if Tradeline> Upperband then Sellshort next bar upperband stop;


p.s.
1. as Blue-Ray suggested, you should super-impose the price bar, BB, and indicators to see if the triggers are firing at the right places.
2. use the code box when posting codes. See the little "mountain" icon at the top of the message window.
3. always acknowledge helps people rendered you. You have 2 previous threads that you have not responded.
__________________



Only an idiot would reply to a stupid post
Tams is offline  
Reply With Quote
The Following User Says Thank You to Tams For This Useful Post:
Blu-Ray (10-22-2009)
Old 10-23-2009, 06:25 AM   #8

Join Date: Jul 2009
Location: Paphos
Posts: 36
Ignore this user

Thanks: 9
Thanked 6 Times in 1 Post

Re: No Signals On BB System

Hi,

Attached is a zoomed in chart. the symbols are both stocks Do (data1) and Rig (data2) 5 min timeframe.

The spread of data1-data2 is shown in white in the subraph, with bollinger bands of the spread in the same subgraph.

Above this are the dots for the indi you suggested Tams, which show that it is detecting correctly when the spread is above / below the bollinger bands

I tried to just remove the word Stop from the code as you suggested, but TS will not verify this, it states that there must be Stop, Limit or Shares at the end of the line of code

Many thanks for your help
Attached Thumbnails
No Signals On BB System-close-up.gif  
nab999 is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi System for Universal System Dr. Clayburg philloo Coding Forum 7 01-18-2012 06:41 AM
Ease of Movement Signals Tresor Coding Forum 4 08-05-2008 05:23 PM
Dual RSI + RSI Mid Line Signals Tresor Coding Forum 3 07-28-2008 07:12 PM
[Warning Signals with Volume] Soultrader Trading Videos 1 03-02-2007 05:55 AM

All times are GMT -4. The time now is 02:03 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.