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

Better practices to include checking the ^VIX for my strategy

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

    Better practices to include checking the ^VIX for my strategy

    Hello,

    I would like to know what are good practices when checking a daily bar chart of the ^VIX whilst trading the ES.

    The data series in use are these:
    -Primary data series : 30 Minute ES
    -Secondary data series : 1 Tick ES (mainly for intra bar fills in back tests.)

    I would like to include another data series, which is the ^VIX Daily Bar Chart. Within this data series I would like to create a bool that is set to true when its monthly EMA is greater than its yearly EMA, to imply greater volatility in the market.

    Should I include the ^VIX as a tertiary data series within this strategy? I had an idea of writing some logic like this to make the bool true to allow for trading:
    -----------------------------------------------------------------------------------

    else if (State == State.Configure)
    {
    //primary data series is the 30 Minute
    AddDataSeries(Data.BarsPeriodType.Tick, 1);
    AddDataSeries("^VIX", Data.BarsPeriodType.Day, 1);
    }

    OnBarUpdate()
    {
    if (BarsInProgress == 2)
    {
    if (^VIXEMAMonthly > ^VIXEMAYearly)
    {
    highVolatility == true;
    }
    else if (^VIXEMAMonthly <= ^VIXEMAYearly)
    {
    highVolatility == false;
    }
    }

    if (highVolatility == true)
    {
    //Rest of trading logic
    }
    }
    -----------------------------------------------------------------------------------

    Even though BIP 2 is a larger and different data series than the first two, would it be ok to check in this BIP first before all other BIPs and trading logic?

    #2
    Hello Don22Trader1,

    If you need the vix data you would have to include it as a secondary series like you have done.

    The order of your conditions for BarsInProgress don't matter, only 1 BarsInProgress calls OnBarUpdate at a time so whatever logic is surrounded by a BarsInProgress condition will be executed only if the correct BarsInProgress called OnBarUpdate.

    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by HappyTrader76, 06-11-2024, 03:29 AM
    9 responses
    45 views
    0 likes
    Last Post HappyTrader76  
    Started by Stanfillirenfro, Today, 05:35 AM
    0 responses
    3 views
    0 likes
    Last Post Stanfillirenfro  
    Started by Taddypole, Yesterday, 12:56 PM
    2 responses
    9 views
    0 likes
    Last Post Taddypole  
    Started by iq200, Today, 04:26 AM
    0 responses
    4 views
    0 likes
    Last Post iq200
    by iq200
     
    Started by Uregon, Today, 03:50 AM
    0 responses
    6 views
    0 likes
    Last Post Uregon
    by Uregon
     
    Working...
    X