//-------------- // サイン描く private void _DrawSign(int index, TradeType tradeType) { var iconType = tradeType == TradeType.Buy ? BuyIcon : SellIcon; var iconColor = tradeType == TradeType.Buy ? BuyColor : SellColor; var time = _chart.Bars.OpenTimes[index]; var price = _chart.Bars.LastBar.Close; _chart.DrawIcon(_GetName(index), iconType, time, price, iconColor); // --- アラート処理は最新バーのみ if (index == _chart.Bars.Count - 1) { if ((WhenAlert.HasFlag(WhenAlert.FirstTime) && !_firstTime) || WhenAlert == WhenAlert.EveryTime) { _Alert(); _firstTime = true; } } // --- cTraner連携用仕掛け if (_isVisualMode) { _chart.DrawIcon("entry_sign_for_ctraner", iconType, index, 0, Color.Transparent).IsInteractive = true; } }
//----------------- // サイン確定処理 private void _FixSign(int index) { var sign = _chart.FindObject(_GetName(index)) as ChartIcon; if (sign != null) { // --- リスト追加 var time = _chart.Bars.OpenTimes[index]; _signOpenTimes.Add(time); // --- Y位置調整 var upper = _chart.Bars[index].High + DrawMargin; var lower = _chart.Bars[index].Low - DrawMargin; var itype = sign.IconType; if (itype == BuyIcon) { sign.Y = lower; } else if (itype == SellIcon) { sign.Y = upper; } if (WhenAlert.HasFlag(WhenAlert.Update)) { _Alert(); } } _firstTime = false; }