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() - duplicates

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

    Print() - duplicates

    Hi,

    I'm trying to print some values for my strategy.

    Data Series type: Volume.

    I have added this piece below in my strategy;

    Code:
    protected override void OnBarUpdate()
    {
    Print(Time[1].ToString()+" The high of the bar is : " + High[1]);
    }
    But this is the output I'm getting, so many duplicates; any idea why?

    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:58:45 The high of the bar is : 1.23325
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335
    02/03/2018 21:59:07 The high of the bar is : 1.2335

    Thanks
    MT

    #2
    OnBarUpdate is called for every tick.

    You can change that:

    Comment


      #3
      Hi mntemel,

      sledge is likely correct.

      What is the Calculate setting set to in the instance parameters of the running script?
      (Not just in the code)

      If you would like to have Calculate set to On each tick, or On price change and receive only one print per bar, you can require that IsFirstTickOfBar be true.

      Below is a publicly available link to the help guide.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by FrazMann, Today, 11:21 AM
      0 responses
      3 views
      0 likes
      Last Post FrazMann  
      Started by geddyisodin, Yesterday, 05:20 AM
      8 responses
      52 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      10 responses
      36 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by DayTradingDEMON, Today, 09:28 AM
      4 responses
      24 views
      0 likes
      Last Post DayTradingDEMON  
      Started by George21, Today, 10:07 AM
      1 response
      19 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Working...
      X