NinjaTrader Support Forum  

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

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 05-13-2008, 07:42 AM   #1
cassb
Senior Member
 
Join Date: Nov 2007
Location: Victor, NY
Posts: 577
Thanks: 5
Thanked 4 times in 4 posts
Send a message via Yahoo to cassb Send a message via Skype™ to cassb
Default Question about Swing Indicator

Hi -- just a question about the Swing indicator.

When I first connect to my data provider in the morning and open a new chart, the chart will show so-many 'days back' of data. If I have a Swing indicator on the chart, it will carry over the swing value from the day before. So that the following code will reflect the Swing value from yesterday if there is not a new Swing pivot for the current day yet:

CurrentSH = Swing(Strength).SwingHigh[Strength];

I would like to NOT have the previous day's Swing pivots carry over to the next day. I want each day to start with CurrentSH=0 until a new pivot is created in the current trading day (let's say since Midnight). Is there a way to do this in a strategy?

Thanks!
Bryan
cassb is offline  
Reply With Quote
Old 05-13-2008, 07:45 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Not that I am aware of, you would have to code your own version of a swing indicator.
NinjaTrader_Ray is offline  
Reply With Quote
Old 05-13-2008, 07:58 AM   #3
cassb
Senior Member
 
Join Date: Nov 2007
Location: Victor, NY
Posts: 577
Thanks: 5
Thanked 4 times in 4 posts
Send a message via Yahoo to cassb Send a message via Skype™ to cassb
Default

OK. Is there anything that would indicate which bar or date or time or something that Swing(Strength).SwingHigh[Strength] is based on? If not, then I think I can probably customize the Swing code to store that and keep it as a property maybe. Do you have an idea of how to code that? I'm not sure I can add a new property to an indicator or not.

Something like Swing.SwingHigh.Bar or Swing.SwingHigh.Date.
Last edited by cassb; 05-13-2008 at 08:20 AM.
cassb is offline  
Reply With Quote
Old 05-13-2008, 08:54 AM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Something like -

Time[Swing(int strength).SwingHighBar(int barsAgo, int instance, int lookBackPeriod)]

Will return a DateTime object.
NinjaTrader_Ray is offline  
Reply With Quote
Old 05-13-2008, 09:28 AM   #5
cassb
Senior Member
 
Join Date: Nov 2007
Location: Victor, NY
Posts: 577
Thanks: 5
Thanked 4 times in 4 posts
Send a message via Yahoo to cassb Send a message via Skype™ to cassb
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
Something like -

Time[Swing(int strength).SwingHighBar(int barsAgo, int instance, int lookBackPeriod)]

Will return a DateTime object.
Excellent, Ray -- I'll play around with that, thanks!

Bryan
cassb is offline  
Reply With Quote
Old 05-13-2008, 01:11 PM   #6
cassb
Senior Member
 
Join Date: Nov 2007
Location: Victor, NY
Posts: 577
Thanks: 5
Thanked 4 times in 4 posts
Send a message via Yahoo to cassb Send a message via Skype™ to cassb
Default

Simple solution:

Code:
            if (ToDay(Time[Swing(5).SwingLowBar(0, 1, 100)]) == ToDay(Time[0]))  // Only evaluate swing value if set during the current trading session.
cassb 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
syntax Swing indicator nico_p General Programming 1 04-17-2008 07:16 AM
Measuring - swing indicator drago1 Indicator Development 1 02-21-2008 04:53 PM
Swing high low indicator winJR NinjaScript File Sharing Discussion 1 02-06-2008 12:39 AM
Howard Indicator and Pesavento Pattern Swing Indicator DORAIRAJ_S@HOTMAIL.COM Indicator Development 1 11-12-2007 12:28 AM
Swing Low/High indicator ts888 Indicator Development 10 07-12-2007 07:56 AM


All times are GMT -6. The time now is 06:34 PM.