![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: May 2007
Posts: 154
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
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.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |