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

Print time of trade

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

    Print time of trade

    Sorry, I'm sure this is an obvious one but I haven't been able to find an answer by searching.

    I'd like to print to output window what time a trade occurs and also the price. In my strategy, I set a limit order X ticks removed from the RTH opening price. Sometimes the order will get filled, sometimes it won't. If it does get filled, I just want the time to be printed to the output window.

    I know it should be something like...
    if (EnterLong)
    { print(Time[0].ToString);}
    ....but I'm just not finding how to refer to the "EnterLong" event.

    Thanks.

    #2
    Hello Sniff,

    Are you wanting to print the time the order was submitted or the time the order was filled?

    To print the time of the execution print the execution object in OnExecution().


    protected override void OnExecution(IExecution execution)
    {
    Print(execution.Time.ToString());
    }

    You may also want to look into IOrder objects to assign an order object to and then get information from later.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi ChelseaB,

      Thanks, that looks like what I was looking for. Yeah, just wanted to print the time of order execution. Will give this a shot and read up on IOrder objects.

      Thanks.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bmartz, 03-12-2024, 06:12 AM
      5 responses
      32 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Started by Aviram Y, Today, 05:29 AM
      4 responses
      13 views
      0 likes
      Last Post Aviram Y  
      Started by algospoke, 04-17-2024, 06:40 PM
      3 responses
      28 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by gentlebenthebear, Today, 01:30 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by cls71, Today, 04:45 AM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X