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

Parabolic Sar with Day Bar

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

    Parabolic Sar with Day Bar

    Hello,

    I have a strategy which works with minute bars, but I also need the value of the previous day parabolic SAR and VIX calculated with day Bars

    How I could charge this parametres?

    I obtain the VIX value from a data provider, but I don`t know how to charge it
    Last edited by etruria; 07-14-2018, 10:32 AM.

    #2
    Hello etruria,

    Thank you for your note.

    I’ve attached a sample which will add a secondary data series with a period of day, which is then passed to the Parabolic Sar method and prints to the output window the value on the current bar. For the previous days value you would change,

    Code:
    ParabolicSAR(BarsArray[1], 0.02, 0.2, 0.02)[0];
    To,

    Code:
    ParabolicSAR(BarsArray[1], 0.02, 0.2, 0.02)[B][1];[/B]
    For 1 bar ago.

    Parabllic Sar section of our helpguide.


    For the value of the VIX, you would want to add the Vix data series to your strategy,

    Code:
    Add(^VIX, PeriodType.Day,1);
    And then pass BarsArray[2] to the Parabolic Sar method just like in the example, but BarsArray[2] rather than BarsArray[1].

    Adding another series to the attached script would require you to also add another current bar check, which might look like,

    Code:
    if(CurrentBars[2] < 10) return;
    See the link below on CurrentBar checks,


    Please let us know if you need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      So, I supose that the name with I call the vix would be

      CloseVix = VIX(BarsArray[2])[1]

      Thanks for your help

      Comment


        #4
        Hello, I have tried the code you have told me for the VIX and I can´t compile the strategy because the program said me that it doesn´t recognize the following character ^

        Thanks for your help

        Comment


          #5
          Hello etruria,

          Use quotes for the symbol name.

          Add("^VIX", PeriodType.Day,1);

          See Add section of our helpguide,


          Please let us know if you need further assistance.
          Alan P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by love2code2trade, 04-17-2024, 01:45 PM
          4 responses
          31 views
          0 likes
          Last Post love2code2trade  
          Started by cls71, Today, 04:45 AM
          2 responses
          10 views
          0 likes
          Last Post eDanny
          by eDanny
           
          Started by proptrade13, Today, 11:06 AM
          0 responses
          5 views
          0 likes
          Last Post proptrade13  
          Started by kulwinder73, Today, 10:31 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by RookieTrader, Today, 09:37 AM
          3 responses
          15 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X