NexusFi: Find Your Edge


Home Menu

 





Strange Indicator Behavior: Newbie Question/Help!


Discussion in NinjaTrader

Updated
    1. trending_up 1,366 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

Strange Indicator Behavior: Newbie Question/Help!

  #1 (permalink)
 EminiTCNinja 
Bothell, WA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES
Posts: 9 since Sep 2011
Thanks Given: 2
Thanks Received: 2

With the help of some prior works of art, I created an indicator which changes the background color for a bar when the volume of that bar is above a minimum threshold and it is also greater than a certain percentage of the prior bars volume.

The problem, I'm having is that the indicator seems to work fine when I'm using the "CME US Index Futures ETH" Session template... but when I'm using the "CME US Index Futures RTH" Session template, the indicator does not plot anything....

From my troubleshooting, it appears that as soon as I include the the reference to Volume[1] (which should be the prior bars volume, according to the NinjaTrader help manual) then the indicator will not plot on the RTH session template. If I remove this reference and just have the indicator plot if the CURRENT bars volume is higher than a threshold (disregarding the prior bars volume) then it works on BOTH the RTH and ETH session templates.

I find this very strange and I'm sure I'm just not doing something basic! Any help would be greatly appreciated.

Here is a screenshot of the code as well as showing the indicator working on the top right ETH session template chart and NOT working on the bottom right RTH session template chart:

2013-03-14_0549 - ToddPMan's library

Thanks so much!

-Todd

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Quant vue
Trading Reviews and Vendors
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


@ToddPMan:

You cannot reference the prior bar, when CurrentBar == 0. With the ETH session you were just lucky that the first bar usually is a low volume bar, such that lines 61 and 76 of your code were never executed.

All you need to do is to add the following lines of code in the beginning of OnBarUpdate():

 
Code
if(CurrentBar == 0)
    return;

Reply With Quote
Thanked by:




Last Updated on March 14, 2013


© 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