Back

Cash symbols must be exactly 3 characters.

Hi Guys,

I wrote code to test "UVXY" but I get error like this, do you know how to solve this? 

Update Backtest








UVXY is a equity but it sounds like you're adding it as a forex pair.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi, below is my code, I think I add it as equity..
namespace QuantConnect 
{   

    public class BasicTemplateAlgorithm : QCAlgorithm
    {
        
        private  string symbol = "SPY";
        private  int quantity=100;
        private  int trigger=0;
        //movingaveragealgorithm emafast=new movingaveragealgorithm(10);
        //movingaveragealgorithm emaslow=new movingaveragealgorithm(50);
        //MovingAverageConvergenceDivergence _macd;

        
   public override void Initialize()
        {
            SetStartDate(2009, 01, 05);
            SetEndDate(2009, 01, 12);
            SetCash(30000);
            AddSecurity(SecurityType.Equity, symbol, Resolution.Minute);

            // if(Time.Date.DayOfWeek==DayOfWeek.Monday)
            //       Log(Time+"");
            // else
            //      Log("aaa"+Time.Date.DayOfWeek);
          Schedule.On(DateRules.Every(DayOfWeek.Monday), TimeRules.AfterMarketOpen("SPY", 0), () =>
            {
                trigger=-1;
                Log(Time.ToString()+"");
            });
            
           Schedule.On(DateRules.Every(DayOfWeek.Friday), TimeRules.BeforeMarketClose("SPY", 0), () =>
            {
                trigger=1;
                Log(Time.ToString()+"");
            });
         
         
         //_macd = MACD(symbol, 12, 26, 9, MovingAverageType.Simple, Resolution.Daily);
         }

        public void OnData(TradeBars data) 
        {  
            if(trigger==-1&&!Portfolio.HoldStock)
            {
                Order(symbol, -quantity);
            }
            else if(trigger==1)
            {
                Order(symbol,quantity);
            }
            
            
            
            
        // Log(Time.Date.DayOfWeek+"");
        // Log(trigger+"");
       // Log(Time.ToString());
       // Log(Time.ToString("ddddd"));
        //Log(trigger+"");
            // if(Time.ToString("dddd"))
            // {
         //     Order(symbol, -Portfolio[symbol].Quantity);

            // }
            // else if (Time.)
            // {
            //   Order(symbol, Portfolio[symbol].Quantity);

            // }
            // else return;
         //MovingAverageConvergenceDivergence macd=MACD(["SPY"],10,30,15,MovingAverageType.Simple,Resolution.Daily,null);
        // AverageTrueRange atr= ATR("SPY", 14,  MovingAverageType.Simple, Resolution.Daily);
        }
    }
}

0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed