Exemple #1
1
 protected override void OnStart()
 {
     _zigZag = Indicators.GetIndicator<ZigZag>(ZzDepth, ZzDeviation, ZzBackStep);
 }
//--------------------------------------

        protected override void Initialize()
        {
            _marketDepth = MarketData.GetMarketDepth(Symbol);
            _marketDepth.Updated += MarketDepthUpdated;

            BidVolume = CreateDataSeries();
            AskVolume = CreateDataSeries();

            zigzag = Indicators.GetIndicator<ZigZag>(Depth, Deviation, BackStep);

            foreach (var entry in _marketDepth.BidEntries)
            {
                PreviousBidList.Add(new Previouslist 
                {
                    Preis = entry.Price,
                    Volumen = entry.Volume
                });
            }

            foreach (var entry in _marketDepth.AskEntries)
            {
                PreviousAskList.Add(new Previouslist 
                {
                    Preis = entry.Price,
                    Volumen = entry.Volume
                });
            }

            LowFilterM = LowFilter * 1000000;
            HighFilterM = HighFilter * 1000000;
            fname = string.Format("{0}{1}{2}{3}", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "\\", FileName == "" ? Symbol.Code : FileName, ".csv");
            if (ReadFromFile && System.IO.File.Exists(fname) == true)
            {
                using (StreamReader Fstream = new StreamReader(fname))
                {
                    string line;
                    while ((line = Fstream.ReadLine()) != null)
                    {
                        try
                        {
                            string[] words = line.Split(Delimiters);
                            double vol = Convert.ToDouble(words[1]);
                            if (vol >= HighFilterM || vol < LowFilterM)
                                continue;
                            int bago = BarsAgo(Convert.ToDateTime(words[0]));
                            if (bago == -1)
                                continue;
                            int bidx = MarketSeries.Close.Count - 1 - bago;
                            if (double.IsNaN(AskVolume[bidx]))
                                AskVolume[bidx] = 0;
                            if (double.IsNaN(BidVolume[bidx]))
                                BidVolume[bidx] = 0;
                            switch (words[2])
                            {
                                case "A":
                                    AskVolume[bidx] += (vol / 1000000);
                                    break;
                                case "B":
                                    BidVolume[bidx] -= (vol / 1000000);
                                    break;
                            }
                        } catch
                        {
                            continue;
                        }
                    }
                }
            }
            if (WriteToFile)
            {
                if (System.IO.File.Exists(fname) == false)
                    System.IO.File.WriteAllText(fname, "");
                Timer.Start(WriteInterval);
            }
        }
Exemple #3
0
//--------------------------------------

        protected override void Initialize()
        {
            _marketDepth          = MarketData.GetMarketDepth(Symbol);
            _marketDepth.Updated += MarketDepthUpdated;

            BidVolume = CreateDataSeries();
            AskVolume = CreateDataSeries();

            zigzag = Indicators.GetIndicator <ZigZag>(Depth, Deviation, BackStep);

            foreach (var entry in _marketDepth.BidEntries)
            {
                PreviousBidList.Add(new Previouslist
                {
                    Preis   = entry.Price,
                    Volumen = entry.Volume
                });
            }

            foreach (var entry in _marketDepth.AskEntries)
            {
                PreviousAskList.Add(new Previouslist
                {
                    Preis   = entry.Price,
                    Volumen = entry.Volume
                });
            }

            LowFilterM  = LowFilter * 1000000;
            HighFilterM = HighFilter * 1000000;
            fname       = string.Format("{0}{1}{2}{3}", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "\\", FileName == "" ? Symbol.Code : FileName, ".csv");
            if (ReadFromFile && System.IO.File.Exists(fname) == true)
            {
                using (StreamReader Fstream = new StreamReader(fname))
                {
                    string line;
                    while ((line = Fstream.ReadLine()) != null)
                    {
                        try
                        {
                            string[] words = line.Split(Delimiters);
                            double   vol   = Convert.ToDouble(words[1]);
                            if (vol >= HighFilterM || vol < LowFilterM)
                            {
                                continue;
                            }
                            int bago = BarsAgo(Convert.ToDateTime(words[0]));
                            if (bago == -1)
                            {
                                continue;
                            }
                            int bidx = MarketSeries.Close.Count - 1 - bago;
                            if (double.IsNaN(AskVolume[bidx]))
                            {
                                AskVolume[bidx] = 0;
                            }
                            if (double.IsNaN(BidVolume[bidx]))
                            {
                                BidVolume[bidx] = 0;
                            }
                            switch (words[2])
                            {
                            case "A":
                                AskVolume[bidx] += (vol / 1000000);
                                break;

                            case "B":
                                BidVolume[bidx] -= (vol / 1000000);
                                break;
                            }
                        } catch
                        {
                            continue;
                        }
                    }
                }
            }
            if (WriteToFile)
            {
                if (System.IO.File.Exists(fname) == false)
                {
                    System.IO.File.WriteAllText(fname, "");
                }
                Timer.Start(WriteInterval);
            }
        }
 protected override void Initialize()
 {
     zigzag  = new ZigZag(this, MarketSeries.TimeFrame, Depth, Deviation, BackStep, ShowHistory);
     zigzag1 = new ZigZag(this, Timeframe1, Depth, Deviation, BackStep, ShowHistory);
     zigzag2 = new ZigZag(this, Timeframe2, Depth, Deviation, BackStep, ShowHistory);
 }
Exemple #5
0
		protected override void OnStart()
		{
			base.OnStart();
			botLabel = string.Format("{0}-{1} {2}", botPrefix, Symbol.Code, TimeFrame);

			Print(this.botName());


			wpr = Indicators.GetIndicator<WilliamsPercentRange>(wprSource, wprPeriod, wprOverbuyCeil, wprOversellCeil, WprMagicNumber, wprMinMaxPeriod, wprExceedMinMax);
			
			// ZigZag Kwan MBFX Timing ou Beta
			zigzagKwanMBFXTiming = Indicators.GetIndicator<ZigzagKwanMBFXTiming>(mbfxLen, mbfxFilter);

			zigZag = Indicators.GetIndicator<ZigZag>(ZzDepth, ZzDeviation, ZzBackStep);

			trendMagic = Indicators.GetIndicator<TrendMagic>(TMCciPeriod, TMAtrPeriod);

			_cci = Indicators.CommodityChannelIndex(TMCciPeriod);

			Positions.Opened += OnPositionOpened;
			Positions.Closed += OnPositionClosed;
		}
 protected override void Initialize()
 {
     zigzag = new ZigZag(this, MarketSeries.TimeFrame, Depth, Deviation, BackStep, ShowHistory);
     zigzag1 = new ZigZag(this, Timeframe1, Depth, Deviation, BackStep, ShowHistory);
     zigzag2 = new ZigZag(this, Timeframe2, Depth, Deviation, BackStep, ShowHistory);
 }