Profile Picture

Bar Error at StartUp Event

Posted By isaacvictorbabani 2 Years Ago
Message
Posted Thursday January 22 2015
Hello,
I am running a strategy with multiple instruments and am getting an error after the StartUp event completes for the last instrument.  The error message is in the attached image.
It is unclear why this is occurring.  It would seem that the code is trying to read a historical bar for one of the option instruments at a time (8:36am) when the options market is closed.  However, I only want to read in historical bars for the underlying instrument.  I thought I was explicitly handling this, but it appears I am mistaken.  Can you please advise how I may remedy this issue?  Thank you.  

http://www.rightedgesystems.com/forums/uploads/images/cd0ebe00-7d50-4d81-9709-0159.png
Posted Thursday January 22 2015
There's not a way to use historical data for one of the symbols your system is using but not another one.

To fix this, right click on the symbol with the invalid bar in the watch list.  Choose "Check bar data for problems" and it will show you the bars with issues and give you the option to fix them.

Thanks,
Daniel
Posted Friday January 23 2015
Thank you.

One more question: as I understand RE, I can add code in the Startup event of the MySystem class if I want this code to execute one time.  If I add code to the Startup event of the MySymbolScript class, it will execute once for each instrument in the strategy.  That said, I have some code I would like to only execute once (in the MySystem class), but it would contain some variable values I would like to use within the MySymbolScript class.  Is it possible to pass variables defined in the Startup event of the MySystem class to the MySymbolScript class?  
Posted Friday January 23 2015
You can put public properties in the MySystem class, set them in the Startup method, and then access them from the SymbolScript Startup method:

double propertyValue = TradingSystem.MyProperty;


Does this help?

Thanks,
Daniel
Posted Friday January 23 2015
My question is one of variable scope.  To use a specific example, I have some code that determines the user's location and determines the TimeSpan offset to US Eastern time.  This TimeSpan is used at every bar/tick to check if the bar/tick time is within the allowed trading hours.  So I have a variable TimeSpan named timeZoneOffset that would be set in the MySystem class and used within the MySymbolScript class.  How/where do I declare the variable so that it may be assigned within the Startup event of the MySystem class but used in various events of the MySymbolScript class?

Thank you. 
Posted Monday January 26 2015
With your suggestion, I was able to make this work using: 

public class MySystem : MySystemBase
{
     public Symbol mySymbol; 
     public override void Startup()
     {
             mySymbol = ....; 
     }
}

public class MySymbolScript : MySymbolScriptBase
{
      public override void Startup()
     {
          if (Symbol.Equals(TradingSystem.mySymbol)
          {
          }
     }
}

Thank you for the suggestion. 
Posted Monday January 26 2015
Glad to hear you worked it out!

Thanks,
Daniel


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems