NexusFi: Find Your Edge


Home Menu

 





OnBarUpdate not called for indicator within Stragety


Discussion in NinjaTrader

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




 
Search this Thread

OnBarUpdate not called for indicator within Stragety

  #1 (permalink)
 corbeste 
Valencia/Spain
 
Experience: Intermediate
Platform: Investor/RT
Trading: FGBL, ES
Posts: 8 since Jun 2012
Thanks Given: 7
Thanks Received: 13

Hi,

I am playing with the priceactionswing indicator, and am running into a big problem - within my strategy, the PAS OnBarUpdate method is never called! I cant find anything relating to specific instructions on how to include an indicator within a strategy, so I simply created the indicator within the Initialise function of my strategy.

However the PAS OnBarUpdate is never called (verified with a print statement) and the structures within the object are never populated. Init and OnStartUp are called.

Is there an obvious step I am missing to link the embedded indicator to the data series of the strategy? I am an experienced programmer but very new to the NT universe, so I am not clear on how the OnBarUpdate event works and how to allow the indicator to subscribe to this event.

 
Code
 protected override void Initialize()
        {
            CalculateOnBarClose = true;
	    pas = PriceActionSwing(Input, _dtbStrength, _swingSize, SwingTypes.Standard);

        }
		
		protected override void OnStartUp()
		{
			
		}

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
			Print (++_cnt);
                        // reference pas object contents

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Diary of a simple price action trader
26 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
23 thanks
My NQ Trading Journal
16 thanks
HumbleTraders next chapter
9 thanks
  #3 (permalink)
kandlekid
College Point, NY (Queens)
 
Posts: 63 since Nov 2009
Thanks Given: 5
Thanks Received: 20



corbeste View Post
Hi,

I am playing with the priceactionswing indicator, and am running into a big problem - within my strategy, the PAS OnBarUpdate method is never called! I cant find anything relating to specific instructions on how to include an indicator within a strategy, so I simply created the indicator within the Initialise function of my strategy.

However the PAS OnBarUpdate is never called (verified with a print statement) and the structures within the object are never populated. Init and OnStartUp are called.

Is there an obvious step I am missing to link the embedded indicator to the data series of the strategy? I am an experienced programmer but very new to the NT universe, so I am not clear on how the OnBarUpdate event works and how to allow the indicator to subscribe to this event.

 
Code
 protected override void Initialize()
        {
            CalculateOnBarClose = true;
	    pas = PriceActionSwing(Input, _dtbStrength, _swingSize, SwingTypes.Standard);

        }
		
		protected override void OnStartUp()
		{
			
		}

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
			Print (++_cnt);
                        // reference pas object contents


I think your problem is that Initalize is only called once. You probably want to add the indicator to your plot using the Add method from Initialize then set pas from OnBarUpdate.

protected override void Initialize()
{
Add(PriceActionSwing( ...) );

}

protected override void OnBarUpdate()
{
pas = PriceActionSwing( ... );

...
}

Note: make sure that the arguments for the PriceActionSwing calls are precisely the same in both cases.

Reply With Quote




Last Updated on August 13, 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