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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        161 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        311 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        245 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        350 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X