NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 04-28-2008, 01:55 AM   #1
stefy
Senior Member
 
Join Date: Apr 2008
Posts: 310
Thanks: 0
Thanked 0 times in 0 posts
Default Strategy based on BBS indicator

Hi everyone

I'm currently using the BBS indicator that I downloaded here.

I'd like to use it to set up an automated strategy, but how should I do exactly? The BBS indicator returns dots and arrows, not values.

I read this into the code:
To get BBS dot values use :
// BBS(2,1.5,20).DotValues.Get(CurrentBar)
// Possible dot values are '0' for no data, '2' for squeeze alert, '1' for squeeze on, and '-1' for squeeze off

So I guess I should use value 1 for entries and value -1 for exits?
What about the direction of the trades?

Many thanks in advance
stefy is offline  
Reply With Quote
Old 04-28-2008, 02:40 AM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

You would need to contact the author and ask him for clarification on the meaning of the values provided.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 04-28-2008, 02:45 PM   #3
KBJ
Senior Member
 
Join Date: Mar 2007
Location: , Florida, USA
Posts: 663
Thanks: 36
Thanked 7 times in 6 posts
Default

I haven't tried it, but I think it would be something like this to place trades where the little green arrows are positioned....

Code:
if (BBS(2,1.5,20).DotValues[0] == 2)
{
   if (BBS(2,1.5,20).BarValues[0] < 0)
   {
      // Go long
   }
   else
   {
      // Go short
   }
}
KBJ is offline  
Reply With Quote
Old 04-28-2008, 03:23 PM   #4
stefy
Senior Member
 
Join Date: Apr 2008
Posts: 310
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you very much, KBJ.

How would you write the code for the exit conditions (two darker bars in a row)?

Many thanks again
stefy is offline  
Reply With Quote
Old 04-28-2008, 05:12 PM   #5
Gumphrie
Senior Member
 
Join Date: Jun 2007
Posts: 218
Thanks: 0
Thanked 1 time in 1 post
Default

Hi stefy,

A squeeze indicates indecision in the market, so the theory goes that you enter a trade once the squeeze is off (-1 DotValue) in the direction of the bars, or any other indicator you care to use...
Gumphrie is offline  
Reply With Quote
Old 09-23-2009, 09:21 AM   #6
Brillo
Member
 
Join Date: Aug 2009
Posts: 48
Thanks: 3
Thanked 0 times in 0 posts
Default

Stefy, Did you ever get this to work? I'm trying to do the same but am confused about how to use an indicator from within a strategy. I have the BBS Squeeze indicator. It's an object, not a method. I thought that I would need to construct an instance of the BBS Squeeze in the strategy Initialize() method and call properties on the squeeze object. But I see from this thread you're using a BBS method. How can that work? Where is this method? Why don't you need to hold the object? Doesn't the object maintain state? See my thread on this matter here: http://www.ninjatrader-support2.com/...479#post116479
Thanks,
Tim
Brillo is offline  
Reply With Quote
Old 09-23-2009, 09:29 AM   #7
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Tim,

All indicators can be called like methods. What state are you trying to maintain?

For instance, take the SMA indicator. To access SMA values just go SMA(20)[0].

For BB Squeeze (this is just my guess as to what this indicator is/does) you could go BBSqueeze(some parameters).SomePlot[0]
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-24-2009, 09:31 AM   #8
stefy
Senior Member
 
Join Date: Apr 2008
Posts: 310
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi Brillo,

It was some time ago, but I was calling the "Dot Values" in the BBS Squeeze (which can be 0, 1, 2) like this:
BBS(2,1.5,20).DotValues[0]
and the BarValues like this:
BBS(2,1.5,20).BarValues[0]

I hope I answered your question, otherwise feel free to ask for more.

Have a nice day,

Stefy

Quote:
Originally Posted by Brillo View Post
Stefy, Did you ever get this to work? I'm trying to do the same but am confused about how to use an indicator from within a strategy. I have the BBS Squeeze indicator. It's an object, not a method. I thought that I would need to construct an instance of the BBS Squeeze in the strategy Initialize() method and call properties on the squeeze object. But I see from this thread you're using a BBS method. How can that work? Where is this method? Why don't you need to hold the object? Doesn't the object maintain state? See my thread on this matter here: http://www.ninjatrader-support2.com/...479#post116479
Thanks,
Tim
stefy is offline  
Reply With Quote
Old 09-24-2009, 05:30 PM   #9
Brillo
Member
 
Join Date: Aug 2009
Posts: 48
Thanks: 3
Thanked 0 times in 0 posts
Default

Hi Stefy, Thank you. I understand it better now. The NinjaScript generated code at the bottom of the indicator source file adds some methods to the Indicator class that allow you to construct the indicator using function like syntax. That same code binds it to the Input dataseries. There's also an overload to bind it to an arbitrary DataSeries object you pass in.
Tim
Brillo is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to test strategy based on time and fair value cassb Strategy Development 3 02-20-2008 09:57 AM
Strategy based on indicator value, not price? cassb Strategy Analyzer 2 12-19-2007 06:44 AM
Strategy based on Fast Stochastics Trader Rob Strategy Development 3 10-29-2007 09:51 PM
Need help with strategy based on Simulated stop vking ATM Strategies (Discretionary Trading) 9 10-18-2007 06:27 AM
coloring indicator based upon price parameters Thomas Indicator Development 10 08-28-2007 11:44 AM


All times are GMT -6. The time now is 05:39 PM.