Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Print Command

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

    Print Command

    Hello,

    I have this script:

    Print(string.Format("Position: {0} | Precio > Prior: {1} | Precio > PP: {2}", Position.AvgPrice, Close[1]>PriorDayOHLC().PriorClose[0], Close[1]>Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0, 0, 0, 20).PP[0]));

    and whrn I go to the output windows, appears docens of tines with the same data:
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True
    Position: 0,7189 | Precio > Prior: True | Precio > PP: True

    How can I say to only appear one line?

    Thanks in advance.

    #2
    Hello josefo,

    Thanks for your post.

    You can control the printing to just once by using a bool. For example a bool named doitonce initialized to true:

    if (doitonce)
    {
    Print(string.Format("Position: {0} | Precio > Prior: {1} | Precio > PP: {2}", Position.AvgPrice, Close[1]>PriorDayOHLC().PriorClose[0], Close[1]>Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0, 0, 0, 20).PP[0]));

    doitonce = false; // set to false so we only print once.
    }

    Comment


      #3
      OK Thank you,

      And what is the sentence to print only the trades with a positive result? I mean with a PnL>0?

      Thanks in advance.

      Comment


        #4
        Hello josefo,

        Thanks for your reply.

        For all information regarding trades performance you will want to review TradeCollection here: http://ninjatrader.com/support/helpG...collection.htm

        For winning trades, under trade collection is: http://ninjatrader.com/support/helpG...ningtrades.htm

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sjsj2732, Yesterday, 04:31 AM
        0 responses
        35 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        286 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        286 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        133 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        91 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X