public void drawImage() { ImageCreator.Graph(coinPair, interval, tli.getFilteredTrendlines(), sma.getAverages(), vol.getVolumes(), resistanceAnalysation.GetResistances()); }
private void UpdateResistances(object obj) { resistances = GetResistances(); decimal divergence = Helper.GetDivergence(coinPair, interval); decimal price = DataManager.GetPrice(coinPair); resistances.Sort((l, r) => { return((Math.Abs(l.Value - price)) < (Math.Abs(r.Value - price)) ? -1 : 1); }); var resistance = resistances[0]; if (lastPrice > resistance.Value && price < (resistance.Value - divergence)) { lastPrice = price; List <Resistance> resistancesSorted = new List <Resistance>(resistances); resistancesSorted.Sort((l, r) => { return((Math.Abs(l.Value - price)) < (Math.Abs(r.Value - price)) ? -1 : 1); }); resistancesSorted.RemoveAll(x => x.Value == resistance.Value || x.Value > price); string breakoutAlert = "📉🐻\nNew Breakout SHORT: " + coinPair + "\n at " + Enum.GetName(typeof(KlineInterval), interval) + "\nBroke Resistance at " + resistance.Value + "\n"; if (resistancesSorted.Count > 0) { breakoutAlert += "Next Resistance at " + resistancesSorted[0].Value + "\n"; } breakoutAlert += "📉🐻"; //Trendline breakout IndicatorsManager manager = null; foreach (var ind in API.indicatorsManagers) { if (ind.Key.pair == coinPair && ind.Key.interval == interval) { manager = ind.Value; } } DataManager.ForceCandleUpdate(coinPair, interval); foreach (long group in API.config.telegram_groups) { API.telegramClient.SendPhotoAsync(group, new InputOnlineFile(new MemoryStream(ImageCreator.Graph(coinPair, interval, manager.tli.getFilteredTrendlines(), manager.sma.getAverages(), manager.vol.getVolumes(), resistances))), breakoutAlert); } } if (lastPrice < resistance.Value && price > (resistance.Value + divergence)) { lastPrice = price; List <Resistance> resistancesSorted = new List <Resistance>(resistances); resistancesSorted.Sort((l, r) => { return((Math.Abs(l.Value - price)) < (Math.Abs(r.Value - price)) ? -1 : 1); }); resistancesSorted.RemoveAll(x => x.Value == resistance.Value || x.Value < price); var breakoutAlert = "📈🌒🚀🚀🚀🌒\nNew Breakout LONG: " + coinPair + "\n at " + Enum.GetName(typeof(KlineInterval), interval) + "\nBroke Resistance at: " + resistance.Value + "\n"; if (resistancesSorted.Count > 0) { breakoutAlert += "Next Resistance at " + resistancesSorted[0].Value + "\n"; } breakoutAlert += "📈🌒🚀🚀🚀🌒"; IndicatorsManager manager = null; foreach (var ind in API.indicatorsManagers) { if (ind.Key.pair == coinPair && ind.Key.interval == interval) { manager = ind.Value; } } DataManager.ForceCandleUpdate(coinPair, interval); //Trendline breakout foreach (long group in API.config.telegram_groups) { API.telegramClient.SendPhotoAsync(group, new InputOnlineFile(new MemoryStream(ImageCreator.Graph(coinPair, interval, manager.tli.getValidTrendlines(), manager.sma.getAverages(), manager.vol.getVolumes(), resistances))), breakoutAlert); } } }