Beispiel #1
0
 public SymbolInfo()                     // used by JSONdeserialize() /  XMLdeserialize()
 //this.MarketName = "US Equities";
 {
     this.SecurityType = SecurityType.Stock;
     this.SymbolClass  = "";
     this.Point2Dollar = 1.0;
     //this.Decimals = DecimalsManager.Instance.Pricing;
     this.DecimalsPrice          = 2;
     this.DecimalsVolume         = 0;            // if your Forex Symbol uses lotMin=0.001, DecimalsVolume = 3
     this.PriceLevelSizeForBonds = 1.0;
     //for (int i = this.Decimals; i > 0; i--) this.PriceLevelSize /= 10.0;
     this.SameBarPolarCloseThenOpen = true;
     this.SequencedOpeningAfterClosedDelayMillis = 1000;
     this.MarketOrderAs = MarketOrderAs.Unknown;
     this.ReplaceTidalWithCrossMarket = false;
     this.ReplaceTidalMillis          = 0;
     this.SlippagesBuy                = "";
     this.SlippagesSell               = "";
     this.ReSubmitRejected            = false;
     this.ReSubmittedUsesNextSlippage = false;
     this.UseFirstSlippageForBacktest = true;
     this.EmergencyCloseDelayMillis   = 8000;
     this.EmergencyCloseAttemptsMax   = 5;
     this.LeverageForFutures          = 1;
 }
Beispiel #2
0
        public Alert(Bar bar, double qty, double priceScript, string signalName,
                     Direction direction, MarketLimitStop marketLimitStop, OrderSpreadSide orderSpreadSide,
                     Strategy strategy) : this()
        {
            if (direction == Direction.Unknown)
            {
                string msg = "ALERT_CTOR_DIRECTION_MUST_NOT_BE_UNKNOWN: when creating an Alert, direction parameter can't be null";
                throw new Exception(msg);
            }
            if (bar == null)
            {
                string msg = "ALERT_CTOR_BAR_MUST_NOT_BE_NULL: when creating an Alert, bar parameter can't be null";
                throw new Exception(msg);
            }
            if (bar.ParentBars == null)
            {
                string msg = "ALERT_CTOR_PARENT_BARS_MUST_NOT_BE_NULL: when creating an Alert, bar.ParentBars can't be null";
                throw new Exception(msg);
            }
            this.Bars           = bar.ParentBars;
            this.PlacedBar      = bar;
            this.PlacedBarIndex = bar.ParentBarsIndex;
            this.Symbol         = bar.Symbol;

            this.BarsScaleInterval = this.Bars.ScaleInterval;
            if (this.Bars.SymbolInfo != null)
            {
                SymbolInfo symbolInfo = this.Bars.SymbolInfo;
                this.SymbolClass   = (string.IsNullOrEmpty(symbolInfo.SymbolClass) == false) ? symbolInfo.SymbolClass : "UNKNOWN_CLASS";
                this.MarketOrderAs = symbolInfo.MarketOrderAs;
            }

            this.AccountNumber = "UNKNOWN_ACCOUNT";
            if (this.DataSource.BrokerProvider != null && this.DataSource.BrokerProvider.AccountAutoPropagate != null &&
                string.IsNullOrEmpty(this.Bars.DataSource.BrokerProvider.AccountAutoPropagate.AccountNumber) != false)
            {
                this.AccountNumber = this.Bars.DataSource.BrokerProvider.AccountAutoPropagate.AccountNumber;
            }


            this.Qty             = qty;
            this.PriceScript     = priceScript;
            this.SignalName      = signalName;
            this.Direction       = direction;
            this.MarketLimitStop = marketLimitStop;
            this.OrderSpreadSide = orderSpreadSide;

            this.Strategy = strategy;
            if (this.Strategy != null)
            {
                this.StrategyID   = this.Strategy.Guid;
                this.StrategyName = this.Strategy.Name;
            }

            if (this.Strategy.Script != null)
            {
                string msg = "Looks like a manual Order submitted from the Chart";
                return;
            }
        }
Beispiel #3
0
 public Alert()                  // called by Json.Deserialize()
 {
     PlacedBarIndex = -1;
     FilledBarIndex = -1;
     //TimeCreatedServerBar = DateTime.MinValue;
     this.QuoteCreatedThisAlertServerTime = DateTime.MinValue;
     Symbol = "UNKNOWN_JUST_DESERIALIZED";
     //SymbolClass = "";		//QUIK
     //AccountNumber = "";
     PriceScript               = 0;
     PriceDeposited            = -1;             // for a Future, we pay less that it's quoted (GUARANTEE DEPOSIT)
     Qty                       = 0;
     MarketLimitStop           = MarketLimitStop.Unknown;
     MarketOrderAs             = MarketOrderAs.Unknown;
     Direction                 = Direction.Unknown;
     SignalName                = "";
     StrategyID                = Guid.Empty;
     StrategyName              = "NO_STRATEGY";
     BarsScaleInterval         = new BarScaleInterval(BarScale.Unknown, 0);
     OrderFollowed             = null;
     MreOrderFollowedIsNotNull = new ManualResetEvent(false);
 }
		public SymbolInfo() { 		// used by JSONdeserialize() /  XMLdeserialize()
			//this.MarketName = "US Equities";
			this.SecurityType = SecurityType.Stock;
			this.SymbolClass = "";
			this.Point2Dollar = 1.0;
			//this.Decimals = DecimalsManager.Instance.Pricing;
			this.DecimalsPrice = 2;
			this.DecimalsVolume = 0;	// if your Forex Symbol uses lotMin=0.001, DecimalsVolume = 3 
			this.PriceLevelSizeForBonds = 1.0;
			//for (int i = this.Decimals; i > 0; i--) this.PriceLevelSize /= 10.0;
			this.SameBarPolarCloseThenOpen = true;
			this.SequencedOpeningAfterClosedDelayMillis = 1000;
			this.MarketOrderAs = MarketOrderAs.Unknown;
			this.ReplaceTidalWithCrossMarket = false;
			this.ReplaceTidalMillis = 0;
			this.SlippagesBuy = "";
			this.SlippagesSell = "";
			this.ReSubmitRejected = false;
			this.ReSubmittedUsesNextSlippage = false;
			this.UseFirstSlippageForBacktest = true;
			this.EmergencyCloseDelayMillis = 8000;
			this.EmergencyCloseAttemptsMax = 5;
			this.LeverageForFutures = 1;
		}
		public Alert(Bar bar, double qty, double priceScript, string signalName,
				Direction direction, MarketLimitStop marketLimitStop, OrderSpreadSide orderSpreadSide,
				Strategy strategy) : this() {

			if (direction == Direction.Unknown) {
				string msg = "ALERT_CTOR_DIRECTION_MUST_NOT_BE_UNKNOWN: when creating an Alert, direction parameter can't be null";
				throw new Exception(msg);
			}
			if (bar == null) {
				string msg = "ALERT_CTOR_BAR_MUST_NOT_BE_NULL: when creating an Alert, bar parameter can't be null";
				throw new Exception(msg);
			}
			if (bar.ParentBars == null) {
				string msg = "ALERT_CTOR_PARENT_BARS_MUST_NOT_BE_NULL: when creating an Alert, bar.ParentBars can't be null";
				throw new Exception(msg);
			}
			this.Bars = bar.ParentBars;
			this.PlacedBar = bar;
			this.PlacedBarIndex = bar.ParentBarsIndex;
			this.Symbol = bar.Symbol;
			
			this.BarsScaleInterval = this.Bars.ScaleInterval;
			if (this.Bars.SymbolInfo != null) {
				SymbolInfo symbolInfo = this.Bars.SymbolInfo;
				this.SymbolClass = (string.IsNullOrEmpty(symbolInfo.SymbolClass) == false) ? symbolInfo.SymbolClass : "UNKNOWN_CLASS";
				this.MarketOrderAs = symbolInfo.MarketOrderAs;
			}
			
			this.AccountNumber = "UNKNOWN_ACCOUNT";
			if (this.DataSource.BrokerProvider != null && this.DataSource.BrokerProvider.AccountAutoPropagate != null
			    && string.IsNullOrEmpty(this.Bars.DataSource.BrokerProvider.AccountAutoPropagate.AccountNumber) != false) {
				this.AccountNumber = this.Bars.DataSource.BrokerProvider.AccountAutoPropagate.AccountNumber;
			}
			

			this.Qty = qty;
			this.PriceScript = priceScript;
			this.SignalName = signalName;
			this.Direction = direction;
			this.MarketLimitStop = marketLimitStop;
			this.OrderSpreadSide = orderSpreadSide;

			this.Strategy = strategy;
			if (this.Strategy != null) {
				this.StrategyID = this.Strategy.Guid;
				this.StrategyName = this.Strategy.Name;
			}
			
			if (this.Strategy.Script != null) {
				string msg = "Looks like a manual Order submitted from the Chart";
				return;
			}
		}
		public Alert() {	// called by Json.Deserialize()
			PlacedBarIndex = -1;
			FilledBarIndex = -1;
			//TimeCreatedServerBar = DateTime.MinValue;
			this.QuoteCreatedThisAlertServerTime = DateTime.MinValue;
			Symbol = "UNKNOWN_JUST_DESERIALIZED";
			//SymbolClass = "";		//QUIK
			//AccountNumber = "";
			PriceScript = 0;
			PriceDeposited = -1;		// for a Future, we pay less that it's quoted (GUARANTEE DEPOSIT)
			Qty = 0;
			MarketLimitStop = MarketLimitStop.Unknown;
			MarketOrderAs = MarketOrderAs.Unknown;
			Direction = Direction.Unknown;
			SignalName = "";
			StrategyID = Guid.Empty;
			StrategyName = "NO_STRATEGY"; 
			BarsScaleInterval = new BarScaleInterval(BarScale.Unknown, 0);
			OrderFollowed = null;
			MreOrderFollowedIsNotNull = new ManualResetEvent(false);
		}