Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Indicator 'SMA': Error on Calling OnBarUpdate
Collapse
X
-
Thanks Jesse for you reply. I really appreciate it.
I have looked at the Addon Framework educational section. I do plan to work on that.
-
Thanks Jesse for you reply. I really appreciate it.
I have looked at the Addon Framework educational section. I do plan to work on that.
Leave a comment:
-
Hello bjunaid,
Error #9 New: My Ninja Trader crashed or closed by itself sometime between last night and this afternoon. How do I handle this type of situation, in case I had open positions?
To manage a live position after you see some problem, you can use the platform (if possible) to close the position. You would otherwise contact your brokers orders desk.
To get an idea of what happened you would first want to take a look at the log files to see if any errors are showing up. This is also generally a good time to ask our support for a hand in looking through the logs by using the Help -> Email support option and including the logs/description of what happened and when it happened.
You may want to also see if any windows programs you were using were closed, did windows restart or update? If the PC restarted or went to sleep that could be a reason for the platform being closed or having an error. These would be good items to also check.
Question # 1: I would like to close all open my position created by my strategy, incase my strategy encounters an error and becomes disabled. Should I create a secondary strategy to monitor my primary strategy. What would you recommend for this type of scenario?
If connection is not part of the issue and it was just some error, you could potentially use an addon for that purpose or to monitor an account for a position and close it. Another strategy won't see another strategies orders so that would not be a good choice for a monitoring script. An indicator could be used in that case with the addon account class. https://ninjatrader.com/support/help...ount_class.htm
I look forward to being of further assistance.
Leave a comment:
-
Update...
Error # 7: Looks like, I was able to fix this error. I was submitting multiple exit orders at the same time, had to enter a Boolean to turn on/off exit submissions. There is still an issue of connection lost problem, which I am not sure how to go about handling. Also, If you know a better way to handle overfills, please let me know. I will much appreciate it.
Leave a comment:
-
Hi Chris,
Thanks so much for your reply, I really appreciated your detailed response.
Error#4: I was able to fix this. I forgot that I actually did have "Foreach" statements in my code.
Error#5: Connection Lost I have been able to change the statement to handle this part of the error. However it would be great if you can provide me with a some more guidance or real sample strategies that can handle these type of connection errors.
Error #6: I am looking into your solution and I have an idea to work around this error.
Error # 7: I am getting Over Fills on my orders by a lot sometimes even 400 Contracts and I lost $212K last week in seconds due to this errorin sim account. How can I handle this in unmanaged approached. I have read other threads on this forum but I couldn't find any example of how to go about handling this. This is an extremely serious and dangerous error. I thought it was a connection problem but it is not and strangely this error doesn't occur even once in Market Replay. Why and How can this error occur? Could you please provide me with a working example of handling this error.
Error #9 New: My Ninja Trader crashed or closed by itself sometime between last night and this afternoon. How do I handle this type of situation, in case I had open positions?
Question # 1: I would like to close all open my position created by my strategy, incase my strategy encounters an error and becomes disabled. Should I create a secondary strategy to monitor my primary strategy. What would you recommend for this type of scenario?
Thanks,Last edited by bjunaid; 11-01-2020, 07:40 PM.
Leave a comment:
-
Hello bjunaid
Error#4: Error on calling 'OnBarUpdate' method on bar 2145: Collection was modified; enumeration operation may not execute.
I need to know what causes this error. I have certain arrays that I am looping through an array in my code of total buy volume and sell volume. What can I do to solve this problem.
This generally means that you have used a foreach loop on a collection and then modified that collection during the iteration of the collection. A for loop would be used to avoid this error. You can hit this error in some cases by calling NinjaScript syntax like the DrawingTools collection. If you have more details on what code was used when this was generated we could review that.
Error#5: Connection Lost. Would you able to provide with an example of strategy that completely handles the connection lost issues and handling of position in an unmanaged approach. I have searched the forums and I didn't find enough examples and documentation available to combine all the bits and pieces together. I have tried the recalculate approach but it gave me devastating results which made my Sim account over drawn by -$212K within seconds.
Error#6. I am using StreamWriter in my strategy and I am running it on multiple instruments to log enrtries and exits. Following error occurred today, I understand what this error is but I don't know how to handle this error.
Error on calling 'OnExecutionUpdate' method on bar 6624: The process cannot access the file '.....Documents\NinjaTrader 8\10-30-20-STFUTUNMANTRAIL_EntryLog.txt' because it is being used by another process.
I look forward to being of further assistance.
Leave a comment:
-
Hi Chris,
I was able to figure out solutions for most of the errors. I need help with the following errors:
Error #1: Fixed
Error#2: Fixed
Error#3: Fixed
Error#4: Error on calling 'OnBarUpdate' method on bar 2145: Collection was modified; enumeration operation may not execute.
I need to know what causes this error. I have certain arrays that I am looping through an array in my code of total buy volume and sell volume. What can I do to solve this problem.
Error#5: Connection Lost. Would you able to provide with an example of strategy that completely handles the connection lost issues and handling of position in an unmanaged approach. I have searched the forums and I didn't find enough examples and documentation available to combine all the bits and pieces together. I have tried the recalculate approach but it gave me devastating results which made my Sim account over drawn by -$212K within seconds.
Error#6. I am using StreamWriter in my strategy and I am running it on multiple instruments to log enrtries and exits. Following error occurred today, I understand what this error is but I don't know how to handle this error.
Error on calling 'OnExecutionUpdate' method on bar 6624: The process cannot access the file '.....Documents\NinjaTrader 8\10-30-20-STFUTUNMANTRAIL_EntryLog.txt' because it is being used by another process.
Please reference the error/issue # I have specified in this forum so it helps me solve each issue separately.
Thanks
Leave a comment:
-
Chris,
Yes I can send you the script, log and trace files.
Error # 1: Doesn't happen every time but happen often.
Error # 3: I was able to fix this error I just had to delete the NSF file in DB folder and now it works fine.
Error # 4: There are a new error(s) which happened last night. My chart was frozen around 3am in the morning.
2020-10-28 03:11:28:798|3|4|Strategy 'STFUTTRENDFOLLOW': Error on calling 'OnBarUpdate' method on bar 2145: Collection was modified; enumeration operation may not execute.
2020-10-28 03:11:28:811|3|4|Strategy 'STFUTTRENDFOLLOW': Error on calling 'OnBarUpdate' method on bar 2145: Collection was modified; enumeration operation may not execute.
2020-10-28 03:11:28:814|3|4|Strategy 'STFUTTRENDFOLLOW': Error on calling 'OnBarUpdate' method on bar 2145: Collection was modified; enumeration operation may not execute.
2020-10-28 03:11:28:935|3|16|Chart rendering failed. There is likely a problem with a chart object's OnRender method. D2D error = 'HRESULT: [0x88990016], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_PUSH_POP_UNBALANCED/PushPopUnbalanced], Message: The push and pop calls were unbalanced.
Error # 5: Connection lost and my strategy became disabled.
I am soo glad that I am running these scripts on simulation account. After all these errors with NT system, I don't think that I will ever have the confidence to run my strategies in real time and risk real money. Sorry I am just frustrated after spending 8 months hoping one day the strategy will work without any errors.
Leave a comment:
-
Hello bjunaid, thans for your reply.
For the first problem with the custom script, is this reproducible consistently on your script i.e. does it happen every time you enable the strategy? I can test it on my installation if you can export this script and send it into "platformsupport at ninjatrader.com" referencing "Attn ChrisL 2806901"
For the connection issue, are you completely unable to connect to TDA at the moment? Please send us your full log and trace files so I can have a look at the problem:- Open your NinjaTrader folder under, "Documents" (sometimes called, "My Documents")
- Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
- Send the 2 compressed folders as attachments to this email.
- Once complete, you can delete these compressed folders.
I look forward to hearing from you.
Leave a comment:
-
I already have the latest version of NT8 installed. Is there another way to tackle the TD Ameritrade error because it takes time to restore all the indicators and reset everything.
I also want to know about Error#1. Could you tell me why the SMA would give error OnBarUpdate and how I can fix this issue or get around it.
Leave a comment:
-
Hello bjunaid, thanks for writing in.
It looks like you are seeing some bugs we experienced in march with the Invalid Key message. Please take these steps:
Uninstall/Reinstall NinjaTrader.
Go to the Windows Control Panel and uninstall NinjaTrader. After you have uninstalled, get the latest download here and run the executable:
NinjaTrader is a futures trading platform that delivers integrated multi-device trading. Discover our best platform to trade futures for active futures traders.
Please test your strategy after completing this.
For the trades the strategy is taking, you would need to use the Print method to find if the strategy is reaching it's conditions or not. If you add a Print within your condition do you see anything the next day? e.g.
if(<EntryCondition>)
{
Print("Entry Condition True");
EnterLong();
}
I look forward to assisting.
Leave a comment:
-
Indicator 'SMA': Error on Calling OnBarUpdate
Hi,
I am getting two errors. How do I handle/debug these two errors:
Error 1: My strategy disables when I get the following two errors:
2020-10-27 16:04:53:685|3|4|Indicator 'SMA': Error on calling 'OnBarUpdate' method on bar 2532: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
2020-10-27 16:04:53:706|3|4|Strategy 'STFUTTRENDFOLLOW': Error on calling 'EventHandlerBarsUpdate' method: Object reference not set to an instance of an object.
Error 2: I don't see any errors and my strategy is still running or enabled. Last night I left my strategy to run, however this morning I noticed that strategy didn't get into any trades after 3:46AM last night. Which is very odd behavior because it was getting into trades when I left it to run. Please see attached my log file.
Error 3. Error received from TD Ameritrade account activity stream: Invalid Key … I tried reconnecting with TD Ameritrade already.
Thanks,Attached FilesLast edited by bjunaid; 10-27-2020, 02:32 PM.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ScottW, Today, 06:09 PM
|
1 response
4 views
0 likes
|
Last Post Today, 06:53 PM | ||
Started by ScottWalsh, Today, 06:52 PM
|
0 responses
3 views
0 likes
|
Last Post
by ScottWalsh
Today, 06:52 PM
|
||
Started by ftsc2022, 10-25-2022, 12:03 PM
|
5 responses
256 views
0 likes
|
Last Post Today, 06:48 PM | ||
Started by Board game geek, 10-29-2023, 12:00 PM
|
14 responses
244 views
0 likes
|
Last Post
by DJ888
Today, 05:38 PM
|
||
Started by Waxavi, 04-19-2024, 02:10 AM
|
4 responses
56 views
0 likes
|
Last Post
by sonia0101
Today, 04:02 PM
|
Leave a comment: