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 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.
    }
    Paul H.NinjaTrader Customer Service

    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
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by fitspressoburnfat, Today, 04:25 AM
        0 responses
        2 views
        0 likes
        Last Post fitspressoburnfat  
        Started by Skifree, Today, 03:41 AM
        1 response
        4 views
        0 likes
        Last Post Skifree
        by Skifree
         
        Started by usazencort, Today, 01:16 AM
        0 responses
        1 view
        0 likes
        Last Post usazencort  
        Started by kaywai, 09-01-2023, 08:44 PM
        5 responses
        603 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        6 responses
        23 views
        0 likes
        Last Post xiinteractive  
        Working...
        X