NexusFi: Find Your Edge


Home Menu

 





Add(Instrument.FullName,PeriodType.... ReversalBarsType


Discussion in NinjaTrader

Updated
    1. trending_up 5,283 views
    2. thumb_up 8 thanks given
    3. group 2 followers
    1. forum 19 posts
    2. attach_file 0 attachments




 
Search this Thread

Add(Instrument.FullName,PeriodType.... ReversalBarsType

  #11 (permalink)
 
pcomm69's Avatar
 pcomm69 
paris france
 
Experience: Advanced
Platform: NinjaTrader
Broker: Continuum
Trading: gold & crude light
Posts: 55 since Oct 2011
Thanks Given: 14
Thanks Received: 4

oups sorry for the mistake
THE LOG SAY : ERROR ON CALLING OnBarUpDate on bar 0. Bar Index Needs to be grather or egal to 0

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
Futures True Range Report
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #12 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623


pcomm69 View Post
oups sorry for the mistake
THE LOG SAY : ERROR ON CALLING OnBarUpDate on bar 0. Bar Index Needs to be grather or egal to 0

OK, please try the minimum version with just adding the bar and Print method (no DrawText...) just as in my post - trying to identify where the error is.

Reply With Quote
Thanked by:
  #13 (permalink)
 
pcomm69's Avatar
 pcomm69 
paris france
 
Experience: Advanced
Platform: NinjaTrader
Broker: Continuum
Trading: gold & crude light
Posts: 55 since Oct 2011
Thanks Given: 14
Thanks Received: 4


I am reback excuse me
nothing in log
but "inside secondary bars" in the output windows
first step is good

protected override void Initialize()
{

Add(PeriodType.Custom4, 10);// [1]
CalculateOnBarClose = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
{
Print("inside secondary bars");
}
}

Started this thread Reply With Quote
  #14 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623


pcomm69 View Post
I am reback excuse me
nothing in log
but "inside secondary bars" in the output windows
first step is good

Now we know that the secondary bars have been successfully added and the error was in your DrawText.

If you are inside BarsInProgress == 1 you can use Open[X] and this will use the right Bars, so your DrawText can be:
 
Code
DrawTextFixed("tag1", Open[1].ToString(), TextPosition.TopRight);

Reply With Quote
Thanked by:
  #15 (permalink)
 
pcomm69's Avatar
 pcomm69 
paris france
 
Experience: Advanced
Platform: NinjaTrader
Broker: Continuum
Trading: gold & crude light
Posts: 55 since Oct 2011
Thanks Given: 14
Thanks Received: 4

if i try this
protected override void Initialize()
{
Add(PeriodType.Custom4, 20);// [1]
CalculateOnBarClose = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if ((BarsInProgress == 1) && (CurrentBar > 1))
{
Print((Opens[1][3]));
}
}

the answer in output windows is :
Error on calling 'OnBarUpdate' method for indicator 'BackGroundRBT' on bar 2: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.


for me the probleme is on the history of bar for Series 1 in Custom 4

Started this thread Reply With Quote
  #16 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623


pcomm69 View Post
the answer in output windows is :
Error on calling 'OnBarUpdate' method for indicator 'BackGroundRBT' on bar 2: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.


for me the probleme is on the history of bar for Series 1 in Custom 4

The problem is you don't have enough bars available - you are requesting data from 4 bars ago (3) while on bar 0, 1, 2. This won't work so you need to make sure that:
 
Code
if (CurrentBars[1] < X) return;
where x is the minimum bars you will require for calculation in the above case X will be 4.

Reply With Quote
Thanked by:
  #17 (permalink)
 
pcomm69's Avatar
 pcomm69 
paris france
 
Experience: Advanced
Platform: NinjaTrader
Broker: Continuum
Trading: gold & crude light
Posts: 55 since Oct 2011
Thanks Given: 14
Thanks Received: 4

I am so so sorry

I dont know if CurrentBars[1] >30
witch work

I have used
if ((BarsInProgress == 1) && (CurrentBar > 30)) {do something}
withch dont work

what is the difference ?

Thanks

Started this thread Reply With Quote
  #18 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623


pcomm69 View Post
I am so so sorry

I dont know if CurrentBars[1] >30
witch work

I have used
if ((BarsInProgress == 1) && (CurrentBar > 30)) {do something}
withch dont work

what is the difference ?

Thanks

Hard to say, theoretically both should work, but just in case when using multiple bars series always use CurrentBars[x]

Reply With Quote
Thanked by:
  #19 (permalink)
 
pcomm69's Avatar
 pcomm69 
paris france
 
Experience: Advanced
Platform: NinjaTrader
Broker: Continuum
Trading: gold & crude light
Posts: 55 since Oct 2011
Thanks Given: 14
Thanks Received: 4

I note it
Thank you so much for your help

Started this thread Reply With Quote
  #20 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623



pcomm69 View Post
I note it
Thank you so much for your help

You're welcome

Reply With Quote




Last Updated on April 28, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts