Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

use the entry time object trade strategy SystemPerformance

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

    use the entry time object trade strategy SystemPerformance

    I have this

    if (
    SystemPerformance.AllTrades.Count > 0
    )
    {

    Trade oneTradeAgoData = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1];​


    oneTradeAgoPnL = ( oneTradeAgoData.EntryTime <= ToTime(HourFrom) || oneTradeAgoData.EntryTime >= ToTime(HourTo) ) ?
    0.0 : oneTradeAgoData.ProfitCurrency ;​
    }


    EntryTime thows this error

    NinjaScript File Error Code Line Column
    _TradesCounterCleaned.cs 'NinjaTrader.Cbi.Trade' does not contain a definition for 'EntryTime' and no extension method 'EntryTime' accepting a first argument of type 'NinjaTrader.Cbi.Trade' could be found (are you missing a using directive or an assembly reference?) CS1061 158 50
    Here I printed the Entry Time in a prior script:



    What is the simplest way to check for the Entry Time of trades for later use with SystemPerformance​?





    Last edited by PaulMohn; 09-13-2024, 09:59 AM.

    #2
    Hello PaulMohn,

    The print that you had seen in the other post is a formatted string that shows the values of the object and its sub properties, in code you need to use the execution to get the time.


    oneTradeAgoData.Entry.Time

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello PaulMohn,

      The print that you had seen in the other post is a formatted string that shows the values of the object and its sub properties, in code you need to use the execution to get the time.


      oneTradeAgoData.Entry.Time
      Thanks that worked:

      oneTradeAgoPnL = ( (oneTradeAgoData.Entry.Time <= HourFrom ) || ( oneTradeAgoData.Entry.Time >= HourTo ) ) ?
      0.0 : oneTradeAgoData.ProfitCurrency ;​

      Print(" ");
      Print("oneTradeAgoData.Entry.Time: " + oneTradeAgoData.Entry.Time);
      Print("ToTime(HourFrom): " + ToTime(HourFrom));
      Print("ToTime(HourFrom): " + HourFrom);​



      oneTradeAgoData.Entry.Time: 12/09/2024 18:00:00
      ToTime(HourFrom): 130000
      HourFrom: 13/09/2024 13:00:00​

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      45 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      31 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X