示例#1
0
 public AccountInfo(ChartSlopeTrader cst)
 {
     InitializeComponent();
     cst.VS2010_InitializeComponent_Form(tabPageChart.Controls);
     _CST = cst;
     GetData();
     UpdateData();
     _working                 = true;
     formUpdateTimer          = new Timer(interval);
     formUpdateTimer.Elapsed += FormUpdateTimer_Elapsed;
     formUpdateTimer.Start();
 }
示例#2
0
        public RayContainer(MarketPosition marketPosition, IRay ray, ChartSlopeTrader strategy, bool isCloseHalf, bool isDts)
        {
            //Initialization global variables
            _strategy         = strategy;
            PositionType      = marketPosition;
            Distance          = strategy.ProportionalDistance < _strategy.TickSize * 3 ? 3 * strategy.TickSize : strategy.ProportionalDistance;
            IsAlternativeLine = false;

            //Set some local variables
            double distance = Distance;

            //Setting  up down if we are in the long
            if (marketPosition == MarketPosition.Long)
            {
                distance *= -1;
            }

            //Crating the lines
            OriginRay = ray;

            EntryRay = strategy.DrawRay("Enter", false,
                                        ray.Anchor1BarsAgo, ray.Anchor1Y + (distance * .3), ray.Anchor2BarsAgo, ray.Anchor2Y + (distance * .3),
                                        EnterColor, DashStyle.Solid, 2);

            StopRay = strategy.DrawRay("Stop", false,
                                       ray.Anchor1BarsAgo, ray.Anchor1Y + distance, ray.Anchor2BarsAgo, ray.Anchor2Y + distance,
                                       StopColor, DashStyle.Dash, 2);

            ProfitTargetRay = strategy.DrawRay("TakeProfit", false,
                                               ray.Anchor1BarsAgo, ray.Anchor1Y - distance, ray.Anchor2BarsAgo, ray.Anchor2Y - distance,
                                               TpColor, DashStyle.Dash, 2);

            if (isDts)
            {
                MadeStopRayHorizontal();
            }
            if (isCloseHalf)
            {
                PartialProfitEnable(false);
            }
            //Unlocking those rays if want to make them clear
            EntryRay.Locked        = false;
            StopRay.Locked         = false;
            ProfitTargetRay.Locked = false;
        }
        public DynamicTrailingStop(ChartSlopeTrader strategy, RayContainer rayContainer, bool isPreAnalyze, bool isPost)
        {
            //Setting the variables
            _strategy             = strategy;
            _rayContainer         = rayContainer;
            _isFirstSlope         = true;
            PositonType           = rayContainer.PositionType;
            _isWaitSlope          = true;
            _lastMinimumOrMaximum = 0;
            _lastSlope            = new Slope(0, 0);
            NewBar();
            UpdateFirstBar();

            if (isPreAnalyze)
            {
                //Getting the first slope
                Slope tempSlope = GetFirstStlope(0, Math.Min(PreAnalyzeValue, strategy.Low.Count - 1), isPost);
                if (_strategy.SwingIndicatorBars <= 1)
                {
                    MessageBox.Show("You can not start pre-analyze with one or less bars");
                    return;
                }
                if (PositonType == MarketPosition.Long && Math.Abs(tempSlope.Price - strategy.High[1]) < strategy.RealTickSize)
                {
                    MessageBox.Show("Your swing price want to be set as same as previous bar");
                    return;
                }
                if (PositonType == MarketPosition.Short && Math.Abs(tempSlope.Price - strategy.Low[1]) < strategy.RealTickSize)
                {
                    MessageBox.Show("Your swing price want to be set as same as previous bar");
                    return;
                }
                _currentSlope = tempSlope;
                UpdateSlopeLine(_currentSlope);
                _isFirstSlope = false;
                _isWaitSlope  = true;
                _strategy.SendMail_dtsNewSlopeLineNew(_currentSlope.Price);
            }
            else
            {
                _isWaitSlope = true;
            }
        }