Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
hi I have the code of an indicator that sends messages with screenshots from ninjatrader to telegram but for the moment it only sends the message when I add it to the chart and I want to combine the function so that it sends the code when a short or a long or when I close an order but I don't know anything about codes and I want help to give that order to the code this is the code
#region Using declarations
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Gui;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.SuperDom;
using NinjaTrader.Gui.Tools;
using NinjaTrader.Data;
using NinjaTrader.NinjaScript;
using NinjaTrader.Core.FloatingPoint;
using NinjaTrader.NinjaScript.DrawingTools;
using System.Windows.Media.Imaging;
using System.IO;
using Telegram.Bot;
#endregion
//This namespace holds Indicators in this folder and is required. Do not change it.
namespace NinjaTrader.NinjaScript.Indicators.Utilities
{
public class Zi8ScreenSnapShot : Indicator
{
// Token del bot que he creado desde 'BothFather' en Telegram:
private const string API_TOKEN = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
// Nombre del canal de Telegram donde se enviarán los mensajes (el bot tiene que
// estar autorizado como administrador en el canal):
private const string CHAT_ID = "@xxxxxxxxx";
// Variable para referenciar el Bot en Telegram:
private TelegramBotClient Bot;
// Variable para referenciar al Chart y poder capturar la pantalla:
private Chart ch;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "Zi8ScreenSnapShot";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
//Disable this property if your indicator requires custom values that cumulate with each new market data event.
//See Help Guide for additional information.
IsSuspendedWhileInactive = true;
}
else if (State == State.DataLoaded)
{
Bot = new TelegramBotClient(API_TOKEN);
}
else if (State == State.Historical)
{
if (ChartControl != null)
{
Dispatcher.BeginInvoke(new Action(() =>
{
ch = Window.GetWindow(ChartControl) as Chart;
}));
}
the 2 DLL's, must be copied to the \ Documents \ NinjaTrader 8 \ bin \ Custom directory.
After we start NinjaTrader, we open the NinjaScript Editor, right click to open the context menu, click on References…, click on add and add the 2 previous DLL's.
create a new indicator with the data from the notebook
hi!, thanks for this, any news? I tried to get it work but no messages arrived on the group
-create the bot with BotFather
-start the bot with /start
-add the bot to the group and set as administrator
Hi,
you can use the following function to send a message "msg" string to a Telegram bot:
public void SendMessage(string msg, string bottoken, string chatid)
{
No, I have not. I just modified a bit the code shared by @nothingbutprofits.
For your information, there is an indicator seller that has implemented Discord and Telegram as shared services. I don't know them and can't give an opinion about their products.