Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Bar Type Issue

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

    Custom Bar Type Issue

    Hi,

    I was converted NT 7 UniRenko BarType(downloaded from NT 7 forum. http://ninjatrader.com/support/forum...d=4&linkid=560 )
    to NT 8 Bar Type and the converted source code is attached here.
    I renamed(save as) the SampleMACrossOver strategy to TEST1 and added two Print Statement inside OnBarUpdate method and its source code is attached here.

    Also attached the bartype and Staretgy settings screen shot.

    My Problem is below,
    I Open a UniRenko Chart and run TEST1 Strategy on Intrabar (set Calculate = On Each tick , Connection = Simulated mode).

    So on each tick, Instead of Printing current bar number the print statement will print from 0th Bar number to current Bar.
    May i Know Why this?.
    In NT 7 it will Print only the Current Bar Number for this case.

    Print statement from Strategy is below

    Print("FIRST LINE BAR NUMBER ="+CurrentBar.ToString()+ " CLOSE ="+Close[0]+" PC Time ="+DateTime.Now.ToString());


    But when I set Calculate = "On Bar Close" from strategy setting screen , then it will show only current bar number .

    May i Know Is this issue from my strategy or my Custom Bar Type ? I attached both here.
    Kindly Please verify this and give me a solution about this.
    Attached Files

    #2
    Hello rmk,

    Thank you for your post.

    You are printing on each bar update, and each call to OnBarUpdate() is made on each tick. So you are going to see a lot of prints for this.

    The Print would occur on every bar, so it would print every bar number.

    If you set to calculate on the close of the bar and only one print occurs, I would ask if you have historical data on the chart and who do you connect to for data?

    Comment


      #3
      Custom Bar Type issue

      Hello,

      I Thought you are not fully understand my issues.I attached two screenshot here.

      First screen shot(Range.png) .

      I ran my TEST1 Strategy (set calculate= On each Tick) on Range Bar Type.On the output window you can see that, on each tick it will print only one line.( this print statement is from TEST1 strategy)

      FIRST LINE BAR NUMBER=5 CLOSE = ......etc...Time =...etc...
      (because here the current bar number=5)

      on next tick again showing one Print statement.

      FIRST LINE BAR NUMBER=5 CLOSE = ......etc...Time =...etc...

      here it will not print from 0th bar number onwards (Because the Range bar type and strategy is working correctly here)

      See the second Screen Shot (UniRenko) : Custom Bar Type
      Here i insert the same TEST1 Strategy (set calculate = on each Tick).On the screen shot you can see , the current bar number is 5.

      but on each tick of this 5th bar, the print statement from the strategy will print from 0th bar to 5th bar.
      like below
      FIRST LINE BAR NUMBER=0 CLOSE = etc....
      FIRST LINE BAR NUMBER=1 CLOSE = etc....
      FIRST LINE BAR NUMBER=2 CLOSE = etc....
      FIRST LINE BAR NUMBER=3 CLOSE = etc....
      FIRST LINE BAR NUMBER=4 CLOSE = etc....
      FIRST LINE BAR NUMBER=5 CLOSE = etc...

      on next tick of 5th bar the same print will repeat.

      This is wrong . The correct thing is Print only one line like Range bar type

      FIRST LINE BAR NUMBER=5 CLOSE =.. etc....

      Kindly please download my TEST1 strategy and UniRenko bar type from earlier post.
      and Test it following way.
      1. Open one Chart and select UniRenko as Bar Type
      2. Then Insert TEST1 Strategy and Set Calculate= on each Tick
      3. Open Out Put window and verify the Print Statement from the each tick

      The same way like Open one Range Chart and Insert the same Strategy TEST1 (set Calculate = on each Tick).
      Then see the Print statement from out put window. Now you can see the difference between two run.

      May i know what is wrong in my Custom Bar type?.Is this issue from my custom Bar Type creation.
      Because this UniRenko is working fine in NT 7. May i know where i need to correct this in my code...?
      May i know why the Print Statement will print from 0th bar onwards on a single tick..?

      Could you Please help me..
      Attached Files
      Last edited by rmk; 07-20-2015, 05:55 AM.

      Comment


        #4
        Hello rmk,

        I see no logic in place in the custom bar type to close the bar and it appears that each bar continues to call OnBarUpdate() without being closed.

        Please take a look at the RenkoBarsType lines 55 to 75 and let me know if you have any questions.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Christopher_R, Today, 12:29 AM
        0 responses
        9 views
        0 likes
        Last Post Christopher_R  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        166 responses
        2,235 views
        0 likes
        Last Post sidlercom80  
        Started by thread, Yesterday, 11:58 PM
        0 responses
        3 views
        0 likes
        Last Post thread
        by thread
         
        Started by jclose, Yesterday, 09:37 PM
        0 responses
        8 views
        0 likes
        Last Post jclose
        by jclose
         
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        10 responses
        1,415 views
        0 likes
        Last Post Traderontheroad  
        Working...
        X