Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Using Weekly Pivots To Trigger Trades

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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
    NinjaTrader Ecosystem Vendor - Elephant Tracks

    #2
    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 P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by z679Gju, Today, 02:37 PM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by mintos, 04-02-2024, 08:22 PM
    11 responses
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by cmtjoancolmenero, Yesterday, 02:31 PM
    7 responses
    23 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by hdge4u, 04-29-2024, 12:23 PM
    3 responses
    22 views
    0 likes
    Last Post MisterTee  
    Started by PaulMohn, 04-24-2024, 03:49 AM
    5 responses
    40 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X