protected override void OnTick() { var longPosition = Positions.Find(Label, Symbol, TradeType.Buy); var shortPosition = Positions.Find(Label, Symbol, TradeType.Sell); //SMA Trend var MA1 = SMATrend.Result.Last(1); //Pivot Points Levels var PivotPoints = MarketData.GetSeries(TimeFrame); var closepip = PivotPoints.Close.Last(1); var Pricey = (Symbol.Ask + Symbol.Bid) / 2; var highest = MarketSeries.High.Last(1); var lowest = MarketSeries.Low.Last(1); //Pivot Point var PP = (highest + lowest + closepip) / 3; var highestR = MarketSeries.High.Last(1); for (int i = 2; i <= Periods; i++) { if (MarketSeries.High.Last(i) > highestR) { highestR = MarketSeries.High.Last(i); } } Print("highest: ", highestR); var lowestR = MarketSeries.Low.Last(1); for (int i = 2; i <= Periods; i++) { if (MarketSeries.Low.Last(i) < lowestR) { lowestR = MarketSeries.Low.Last(i); } } Print("lowest: ", lowestR); //Pivot Points: Range var R4R = 3 * PP + (highestR - 3 * lowestR); var R3R = 2 * PP + (highestR - 2 * lowestR); var R2R = PP + (highestR - lowestR); var R1R = 2 * PP - lowestR; var S1R = 2 * PP - highestR; var S2R = PP - (highestR - lowestR); var S3R = 2 * PP - (2 * highestR - lowestR); var S4R = 3 * PP - (3 * highestR - lowestR); if ((Trend ? closepip >= MA1 : true) && (Pricey <= (PivotSupport == 1 ? S1R : (PivotSupport == 2 ? S2R : (PivotSupport == 3 ? S3R : S4R)))) && longPosition == null) { ExecuteMarketOrder(TradeType.Buy, Symbol, Symbol.NormalizeVolume(Volume), Label, StopLoss, TakeProfit); } else if ((Trend ? closepip <= MA1 : true) && (Pricey >= (PivotResistance == 1 ? R1R : (PivotResistance == 2 ? R2R : (PivotResistance == 3 ? R3R : R4R)))) && shortPosition == null) { ExecuteMarketOrder(TradeType.Sell, Symbol, Symbol.NormalizeVolume(Volume), Label, StopLoss, TakeProfit); } }
//==================================================================================================================== // Insert() //==================================================================================================================== public void Insert(string Currency = "GBPJPY") { // Current UNIX timestamp //Int32 Stamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; MarketSeries data = MarketData.GetSeries(Currency, TimeFrame.Weekly); DataSeries series = data.Close; int index = series.Count - 1; double close = data.Close[index]; double high = data.High[index]; double low = data.Low[index]; double open = data.Open[index]; Int32 opentime = (Int32)(data.OpenTime[index].Subtract(new DateTime(1970, 1, 1))).TotalSeconds; Print(open); //string query = "INSERT INTO account (time, accountid, balance, equity) VALUES('" + Stamp + "','" + Account.Number + "', '" + Account.Balance + "', '" + Account.Equity + "')"; string query = "INSERT INTO " + Currency + " (time, open, close, low, high) VALUES('" + opentime + "','" + open + "', '" + close + "', '" + low + "', '" + high + "')"; //create command and assign the query and connection from the constructor MySqlCommand cmd = new MySqlCommand(query, connection); //Execute command cmd.ExecuteNonQuery(); }
protected override void Initialize() { symbol2 = MarketData.GetSymbol(Symbol2); symbol3 = MarketData.GetSymbol(Symbol3); symbol4 = MarketData.GetSymbol(Symbol4); symbol5 = MarketData.GetSymbol(Symbol5); symbol6 = MarketData.GetSymbol(Symbol6); symbol7 = MarketData.GetSymbol(Symbol7); symbol8 = MarketData.GetSymbol(Symbol8); symbol9 = MarketData.GetSymbol(Symbol9); symbol10 = MarketData.GetSymbol(Symbol10); series2 = MarketData.GetSeries(symbol2, TimeFrame); series3 = MarketData.GetSeries(symbol3, TimeFrame); series4 = MarketData.GetSeries(symbol4, TimeFrame); series5 = MarketData.GetSeries(symbol5, TimeFrame); series6 = MarketData.GetSeries(symbol6, TimeFrame); series7 = MarketData.GetSeries(symbol7, TimeFrame); series8 = MarketData.GetSeries(symbol8, TimeFrame); series9 = MarketData.GetSeries(symbol9, TimeFrame); series10 = MarketData.GetSeries(symbol10, TimeFrame); ma1 = Indicators.MovingAverage(MarketSeries.Close, Period, MaType); ma2 = Indicators.MovingAverage(series2.Close, Period, MaType); ma3 = Indicators.MovingAverage(series3.Close, Period, MaType); ma4 = Indicators.MovingAverage(series4.Close, Period, MaType); ma5 = Indicators.MovingAverage(series5.Close, Period, MaType); ma6 = Indicators.MovingAverage(series6.Close, Period, MaType); ma7 = Indicators.MovingAverage(series7.Close, Period, MaType); ma8 = Indicators.MovingAverage(series8.Close, Period, MaType); ma9 = Indicators.MovingAverage(series9.Close, Period, MaType); ma10 = Indicators.MovingAverage(series10.Close, Period, MaType); }
protected override void Initialize() { if (EnableATRInfo) { atr = Indicators.AverageTrueRange(14, MovingAverageType.Exponential); } if (EnableD1) { seriesD1 = MarketData.GetSeries(TimeFrame.Daily); macdD1 = Indicators.MacdCrossOver(seriesD1.Close, 26, 12, 9); mmD1 = Indicators.ExponentialMovingAverage(seriesD1.Close, 200); } if (EnableH4) { seriesH4 = MarketData.GetSeries(TimeFrame.Hour4); macdH4 = Indicators.MacdCrossOver(seriesH4.Close, 26, 12, 9); mmH4 = Indicators.ExponentialMovingAverage(seriesH4.Close, 200); } if (EnableH1) { seriesH1 = MarketData.GetSeries(TimeFrame.Hour); macdH1 = Indicators.MacdCrossOver(seriesH1.Close, 26, 12, 9); mmH1 = Indicators.ExponentialMovingAverage(seriesH1.Close, 200); } if (EnableM5) { seriesM5 = MarketData.GetSeries(TimeFrame.Minute5); macdM5 = Indicators.MacdCrossOver(seriesM5.Close, 26, 12, 9); mmM5 = Indicators.ExponentialMovingAverage(seriesM5.Close, 200); } }
protected override void Initialize() { try { // Get the 1 min timeframe series of data minuteSeries = MarketData.GetSeries(Symbol, TimeFrame.Minute); warningTextColor = (Colors)Enum.Parse(typeof(Colors), WarningColor, true); spreadTextColor = (Colors)Enum.Parse(typeof(Colors), SpreadColor, true); } catch (Exception e) { errorOccured = true; Print("Scalpers Buddy: " + e.Message); } // position alert message on screen switch (WarningPostion) { case 1: position = StaticPosition.TopLeft; break; case 2: position = StaticPosition.TopCenter; break; case 3: position = StaticPosition.TopRight; //lowerPosition = "\n\n"; break; case 4: position = StaticPosition.Right; lowerPosition = "\n\n"; break; case 5: position = StaticPosition.BottomRight; lowerPosition = "\n\n"; break; case 6: position = StaticPosition.BottomCenter; lowerPosition = "\n\n"; break; case 7: position = StaticPosition.BottomLeft; lowerPosition = "\n\n"; break; case 8: position = StaticPosition.Left; lowerPosition = "\n\n"; break; default: position = StaticPosition.TopLeft; break; } }
////////////TVI Params End ////////////////// protected override void Initialize() { //////////////TVI Init Start ////////////// UpTick = CreateDataSeries(); DnTick = CreateDataSeries(); TVI_Calculate = CreateDataSeries(); EMA_UpTick = Indicators.ExponentialMovingAverage(UpTick, EMA); EMA_DnTick = Indicators.ExponentialMovingAverage(DnTick, EMA); DEMA_UpTick = Indicators.ExponentialMovingAverage(EMA_UpTick.Result, DEMA); DEMA_DnTick = Indicators.ExponentialMovingAverage(EMA_DnTick.Result, DEMA); TVI = Indicators.ExponentialMovingAverage(TVI_Calculate, TEMA); //////////////TVI init End /////////////// // Initialize and create nested indicators LongTF_Series = MarketData.GetSeries(Ref_TF); MedTF_Series = MarketData.GetSeries(Med_TF); SmallTF_Series = MarketData.GetSeries(Lil_TF); MA50 = Indicators.ExponentialMovingAverage(MarketSeries.Close, Ma_Periods); MA50_LongTF = Indicators.ExponentialMovingAverage(LongTF_Series.Close, Ma_Periods); MA50_MedTF = Indicators.ExponentialMovingAverage(MedTF_Series.Close, Ma_Periods); MA50_SmallTF = Indicators.ExponentialMovingAverage(SmallTF_Series.Close, Ma_Periods); }
protected override void OnTick() { var Daily = MarketData.GetSeries(TimeFrame.Daily); var High = Daily.High.Last(1); var Low = Daily.Low.Last(1); var Close = Daily.Close.Last(1); var Pivot = (High + Low + Close) / 3; var Price = (Symbol.Ask + Symbol.Bid) / 2; if (Price < Pivot) { if (rsi1.Result.LastValue > 70 && mfi1.Result.LastValue > 70) { //open sell position & close buy positions openPosition(TradeType.Sell); //closePosition(TradeType.Buy); } } if (Price > Pivot) { if (rsi1.Result.LastValue < 30 && mfi1.Result.LastValue < 30) { // open buy position & close sell positions openPosition(TradeType.Buy); //closePosition(TradeType.Sell); } } }
/// <summary>Return the series for a given symbol and time frame</summary> public MarketSeries GetSeries(Symbol sym, TimeFrame tf) { if (MarketSeries.SymbolCode == sym.Code && MarketSeries.TimeFrame == tf) { return(MarketSeries); } if (IsBacktesting) { throw new Exception("This can't be used in back testing"); } MarketSeries res = null; using (var wait = new ManualResetEvent(false)) { BeginInvokeOnMainThread(() => { res = MarketData.GetSeries(sym, tf); wait.Set(); }); wait.WaitOne(); return(res); } }
public override void Calculate(int index) { var series = MarketData.GetSeries(pExitTimeFrame); var open = series.Open[index]; var high = series.High[index]; var low = series.Low[index]; var close = series.Close[index]; var haClose = (open + high + low + close) / 4; double haOpen; if (index > 0) { haOpen = (_haOpen[index - 1] + _haClose[index - 1]) / 2; } else { haOpen = (open + close) / 2; } var haHigh = Math.Max(Math.Max(high, haOpen), haClose); var haLow = Math.Min(Math.Min(low, haOpen), haClose); _haOpen[index] = haOpen; _haClose[index] = haClose; haDirection[index] = haOpen > haClose ? -1 : 1; }
protected override void OnStart() { Positions.Closed += OnPositionsClosed; var SMASeries = MarketData.GetSeries(SMATimeFrame); SMATrend = Indicators.MovingAverage(SMASeries.Close, SMAPeriods, MovingAverageType.Simple); }
private void InitializeIndicators(TimeFrame tf) { lmm50[tf] = new Dictionary <string, ExponentialMovingAverage>(); lmm200[tf] = new Dictionary <string, WeightedMovingAverage>(); rmm200[tf] = new Dictionary <string, WeightedMovingAverage>(); lmacd[tf] = new Dictionary <string, MacdCrossOver>(); rmacd[tf] = new Dictionary <string, MacdCrossOver>(); rseries[tf] = new Dictionary <string, MarketSeries>(); lseries[tf] = new Dictionary <string, MarketSeries>(); foreach (var sym in symbols) { Print("Initializing data for: {0}/{1}.", sym, tf); var reftf = GetReferenceTimeFrame(tf); var lmks = MarketData.GetSeries(sym, tf); var rmks = MarketData.GetSeries(sym, reftf); lmm50[tf][sym] = Indicators.ExponentialMovingAverage(lmks.Close, 50); lmm200[tf][sym] = Indicators.WeightedMovingAverage(lmks.Close, 200); rmm200[tf][sym] = Indicators.WeightedMovingAverage(rmks.Close, 200); lmacd[tf][sym] = Indicators.MacdCrossOver(lmks.Close, 26, 12, 9); rmacd[tf][sym] = Indicators.MacdCrossOver(rmks.Close, 26, 12, 9); lseries[tf][sym] = lmks; rseries[tf][sym] = rmks; } }
public override void Calculate(int index) { DataSeries ds; int totalscore = 0; int[] values = new int[scores.Length]; for (int i = 0; i < timeframes.Length; i++) { ds = MarketData.GetSeries(timeframes[i]).Open; WMAsmall = Indicators.MovingAverage(ds, WMAsmallnum, MAType); WMAbig = Indicators.MovingAverage(ds, WMAbignum, MAType); if (WMAsmall.Result.LastValue > WMAbig.Result.LastValue) { totalscore += scores[i]; values[i] = scores[i]; } else { totalscore -= scores[i]; values[i] = -1 * scores[i]; } } //Result[index] = totalscore; drawLines(index, values); }
protected override void Initialize() { series1D = MarketData.GetSeries(TEMATimeframe); TemaFast = Indicators.GetIndicator <TEMA>(series1D.Close, PeriodFast); TemaSlow = Indicators.GetIndicator <TEMA>(series1D.Close, PeriodSlow); }
//****************************************** protected override void Initialize() { //************************************** LR_Slope = Indicators.LinearRegressionSlope(MarketSeries.Close, 12); MA20 = Indicators.ExponentialMovingAverage(MarketSeries.Close, 20); MA50 = Indicators.ExponentialMovingAverage(MarketSeries.Close, 50); MA100 = Indicators.ExponentialMovingAverage(MarketSeries.Close, 100); LTF_Candle = MarketData.GetSeries(LTF); MTF_Candle = MarketData.GetSeries(MTF); STF_Candle = MarketData.GetSeries(STF); //************************************** /////////////////////////////////////////////////////////// // Initialize and create nested indicators MA = Indicators.MovingAverage(MarketSeries.Close, MA_Periods, MovingAverageType.Exponential); // Initalize RSI RSI = Indicators.RelativeStrengthIndex(MarketSeries.Close, RSI_Periods); // Initalize CCI CCI = Indicators.CommodityChannelIndex(MarketSeries, CCI_Periods); thecount = MarketSeries.Close.Count; Print("theCount = " + thecount); }
protected override void Initialize() { // Summary YesterdayKeyLevels = Business.KeyLevels.GetYesterdaysKeyLevels(Account.BrokerName, Symbol.Code); if (YesterdayKeyLevels != null) { YesterdayKeyLevels.CalculateDaily(); // Write Summary string Summary = Symbol.Code.ToString() + ": Yesterday's (" + YesterdayKeyLevels.Date.ToShortDateString() + ") Open: " + YesterdayKeyLevels.Open.ToString() + ", Close: " + YesterdayKeyLevels.Close.ToString() + ", High: " + YesterdayKeyLevels.High.ToString() + ", Low: " + YesterdayKeyLevels.Low.ToString(); ChartObjects.DrawText("Previous", Summary, StaticPosition.BottomRight, Colors.Red); // Calculate ATR var ATRSeries = MarketData.GetSeries(TimeFrame.Daily); AverageTrueRange ATR = Indicators.AverageTrueRange(ATRSeries, 5, MovingAverageType.Simple); ChartObjects.DrawText("ATR", "ATR: " + ATR.Result.LastValue.ToString("0.##") + ", 15% ATR: " + (ATR.Result.LastValue * 0.15).ToString("0.##") + ",30% ATR: " + (ATR.Result.LastValue * 0.3).ToString("0.##") + "", StaticPosition.TopRight, Colors.Red); // DAILY // ChartObjects.DrawHorizontalLine("DailyHigh", YesterdayKeyLevels.High, Colors.Green, 1, LineStyle.LinesDots); // ChartObjects.DrawHorizontalLine("DailyLow", YesterdayKeyLevels.Low, Colors.Green, 1, LineStyle.LinesDots); // ChartObjects.DrawHorizontalLine("DailyCLose", YesterdayKeyLevels.Close, Colors.Green, 1, LineStyle.LinesDots); // Daily Levels P = ((YesterdayKeyLevels.High + YesterdayKeyLevels.Low + YesterdayKeyLevels.Close) / 3); R1 = ((2 * P) - YesterdayKeyLevels.Low); R2 = (P + YesterdayKeyLevels.High - YesterdayKeyLevels.Low); R3 = (YesterdayKeyLevels.High + 2 * (P - YesterdayKeyLevels.Low)); S1 = ((2 * P) - YesterdayKeyLevels.High); S2 = (P - YesterdayKeyLevels.High + YesterdayKeyLevels.Low); S3 = YesterdayKeyLevels.Low - 2 * (YesterdayKeyLevels.High - P); CBOL = ((YesterdayKeyLevels.High - YesterdayKeyLevels.Low) * 1.1 / 2 + YesterdayKeyLevels.Close); CBOS = YesterdayKeyLevels.Close - (YesterdayKeyLevels.High - YesterdayKeyLevels.Low) * 1.1 / 2; //WP = ((WeeklyHigh + WeeklyLow + WeeklyClose) / 3); //MP = ((MonthlyHigh + MonthlyLow + MonthlyClose) / 3); // WEEKLY // ChartObjects.DrawHorizontalLine("WeeklyHigh", WeeklyHigh, Colors.Green, 1, LineStyle.Lines); //ChartObjects.DrawHorizontalLine("WeeklyLow", WeeklyLow, Colors.Red, 1, LineStyle.Lines); // ChartObjects.DrawHorizontalLine("WeeklyClose", WeeklyClose, Colors.DeepSkyBlue, 1, LineStyle.LinesDots); // MONTHLY //ChartObjects.DrawHorizontalLine("MonthlyHigh", MonthlyHigh, Colors.Green, 3, LineStyle.Lines); //ChartObjects.DrawHorizontalLine("MonthlyLow", MonthlyLow, Colors.Red, 3, LineStyle.Lines); // ChartObjects.DrawHorizontalLine("MonthlyClose", MonthlyClose, Colors.DarkGray, 1, LineStyle.LinesDots); } }
protected override void Initialize() { _marketSerieGlobal = MarketData.GetSeries(GlobalTimeFrame2); int period = 2 * (int)(GlobalTimeFrame2.ToTimeSpan().Ticks / MarketSeries.TimeFrame.ToTimeSpan().Ticks); _localMA = Indicators.MovingAverage(LocalTrendSignal, period, MovingAverageType.Exponential); }
protected override void Initialize() { X_Series = CreateDataSeries(); Y_Series = CreateDataSeries(); X_Source = MarketData.GetSeries(X_Symbol, TimeFrame); Y_Source = MarketData.GetSeries(Y_Symbol, TimeFrame); }
protected override void Initialize() { m = MarketData.GetSeries(TimeFrame.Daily); lastHi = double.MinValue; lastLo = double.MaxValue; OnTimer(); Timer.Start(10); }
protected override void Initialize() { HmaHour4Series = MarketData.GetSeries(TimeFrame.Hour4); HmaHourSeries = MarketData.GetSeries(TimeFrame.Hour); ma4hr = Indicators.GetIndicator <HMAHTFSHIFT>(HmaHour4Series, HTF_Period, HTFShift, false, false, 3, false, 24); ma1hr = Indicators.GetIndicator <HMAHTFSHIFT>(HmaHourSeries, HTF_Period, HTFShift, false, false, 3, false, 24); }
protected override void Initialize() { _xbrsymbol = MarketData.GetSymbol("XBRUSD"); _xtisymbol = MarketData.GetSymbol("XTIUSD"); _xbrseries = MarketData.GetSeries(_xbrsymbol, TimeFrame); _xtiseries = MarketData.GetSeries(_xtisymbol, TimeFrame); _nocorel = Colors.Gray; }
public override void Calculate(int index) { DataSeries ds; double lowPrice = double.MaxValue; for (int i = 0; i < numBars; i++) { if (MarketSeries.Low.Last(i) < lowPrice) { lowPrice = MarketSeries.Low.Last(i); } } totalColor = Colors.White; int[,] values = new int[numBars, scores.Length + 1]; //MarketSeries currentSeries = MarketSeries. for (int bar = 0; bar < numBars; bar++) { for (int i = 0; i < timeframes.Length; i++) { ds = MarketData.GetSeries(timeframes[i]).Open; int convertedIndex = MarketData.GetSeries(timeframes[i]).OpenTime.GetIndexByTime(MarketData.GetSeries(this.TimeFrame).OpenTime[index - bar]); WMAsmall = Indicators.MovingAverage(ds, WMAsmallnum, MAType); WMAbig = Indicators.MovingAverage(ds, WMAbignum, MAType); if (WMAsmall.Result[convertedIndex] > WMAbig.Result[convertedIndex]) { values[bar, scores.Length] += scores[i]; values[bar, i] = scores[i]; totalColor = Colors.Green; } else { values[bar, scores.Length] -= scores[i]; values[bar, i] = -1 * scores[i]; totalColor = Colors.Red; } ChartObjects.DrawText("ScoreValue" + bar + "" + i, "■", index - bar, lowPrice - i * scale * Symbol.PipSize, VerticalAlignment.Bottom, HorizontalAlignment.Center, totalColor); if (bar == numBars - 1) { totalColor = getColor(values[0, i], false); ChartObjects.DrawText("Labels" + bar + "" + i, timeStrings[i], index + 1, lowPrice - i * scale * Symbol.PipSize, VerticalAlignment.Bottom, HorizontalAlignment.Center, totalColor); } if (i == timeframes.Length - 1) { totalColor = getColor(values[bar, scores.Length], true); ChartObjects.DrawText("FinalScoreValue" + bar + "" + i, "" + values[bar, scores.Length], index - bar, lowPrice - (i + 1) * scale * Symbol.PipSize, VerticalAlignment.Bottom, HorizontalAlignment.Center, totalColor); if (bar == numBars - 1) { totalColor = getColor(values[0, scores.Length], true); ChartObjects.DrawText("ScoreLabel" + bar + "" + i, "#", index + 1, lowPrice - (i + 1) * scale * Symbol.PipSize, VerticalAlignment.Bottom, HorizontalAlignment.Center, totalColor); } } } } }
protected override void OnBar() { MarketSeries data = MarketData.GetSeries(Symbol, TimeFrame.Minute15); DataSeries series = data.Close; int index = series.Count - 1; close = data.Close[index]; high = data.High[index]; low = data.Low[index]; open = data.Open[index]; // Int32 opentime = (Int32)(data.OpenTime[index].Subtract(new DateTime(1970, 1, 1))).TotalSeconds; var longPosition = Positions.Find(label, Symbol, TradeType.Buy); var shortPosition = Positions.Find(label, Symbol, TradeType.Sell); var currentSlowMa = slowMa.Result.Last(0); var currentFastMa = fastMa.Result.Last(0); var previousSlowMa = slowMa.Result.Last(1); var previousFastMa = fastMa.Result.Last(1); Symbol1 = MarketData.GetSymbol("EURUSD"); if (shortPosition == null && longPosition == null && previousFastMa < open && previousFastMa < close) { Print("BUY MA " + previousFastMa + " O " + open + " C " + close); Position position = Positions.Find(label, Symbol, TradeType.Sell); double vol = Quantity; if (position.NetProfit > 0) { vol = vol * 2; } long Volume = Symbol.QuantityToVolume(vol); ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, label, 222, 50); //ExecuteMarketOrder(TradeType.Sell, Symbol1, VolumeInUnitsBuy, label, 111, 50); } if (longPosition == null && shortPosition == null && previousFastMa > open && previousFastMa > close) { Print("SELL MA " + previousFastMa + " O " + open + " C " + close); Position position = Positions.Find(label, Symbol, TradeType.Buy); double vol = Quantity; if (position.NetProfit > 0) { vol = vol * 2; } long Volume = Symbol.QuantityToVolume(vol); ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, label, 222, 50); // ExecuteMarketOrder(TradeType.Buy, Symbol1, VolumeInUnitsBuy, label, 111, 50); } }
protected override void Initialize() { // Initialize and create nested indicators accDist = CreateDataSeries(); ema3 = Indicators.ExponentialMovingAverage(accDist, 3); ema10 = Indicators.ExponentialMovingAverage(accDist, 10); marketSeriesDaily = MarketData.GetSeries(TimeFrame.Daily); }
protected override void Initialize() { series5 = MarketData.GetSeries(TimeFrame.Minute5); series10 = MarketData.GetSeries(TimeFrame.Minute10); ma = Indicators.MovingAverage(MarketSeries.Close, Period, MovingAverageType.Triangular); ma5 = Indicators.MovingAverage(series5.Close, Period, MovingAverageType.Triangular); ma10 = Indicators.MovingAverage(series10.Close, Period, MovingAverageType.Triangular); }
protected override void OnStart() { state = new State(TFrame); lseries = new Dictionary <string, MarketSeries>(); rseries = new Dictionary <string, MarketSeries>(); lmm6 = new Dictionary <string, ExponentialMovingAverage>(); lmm18 = new Dictionary <string, ExponentialMovingAverage>(); lmm50 = new Dictionary <string, ExponentialMovingAverage>(); lmm100 = new Dictionary <string, ExponentialMovingAverage>(); rmm100 = new Dictionary <string, ExponentialMovingAverage>(); lmm200 = new Dictionary <string, SimpleMovingAverage>(); rmm200 = new Dictionary <string, SimpleMovingAverage>(); lmacd = new Dictionary <string, MacdCrossOver>(); rmacd = new Dictionary <string, MacdCrossOver>(); spaths = new Dictionary <string, string>(3); spaths.Add("MACD", "C:\\Users\\Andrey\\Music\\Sounds\\sms-alert-1.wav"); spaths.Add("ACC", "C:\\Users\\Andrey\\Music\\Sounds\\sms-alert-4.wav"); spaths.Add("VCN", "C:\\Users\\Andrey\\Music\\Sounds\\sms-alert-3.wav"); Print("Initializing screener local state."); foreach (var sym in symbols) { Print("Initializing data for: {0}/{1}.", sym, TFrame); var reftf = GetReferenceTimeframe(TFrame); var lmks = MarketData.GetSeries(sym, TFrame); var rmks = MarketData.GetSeries(sym, reftf); lmm6[sym] = Indicators.ExponentialMovingAverage(lmks.Close, 6); lmm18[sym] = Indicators.ExponentialMovingAverage(lmks.Close, 18); lmm50[sym] = Indicators.ExponentialMovingAverage(lmks.Close, 50); lmm100[sym] = Indicators.ExponentialMovingAverage(lmks.Close, 100); rmm100[sym] = Indicators.ExponentialMovingAverage(rmks.Close, 100); lmm200[sym] = Indicators.SimpleMovingAverage(lmks.Close, 200); rmm200[sym] = Indicators.SimpleMovingAverage(rmks.Close, 200); lmacd[sym] = Indicators.MacdCrossOver(lmks.Close, 26, 12, 9); rmacd[sym] = Indicators.MacdCrossOver(rmks.Close, 26, 12, 9); lseries[sym] = lmks; rseries[sym] = rmks; } Print("Initialization finished."); var output = state.Render(); ChartObjects.RemoveObject("screener"); ChartObjects.DrawText("screener", output, StaticPosition.TopLeft, Colors.Black); }
protected override void OnStart() { i_TrendMovingAverage = Indicators.SimpleMovingAverage(MarketSeries.Close, (int)_TrendSMA); i_Intermediate_SMA = Indicators.SimpleMovingAverage(MarketData.GetSeries(TimeFrame.Hour4).Close, (int)_DailyIntermediateTrend_SMA); i_RSI_StopLoss = Indicators.RelativeStrengthIndex(MarketSeries.Close, (int)_wRSI_StopLossMA); i_TriggerMovingAverage = Indicators.SimpleMovingAverage(MarketSeries.Close, (int)_SlowSMATrigger); i_Average_True_Range = Indicators.AverageTrueRange((int)_ATR_MA, MovingAverageType.Simple); i_RSI = Indicators.RelativeStrengthIndex(MarketSeries.Close, (int)_cRSI_MA); }
protected override void OnStart() { Positions.Closed += OnPositionsClosed; rsi = Indicators.RelativeStrengthIndex(MarketData.GetSeries(TimeFrame.Hour).Close, 14); sma = Indicators.SimpleMovingAverage(MarketData.GetSeries(TimeFrame.Minute5).Close, 800); currentVolume = InitialVolume; balance = Account.Balance; Timer.Start(1); }
protected override void Initialize() { Lng_Series = MarketData.GetSeries(MacD3_TF); Mid_Series = MarketData.GetSeries(MacD2_TF); // Initialize and create nested indicators MacD3 = Indicators.MacdHistogram(Lng_Series.Close, LngCycle, ShrtCycle, SigPeriod); MacD2 = Indicators.MacdHistogram(Mid_Series.Close, LngCycle, ShrtCycle, SigPeriod); MacD1 = Indicators.MacdHistogram(MarketSeries.Close, LngCycle, ShrtCycle, SigPeriod); }
protected override void Initialize() { _ratio = 80; _xausymbol = MarketData.GetSymbol("XAUUSD"); _xagsymbol = MarketData.GetSymbol("XAGUSD"); _xauseries = MarketData.GetSeries(_xausymbol, TimeFrame); _xagseries = MarketData.GetSeries(_xagsymbol, TimeFrame); _nocorel = Colors.Gray; }
protected override void OnStart() { currentVolume = InitialVolume; Positions.Closed += OnPositionsClosed; Timer.Start(60); var marketSeriesMin10 = MarketData.GetSeries(TimeFrame.Minute10); rsiMin10 = Indicators.RelativeStrengthIndex(marketSeriesMin10.Close, 14); rsi = Indicators.RelativeStrengthIndex(MarketSeries.Close, 14); }