Merhabalar,
Dilerseniz aşağıdaki yapıyı inceleyebilirsiniz.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Matriks.Data.Symbol;
using Matriks.Engines;
using Matriks.Lean.Algotrader.AlgoBase;
using Matriks.Lean.Algotrader.Models;
using Matriks.Indicators;
using System.Net;
namespace Matriks.Lean.Algotrader
{
public class TelegramBot
{
static readonly string token = ;
static readonly string chatId = ;
public static string SendMessage(string message)
{
string retval = string.Empty;
string url = $"https://api.telegram.org/bot{token}/sendMessage?chat_id={chatId}&text={message}";
using (var webClient = new WebClient())
{
retval = webClient.DownloadString(url);
}
return retval;
}
}
//===================================================================ACIKLAMA=======================================================================//
//Kivanc Ozbilgic'in duseni kiranlar explorer stratejisinin IQ versiyonudur. Fiyatin trend'i yukari kirmis olmasi, trend cizgisinin baslangic ve //
//bitis noktasi arasindaki bar sayisinin MinTrendLength'den buyuk ya da esit olmasi ve trend cizgisinin baslangic noktasindan itibaren son bara kadar//
//olan bar sayisinin MinTrendStartDistance degerine esit ya da fazla olmasi kosulu aranir. Bu kosullari gerceklestiren semboller ekrana basilacaktir//
//===================================================================DESCRIPTION=======================================================================//
//IQ version of Kivanc Ozbilgic's "Duseni kiranlar" explorer(scanner) strategy. The scanner seeks to find symbols that have broken above a falling //
//auto trendline. If the following 3 conditions are satisfied the explorer will return the symbols in the scanned list: price is above trendline, //
//the trendline has a minimum bar distance of MinTrendLength and MinTrendStartDistance amount of bars have passed since the starting point of the //
//trendline until current bar.
public class fibonacci10 : Explorer
{
[Parameter(1)]
public decimal Alphatrend_iqCoeff1;
[Parameter(14)]
public int Alphatrend_iqPeriod1;
[Parameter(Momentum.MFI)]
public Momentum Alphatrend_iqMomentum1;
MatriksIndicator AlphaTrend_IQ;
public static string str;
public override void OnInit()
{
AddColumns(2);
SetColumnText(0, "Trend");
SetColumnText(1, "Kapanis");
AlphaTrend_IQ = new AlphaTrend_IQ();
AlphaTrend_IQ.SetIndicatorParameters("Coeff", Alphatrend_iqCoeff1);
AlphaTrend_IQ.SetIndicatorParameters("Period", Alphatrend_iqPeriod1);
AlphaTrend_IQ.SetIndicatorParameters("Momentum", Alphatrend_iqMomentum1); RegisterUserIndicator(AlphaTrend_IQ, Symbol, SymbolPeriod, OHLCType.Close, 5);
}
bool result = true;
public override bool OnExplorer(List<BarDataEventArgs> bardatas)
{
var lastBarData = bardatas.Last();
var close = lastBarData.BarData.Close;
var zaman = DateTime.Now;
var result = CrossAbove(AlphaTrend_IQ, AlphaTrend_IQ, 0, 1);
if (result)
{
TelegramBot.SendMessage(" Alpha : $" + Symbol + Environment.NewLine + Environment.NewLine + "__Periyot: " + SymbolPeriod + "__" + Environment.NewLine + Environment.NewLine
+ Environment.NewLine + "Anlık Fiyat : " + close + "__" + Environment.NewLine + Environment.NewLine + Environment.NewLine + "Saat : " + zaman);
}
return result;
}
}
}
İyi çalışmalar.