NexusFi: Find Your Edge


Home Menu

 





Plot line has gaps/disconnected on intraday charts


Discussion in ThinkOrSwim

Updated
    1. trending_up 1,478 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 0 attachments




 
Search this Thread

Plot line has gaps/disconnected on intraday charts

  #1 (permalink)
MrRobot
Knoxville
 
Posts: 3 since Jul 2019
Thanks Given: 1
Thanks Received: 0

Hello!
I have a study I'm working on to measure the term structure/contango of /VX futures -- I just want to compare the percent difference between the front month contract and next month contract price. I'm then plotting this line on an /ES price chart. This is the formula I'm using:

(close(nextContractVX) - close("/VX")) / ((close("/VX") + nextContractVX) / 2);

However when I try to plot this on intraday charts there's several large gaps in the plot line and I was wondering if anyone knew what would cause this.

Here's the script:

 
Code
def Month = GetMonth();
def Year = GetYear();
def Year_Ext = Year - 2000;
def agg = AggregationPeriod.ten_MIN;
def NextContract = if Month == 1
                   then Close(symbol = "/VXJ" + Year_Ext, period = agg)
                   else if Month == 2
                   then Close(symbol = "/VXK" + Year_Ext, period = agg)
                   else if Month == 3
                   then Close(symbol = "/VXM" + Year_Ext, period = agg)
                   else if Month == 4
                   then Close(symbol = "/VXN" + Year_Ext, period = agg)
                   else double.nan;
plot contangoPercent = SimpleMovingAvg((nextContract - close("/VX")) / ((close("/VX") + nextContract) / 2), 5, 0);
# plot contangoPercent = (nextContract - close("/VX")) / ((close("/VX") + nextContract) / 2);
Since it's currently April -- month 4 -- NextContract is close("/VXN20")

Thanks very much!


Reply With Quote




Last Updated on April 3, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts