Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Usage of file stream with OIF error accessing file
Collapse
X
-
File.Exists worked but now its like the button is stuck and keeps repeating the same order over and over. I have the button in a Dispatcher.InvokeAsync((() =>. Is there some way that can prevent the simulation of the button being pressed . It fires off 14 trades or more before I can get it closed
I got this fixed by adding buttonclicked = false in the button click procedureLast edited by set2win; 04-19-2022, 02:01 PM.
Leave a comment:
-
The OIF idea just came to me as I am doing that with a python relay from trading view webhook. No other process should be accessing it, especially if I have the second OIF request turned off. On the button it sets a bool true and activates the OpenTrades procedure. But I have it check for open positions so if it tried to run again it shouldn't. I was thinking I could put a File.Exists to make sure that the file doesn't exist before trying to run stream writer. But I may dump this whole idea and do what you recommend with the direct order sent to the specific account.
Leave a comment:
-
Hello set2win,
The OIF files and API are really for external applications to interface with NinjaTrader.
If you are creating a NinjaScript it would be simpler and more efficient to directly send the orders to the Account.
I need some guidance. I need to create a script that has 3 plots that are public and they plot either a 1 or 0. But I need to create another indicator that has 3 chart buttons that sets these variables. The first indicator needs to get those values from the second indicator depending on the button clicks. Because of using
Is there specific reason you are writing to OIF text files?
With the error, the file is already open and hasn't been closed yet. How often is this being called? Is this Calculate OnBarClose?
Is there any other instance of a script reading or writing this file?
Is there other code that reads the file?
Leave a comment:
-
Usage of file stream with OIF error accessing file
Hi, I am trying to create a Trade Copier using OIF. I have the strategy with buttons and my idea is press GoLong button and it sends multiple files (2 right now) to incoming folder . I have it right now where it sends a file and one trade is created. But it immediately disables the strategy and says " Error on calling 'OnBarUpdate' method on bar 1290. The process cannot access the file 'C:\Users\xxx\Documents\NinjaTrader 8\incoming\OIFSim101.txt' because it is being used by another process. So it processes the file once, creates a trade but then its like its trying to access it again and it disables the strategy and it can't process the second file.
Here is a part of the code:
sw = File.AppendText(path);
sw.WriteLine(oifFileDetail1);
sw.Close();
sw.Dispose();
sw = null;
Myabe its attempting to run the procedure again. I get the same error even if I don't try to process the second fileLast edited by set2win; 04-19-2022, 12:44 PM.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by JMont1, Today, 03:05 AM
|
0 responses
4 views
0 likes
|
Last Post
![]()
by JMont1
Today, 03:05 AM
|
||
Started by llanqui, 12-27-2024, 07:18 AM
|
3 responses
99 views
0 likes
|
Last Post
![]() |
||
Started by ronniecorrigan, Yesterday, 02:34 PM
|
2 responses
12 views
0 likes
|
Last Post
![]() |
||
Started by Luckychip, Today, 02:08 AM
|
0 responses
8 views
0 likes
|
Last Post
![]()
by Luckychip
Today, 02:08 AM
|
||
Started by DoomNM, Today, 01:12 AM
|
0 responses
13 views
0 likes
|
Last Post
![]()
by DoomNM
Today, 01:12 AM
|
Leave a comment: