NinjaTrader Support Forum  

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-30-2008, 10:16 AM   #1
Jim-Boulder
Senior Member
 
Join Date: May 2007
Posts: 154
Thanks: 0
Thanked 0 times in 0 posts
Default Using Weekly Pivots To Trigger Trades

I want to build an intraday strategy that get's its entry signals based on weekly pivots. Let's assume I want to enter a long when the last traded price (on a 15 minute chart) first hits or exceeds the weekly pivot R1 value (the pivot being calculated on the prior weeks prices). In other words, starting Monday at 12:01 AM--whenever the last traded price hits or exceeds weekly pivot R1-I want to go long.)

Is this the proper syntax for this?:

if (Close[0] >= Pivots(PivotRange.Weekly, HLCCalculationMode.DailyBars, 20).R1[0])

Do I need to add the following (prior to it)

if(CurrentBar<XXXX)return;

if so, what is XXXX?

Do I need a weeks worth of 15-min bars so that the weekly pivots calculate correctly? is a week = 7x24 hours or 5 if I have weekend turned off?
Jim-Boulder is offline  
Reply With Quote
Old 05-01-2008, 02:28 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Hi Jim-Boulder,

The code you have will work. You do not need a CurrentBar check, but you will need to ensure you have enough data. Since you are using a CalculationMode of Daily Bars I think you need 7 days of daily bars for the week calcs to kick in. (Don't quote me on that I haven't checked completely.) Generally if there is not enough data your Pivots will throw off values of 0 and you will know this is wrong immediately. You could just throw in an extra condition of Pivots > 0 then you won't have to worry about bogus values messing up your strategy. If the value isn't 0 you know it is a good value.
NinjaTrader_Josh 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
trendline break trigger order Creamers General Programming 8 07-17-2012 06:13 AM
Weekly and Monthly Pivot points bmaltz Indicator Development 9 06-09-2007 06:24 AM
Auto Trail Stop Loss Didn't Trigger Jappenzeller ATM Strategies (Discretionary Trading) 5 03-12-2007 07:39 AM
Daily and Weekly Pivots don't work! nightowl Charting 4 03-07-2007 01:00 AM
Weekly Pivots Freddie Charting 2 02-21-2007 01:46 AM


All times are GMT -6. The time now is 11:13 PM.