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 geddyisodin, Today, 05:20 AM
        0 responses
        3 views
        0 likes
        Last Post geddyisodin  
        Started by JonesJoker, 04-22-2024, 12:23 PM
        6 responses
        32 views
        0 likes
        Last Post JonesJoker  
        Started by GussJ, 03-04-2020, 03:11 PM
        12 responses
        3,239 views
        0 likes
        Last Post Leafcutter  
        Started by AveryFlynn, Today, 04:57 AM
        0 responses
        6 views
        0 likes
        Last Post AveryFlynn  
        Started by RubenCazorla, 08-30-2022, 06:36 AM
        3 responses
        79 views
        0 likes
        Last Post PaulMohn  
        Working...
        X