Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SystemPerformance.AllTrades.GetTrades doesn't work on Sim101

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

    SystemPerformance.AllTrades.GetTrades doesn't work on Sim101

    Hi,
    i can't access to trade generate from my strategy:

    TradeCollection Trades = SystemPerformance.AllTrades.GetTrades(Instrument.F ullName, Name, 1);

    I call this function from OnBarUpdate()

    Even if i have a lot of trade as you can see in attached photo the function return always 0 as count of trades:

    Click image for larger version  Name:	immagine.png Views:	0 Size:	70.7 KB ID:	1230362

    This is a complete code:

    Click image for larger version

Name:	immagine.png
Views:	113
Size:	56.9 KB
ID:	1230367



    Could you help me?

    Thanks
    Last edited by termi_80; 01-09-2023, 07:20 AM.

    #2
    Hello termi_80,

    Thank you for your note.

    The AllTrades collection is an object that holds a collection of all trades generated by a strategy; based on your screenshots, it look like you are trying to work with the SystemPerformance.AllTrades collection in a strategy called CustomTradeCollectionTest and in the Orders tab the only orders generated by a strategy were from the Andrea15304_EURUSD strategy.

    We have a reference sample that shows a way to use trade performance statistics in a strategy here:


    It uses SystemPerformance.AllTrades.TradesPerformance.Curr ency.CumProfit to calculate the profits and losses of the strategy, and it will prevent additional trades if the profit exceeds $1000 or if the loss goes over $400. This is just an example, but the SystemPerformance information used only has access to the trades generated by the strategy itself and not other trades placed either manually in the platform or submitted by other strategies.

    I hope this helps to clarify. Please let us know if we may be of further assistance.

    Comment


      #3
      Hi Emily

      In the code attached before i try to create a new strategy only for get all trades.

      this is the part of my code with Andrea15304

      Click image for larger version

Name:	immagine.png
Views:	94
Size:	101.7 KB
ID:	1230395

      As a SignalName i use name + _ instrument

      This part of Buy Order

      Click image for larger version

Name:	immagine.png
Views:	91
Size:	29.0 KB
ID:	1230396

      And in the end function where i got result of last trades of this strategy

      Click image for larger version

Name:	immagine.png
Views:	99
Size:	24.1 KB
ID:	1230397

      Could you show me where i wrong?

      Tnaks

      Comment


        #4
        Hello termi_80,

        Thank you for your reply.

        I recommend adding Print() statements to debug your script. This will allow you to see if the variables used are being saved properly and you could also add a print to different sections of your script to see if the code is being reached or not. For more information about using prints to debug, please see the following link:


        Additionally, I see we have an email case opened for this same inquiry. If you prefer to work via email, please let me know and we can continue there. Otherwise, we can continue to communicate via this forum thread. The forum is sometimes preferred because the answers and information can also help other users working with NinjaScript.

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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        71 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        143 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        76 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        47 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        51 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X