Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Notification via Messenger

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Notification via Messenger

    Hello,

    I'm trying to build a messenger notification for all my strategies. The goal is that I get a notification, when a strategy executes an trade.

    For the first step, I tried to write this programm as own strategy, which receive following events :

    Code:
    		protected override void OnAccountItemUpdate(Cbi.Account account, Cbi.AccountItem accountItem, double value)
    		{
    			SendMessage("OnAccountItemUpdate");
    		}
    
    		protected override void OnConnectionStatusUpdate(ConnectionStatusEventArgs connectionStatusUpdate)
    		{
    			SendMessage("OnConnectionStatusUpdate");
    		}
    
    		protected override void OnExecutionUpdate(Cbi.Execution execution, string executionId, double price, int quantity, 
    			Cbi.MarketPosition marketPosition, string orderId, DateTime time)
    		{
    			SendMessage("OnExecutionUpdate");
    			SendMessage("Executed " + ((marketPosition == Cbi.MarketPosition.Short) ? "Short" : "Long") + " price : " + price + " Anzahl : " + quantity);
    			SendMessage("ExecutionStringMethod : " + execution.ToString());
    		}
    
    		protected override void OnOrderUpdate(Cbi.Order order, double limitPrice, double stopPrice, 
    			int quantity, int filled, double averageFillPrice, 
    			Cbi.OrderState orderState, DateTime time, Cbi.ErrorCode error, string comment)
    		{
    			SendMessage("OnOrderUpdate");
    		}
    
    		protected override void OnPositionUpdate(Cbi.Position position, double averagePrice, 
    			int quantity, Cbi.MarketPosition marketPosition)
    		{
    			SendMessage("OnPositionUpdate");
    		}
    The sendMessage function can send the string via Telegram ( This is working)

    My focus is the "OnExecutionUpdate" Event, but this event isn't triggerd when my strategy executes an order. I only receive the "OnAccountItemUpdate" Event.

    Because that I have three questions:

    1. What is the correct Event for notification for a new Order on the markt ?
    2. The best way for implementation is the addon or ? This feature shouldn't be a strategy ?
    2.1 Is it possible to enable/disable addons and check which addons are running?

    Thank your for your help

    #2
    Hello,

    Thank you for the post.

    If you were using a single strategy, that would only be good for that specific strategies performance. if you want to observe the account you should instead use an addon as that is the purpose of an addon.
    There is an example of an addon that observes the execution override here:


    Regarding enable/disable addons, you would need to implement this yourself. An addon will start upon the platform starting, and also after a recompile. Any other special logic that you want it to do you would need to develop. You could use a Static property that your addon watchs as one example, you could also create a UI for the addon or any other form of control you need. We have a sample showing how to create a window here: https://ninjatrader.com/support/help...t_overview.htm

    Please let me know if I may be of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by helpwanted, Today, 03:06 AM
    1 response
    14 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    11 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    6 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    244 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    387 views
    1 like
    Last Post Gavini
    by Gavini
     
    Working...
    X