indicator update and template not saving - futures io
futures io futures trading



indicator update and template not saving


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one 35trader with 12 posts (1 thanks)
    2. looks_two Fat Tails with 10 posts (2 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Big Mike with 1 posts (0 thanks)
    1. trending_up 4,126 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 23 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

indicator update and template not saving

(login for full post details)
  #1 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received

1. I want to update a EOD indicator right after the end of session vs on nextbar (session open) anyone have a script for this to happen or ideas?

2. Second issue, the following error: Indicator could not be serialized. (when saving as template)
The indicator recently had a live trend line added to it that updated per bar, since then the indicator cannot be saved as a template if the line is plotted on the chart, if its not plotted then I can save as a template.
Any ideas?

thanks

Reply With Quote

Journal Challenge February 2021 results:
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(173 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(120 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(35 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #3 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received



35trader View Post
1. I want to update a EOD indicator right after the end of session vs on nextbar (session open) anyone have a script for this to happen or ideas?

2. Second issue, the following error: Indicator could not be serialized. (when saving as template)
The indicator recently had a live trend line added to it that updated per bar, since then the indicator cannot be saved as a template if the line is plotted on the chart, if its not plotted then I can save as a template.
Any ideas?

thanks

1. You need to set your indicator to CalculateOnBarClose = false, otherwise it will only update with the first tick of the new session.

2. First close the offending chart. Shutdown and restart NinjaTrader. Now add the indicator to a virgin chart (only this indicator and nothing else !) and try to save it as a template. If the problem persists, your indicator has coding errors.

3. In case that there are coding errors, please post the indicator here and I will have a look which lines of the code create the problem.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received


Fat Tails View Post
1. You need to set your indicator to CalculateOnBarClose = false, otherwise it will only update with the first tick of the new session.

2. First close the offending chart. Shutdown and restart NinjaTrader. Now add the indicator to a virgin chart (only this indicator and nothing else !) and try to save it as a template. If the problem persists, your indicator has coding errors.

3. In case that there are coding errors, please post the indicator here and I will have a look which lines of the code create the problem.

-----
1. I tried this and did not update when changed to false. Its currently programmed to update per bar, from what I can see I need it programmed to have Bars.Session.GetNextBeginEnd, but this is out of my league LOL, so will need to find a programmer to help me.

2. I fluked out and fixed this myself, a class needed switched from public to private.

Thanks for your response.

Reply With Quote
 
(login for full post details)
  #5 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received


35trader View Post
-----
1. I tried this and did not update when changed to false. Its currently programmed to update per bar, from what I can see I need it programmed to have Bars.Session.GetNextBeginEnd, but this is out of my league LOL, so will need to find a programmer to help me.

2. I fluked out and fixed this myself, a class needed switched from public to private.

Thanks for your response.

Don't hesitate to post the code if you need any help.

Reply With Quote
 
(login for full post details)
  #6 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received


Fat Tails View Post
Don't hesitate to post the code if you need any help.

Fat Tails,

Here is basic EMA code, can you alter it to do the following:
1. Continue to update on each bar
2. Update at session end

many thanks

/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(new Plot(Color.Orange, "EMA"));

Overlay = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
Value.Set(CurrentBar == 0 ? Input[0] : Input[0] * (2.0 / (1 + Period)) + (1 - (2.0 / (1 + Period))) * Value[1]);
}

#region Properties
/// <summary>
/// </summary>
[Description("Numbers of bars used for calculations")]
[GridCategory("Parameters")]
public int Period
{
get { return period; }
set { period = Math.Max(1, value); }
}
#endregion
}
}

Reply With Quote
 
(login for full post details)
  #7 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received

@35trader:

I do not understand your question.

The EMA updates after each bar and at session end, if you set it to CalculateOnBarClose = false.

Reply With Quote
 
(login for full post details)
  #8 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received


Fat Tails View Post
@35trader:

I do not understand your question.

The EMA updates after each bar and at session end, if you set it to CalculateOnBarClose = false.


Where within the EMA script does it trigger the at session end update?

For some reason this false function does not have the same affect on my indicator as it does in the EMA script I pasted here as I see the EMA does update with false inserted as you stated.

thanks

Reply With Quote
 
(login for full post details)
  #9 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received


35trader View Post
Where within the EMA script does it trigger the at session end update?

For some reason this false function does not have the same affect on my indicator as it does in the EMA script I pasted here as I see the EMA does update with false inserted as you stated.

thanks

You have never shown your indicator to anybody, how would I know what you have done?

Reply With Quote
 
(login for full post details)
  #10 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received



Fat Tails View Post
You have never shown your indicator to anybody, how would I know what you have done?



Can you do the following.
Where within the EMA script does it trigger the at session end update and explain it?

thanks

Reply With Quote
 
(login for full post details)
  #11 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received


35trader View Post
Can you do the following.
Where within the EMA script does it trigger the at session end update and explain it?

thanks

OnBarUpdate() is triggered at session end, when COBC = false.

Reply With Quote
 
(login for full post details)
  #12 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received


Fat Tails View Post
OnBarUpdate() is triggered at session end, when COBC = false.

Greatly appreciated, that I did not know.


1 So if I create a second session within the same day, it updates the second session also (if set at false) even if no bars are developed because the market is closed?

Example:

Session 1 Monday - 9:30 am to 4:00 pm (market open) set at false updates at 4:00
Session 2 Monday - 4:30 pm to 6:00 pm (market closed) set at false updates at 6:00

2. When set at false it still updates on each new bar also? just confirming this.

thanks

Reply With Quote
 
(login for full post details)
  #13 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received


35trader View Post
Greatly appreciated, that I did not know.


1 So if I create a second session within the same day, it updates the second session also (if set at false) even if no bars are developed because the market is closed?

Example:

Session 1 Monday - 9:30 am to 4:00 pm (market open) set at false updates at 4:00
Session 2 Monday - 4:30 pm to 6:00 pm (market closed) set at false updates at 6:00

2. When set at false it still updates on each new bar also? just confirming this.

thanks


With COBC = false, OnBarUpdate() will update with each incoming tick, no more and no less. So what you will see at session end is the state of the indicator as per last tick of that session. If there are no incoming ticks, OnBarUpdate() will not be triggered.

Historical bars are 1-tick bars, so OnBarUpdate() will be triggered once only for each bar on your chart.

Reply With Quote
 
(login for full post details)
  #14 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received


Fat Tails View Post
With COBC = false, OnBarUpdate() will update with each incoming tick, no more and no less. So what you will see at session end is the state of the indicator as per last tick of that session. If there are no incoming ticks, OnBarUpdate() will not be triggered.

Historical bars are 1-tick bars, so OnBarUpdate() will be triggered once only for each bar on your chart.

I have a feeling were stepping backwards or missed communication happen.

Its the indicator update that is my focus, using the OnBarUpdate() the indicator is updated on the first tick of the new bar, but at session end say at 4:00 pm the next bar is possibly at 9:30 am the next morning and I don't wait for the first tick at 9:30 am that creates a new bar and a indicator update. I want it triggered at session end "also" and thought setting it at false did this? so indicator updates would occur at new bar and session end both.

I likely will see if the false works on live today as I have a symbol that is currently trading in a trigger spot on my indicator, so I hope to berify this today.

But what happens if one uses EOD data (not live) and the data comes in after the session end, this is where I wanted to have the indicator update immediately vs waiting for the EOD on the next day (needs next cansle) to trigger the indicator. Maybe I need a false ending session that occurs after the EOD delayed data comes in so it updates immediately.

Hope this makes sense.

appreciate your help.

Reply With Quote
 
(login for full post details)
  #15 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received


35trader View Post
I have a feeling were stepping backwards or missed communication happen.

Its the indicator update that is my focus, using the OnBarUpdate() the indicator is updated on the first tick of the new bar, but at session end say at 4:00 pm the next bar is possibly at 9:30 am the next morning and I don't wait for the first tick at 9:30 am that creates a new bar and a indicator update. I want it triggered at session end "also" and thought setting it at false did this? so indicator updates would occur at new bar and session end both.

I likely will see if the false works on live today as I have a symbol that is currently trading in a trigger spot on my indicator, so I hope to berify this today.

But what happens if one uses EOD data (not live) and the data comes in after the session end, this is where I wanted to have the indicator update immediately vs waiting for the EOD on the next day (needs next cansle) to trigger the indicator. Maybe I need a false ending session that occurs after the EOD delayed data comes in so it updates immediately.

Hope this makes sense.

appreciate your help.

If you want an update at session end you need to set you indicators to COBC = false. I am repeating this now. Otherwise the indicator value of the last bar of the session will not be calculated until the first tick of the new session arrives.

For EOD data you need to make the difference between live real-time data and historical data. After the session end you have to wait for a few minutes until the data provider is ready to supply you with daily historical data (this is not an incoming real-time tick). Once daily data is available, you can either

-> download it for all instruments via the Historical data manager (this is what I do, I select the default list and download everything at once)
-> connect to NinjaTrader and open a new chart for the instrument

Once you have downloaded historical data, to show the indicator value for the last day, guess what, you have to set your indicators to COBC = false.

It is not that difficult to understand.

Reply With Quote
 
(login for full post details)
  #16 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received


Fat Tails View Post
If you want an update at session end you need to set you indicators to COBC = false. I am repeating this now. Otherwise the indicator value of the last bar of the session will not be calculated until the first tick of the new session arrives.

For EOD data you need to make the difference between live real-time data and historical data. After the session end you have to wait for a few minutes until the data provider is ready to supply you with daily historical data (this is not an incoming real-time tick). Once daily data is available, you can either

-> download it for all instruments via the Historical data manager (this is what I do, I select the default list and download everything at once)
-> connect to NinjaTrader and open a new chart for the instrument

Once you have downloaded historical data, to show the indicator value for the last day, guess what, you have to set your indicators to COBC = false.

It is not that difficult to understand.

LOL

I made a test end session time that happens after the EOD data arrives and will see if the false solves my issue.

greatly appreciate your help

Reply With Quote
The following user says Thank You to 35trader for this post:
 
(login for full post details)
  #17 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received


Fat Tails View Post
If you want an update at session end you need to set you indicators to COBC = false. I am repeating this now. Otherwise the indicator value of the last bar of the session will not be calculated until the first tick of the new session arrives.

For EOD data you need to make the difference between live real-time data and historical data. After the session end you have to wait for a few minutes until the data provider is ready to supply you with daily historical data (this is not an incoming real-time tick). Once daily data is available, you can either

-> download it for all instruments via the Historical data manager (this is what I do, I select the default list and download everything at once)
-> connect to NinjaTrader and open a new chart for the instrument

Once you have downloaded historical data, to show the indicator value for the last day, guess what, you have to set your indicators to COBC = false.

It is not that difficult to understand.

Did the following:

1. Altered the session time to occur after the EOD data was available.
2. Updated the EOD data and set the false setting and saved template.
3. Opened Ninja from scratch after the session ended to see if the indicator updated, it did not trigger as it should have.

So I must have an issue within the indicator that is not allowing the "false" function to work?

Reply With Quote
 
(login for full post details)
  #18 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received


35trader View Post
Did the following:

1. Altered the session time to occur after the EOD data was available.
2. Updated the EOD data and set the false setting and saved template.
3. Opened Ninja from scratch after the session ended to see if the indicator updated, it did not trigger as it should have.

So I must have an issue within the indicator that is not allowing the "false" function to work?

Why don't you post a screenshot and the code of the indicator, otherwise we will exchange messages for ever.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
(login for full post details)
  #19 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received


Fat Tails View Post
Why don't you post a screenshot and the code of the indicator, otherwise we will exchange messages for ever.

Its not that I don't want to show you, I first had to determine what I should show you, as stated I'm not programmer.

I have had feed back from the actual programmer today:

"An event is classified as when a tick comes in and the current candle is updated, or when the user scrolls the chart window. So the program starts by initializing the indicator and scans through each historical candle in Ninja's database and calculates the indicator. This loop starts at line 3670. When it reaches the end (the right hand side / the current candle) it stops. During this loop it checks for directional triggers."

The issue is as stated when the indicator gets all the way over to the current EOD data, it does not use the data on that day to update if a trigger occurred that day, it needs the follow on EOD to trip the trigger.
My live daily chart also has the same issue, checking if it updates on the first tick at 6:00pm for NG, it should because the trigger is defined under live updates differently, for lack of better words.

Ok I have found out that he did use OnBarUpDate () when plotting historic EOD??
he even says that function has no value on the live candle, but I know off live candles it updates on the first tick of the new bar, which operates fine.

Maybe the following data helps you out?
Should I some how insert the OnBarUpdate() in the script for the historic EOD update, like I know how to do it LOL.

thanks

Reply With Quote
 
(login for full post details)
  #20 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received


35trader View Post
Its not that I don't want to show you, I first had to determine what I should show you, as stated I'm not programmer.

I have had feed back from the actual programmer today:

"An event is classified as when a tick comes in and the current candle is updated, or when the user scrolls the chart window. So the program starts by initializing the indicator and scans through each historical candle in Ninja's database and calculates the indicator. This loop starts at line 3670. When it reaches the end (the right hand side / the current candle) it stops. During this loop it checks for directional triggers."

The issue is as stated when the indicator gets all the way over to the current EOD data, it does not use the data on that day to update if a trigger occurred that day, it needs the follow on EOD to trip the trigger.
My live daily chart also has the same issue, checking if it updates on the first tick at 6:00pm for NG, it should because the trigger is defined under live updates differently, for lack of better words.

Ok I have found out that he did use OnBarUpDate () when plotting historic EOD??
he even says that function has no value on the live candle, but I know off live candles it updates on the first tick of the new bar, which operates fine.

Maybe the following data helps you out?
Should I some how insert the OnBarUpdate() in the script for the historic EOD update, like I know how to do it LOL.

thanks


Whatever is the problem, it is caused by the code.....

Reply With Quote
 
(login for full post details)
  #21 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received


Fat Tails View Post
Whatever is the problem, it is caused by the code.....

And why I asked for a separate script to trigger an update at session end as the quick fix set to false was not working.

With the separate script I thought I could add it in as a second trigger process for updating an event in the indicator if one occurred on the last historic bar on EOD.

Something like Bars.Session.GetNextBeginEnd possibly, but I need the script written that would execute this second evaluation process.

Reply With Quote
 
(login for full post details)
  #22 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,728 received


35trader View Post
And why I asked for a separate script to trigger an update at session end as the quick fix set to false was not working.

With the separate script I thought I could add it in as a second trigger process for updating an event in the indicator if one occurred on the last historic bar on EOD.

Something like Bars.Session.GetNextBeginEnd possibly, but I need the script written that would execute this second evaluation process.

There is nothing to discuss, if you do not share the information necessary for solving your problem.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
(login for full post details)
  #23 (permalink)
Toronto, Canada
 
 
Posts: 27 since Oct 2011
Thanks: 0 given, 3 received


Fat Tails View Post
There is nothing to discuss, if you do not share the information necessary for solving your problem.

I thought my last post was simplified LOL.

Anyways appreciate your attempt.

Reply With Quote
 
(login for full post details)
  #24 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,765 since Jun 2009
Thanks: 32,302 given, 97,540 received


Fat Tails View Post
There is nothing to discuss, if you do not share the information necessary for solving your problem.



Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > indicator update and template not saving


Last Updated on August 31, 2012


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

New Challenge (TBD)

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts