NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 08-22-2008, 08:17 AM   #1
ATI user
Senior Member
 
ATI user's Avatar
 
Join Date: Apr 2006
Location: Toronto
Posts: 1,321
Thanks: 1
Thanked 7 times in 7 posts
Default interactive strategy chart

is there a way (or could there be a way in a coming version) to make a strategy chart interactive (instead of only using parameter settings) to make a change without losing real time data plots?

for instance, I would imagine having an alert window pop up under a certain condition and then be able to input a value and have the cs use the value from that bar forward without replotting the whole chart...similar to an input button idea

main issue here is being to change the chart without losing real time plots

thanks
Last edited by ATI user; 08-22-2008 at 08:40 AM.
ATI user is offline  
Reply With Quote
Old 08-22-2008, 08:32 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

Thanks for the suggestion!
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-23-2008, 04:32 AM   #3
ATI user
Senior Member
 
ATI user's Avatar
 
Join Date: Apr 2006
Location: Toronto
Posts: 1,321
Thanks: 1
Thanked 7 times in 7 posts
Default

come to think about it...you already have something like that don't you

you can right click in an Indicator chart running Charttrader and select between a sell stop, buy stop and buy stoplimit

perhaps we could right click in a strategy chart and choose from Input A, Input B, Input C... at which time it asks for the input...which could be a value or string

for instance, I would like to be able to turn off autotrading without losing all the plotted data from prior trades....so I would input 'off' to Input A which my cs would monitor to adjust the autotrading variable

even better, my cs would monitor Input B where I could input the number of ticks back that I want my cs to trail my stop during a trade

maybe we could decide when declaring a variable in the Properties section of the cs code if we want that variable to be browsable from the right-click input dialog as well as from the Parameter Settings dialog

something like that would be very powerful by adding a lot of flexibility to my cs code
Last edited by ATI user; 08-23-2008 at 01:53 PM.
ATI user is offline  
Reply With Quote
Old 08-23-2008, 12:51 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Interesting. Thanks for sharing your thoughts.
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-17-2008, 07:53 AM   #5
ATI user
Senior Member
 
ATI user's Avatar
 
Join Date: Apr 2006
Location: Toronto
Posts: 1,321
Thanks: 1
Thanked 7 times in 7 posts
Default

any chance that NT7 will have this capability?

if not, or even if it will, could you please point me in the right direction re how access an external file from my strategy to pickup values without disturbing the chart plots?

thanks
ATI user is offline  
Reply With Quote
Old 09-17-2008, 08:42 AM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

ATI user,

There is no information about NT7 as of currently. We will make announcements when they become available.

As to reading from external files, please see these reference samples: http://www.ninjatrader-support.com/v...ead.php?t=3476
http://www.ninjatrader-support.com/v...ead.php?t=3477
http://www.ninjatrader-support.com/v...ead.php?t=3475
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-17-2008, 09:41 AM   #7
ATI user
Senior Member
 
ATI user's Avatar
 
Join Date: Apr 2006
Location: Toronto
Posts: 1,321
Thanks: 1
Thanked 7 times in 7 posts
Default

thanks Josh

I will give those a try.
ATI user is offline  
Reply With Quote
Old 09-17-2008, 08:18 PM   #8
ATI user
Senior Member
 
ATI user's Avatar
 
Join Date: Apr 2006
Location: Toronto
Posts: 1,321
Thanks: 1
Thanked 7 times in 7 posts
Default SampleStreamReader

Josh

In SampleStreamReader is the indicator supposed to create the txt file per this code?

// This sets the path in which the text file will be created.
private string path = Cbi.Core.UserDataDir.ToString() + "MyTestFile.txt";

...or am I...if me, where? I put a file in db/data and still got the error "File does not exist"

Thanks.
ATI user is offline  
Reply With Quote
Old 09-18-2008, 08:20 AM   #9
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

ATI user,

That line does not create the file. That line is simply storing where the file is located at. The file location should be in My Documents\NinjaTrader 6.5\MyTestFile.txt and not in the db/data folder.
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-18-2008, 11:35 AM   #10
ATI user
Senior Member
 
ATI user's Avatar
 
Join Date: Apr 2006
Location: Toronto
Posts: 1,321
Thanks: 1
Thanked 7 times in 7 posts
Default

Thanks Josh

It is reading the file fine and printing 0 0 0 0

How do I get data into the file? When I try to add data manaully it says it can not create the file...which is already created...does not make sense

I should mention that my intention is to manually change data in the file so my cs will pick it up and make a change without losing its plots.

Maybe I should have another indicator, streamwriter or other, that I can change a parameter setting in that would then write that to the file...which would then be read by streamreader???
Last edited by ATI user; 09-18-2008 at 11:39 AM.
ATI user is offline  
Reply With Quote
Old 09-18-2008, 11:47 AM   #11
ATI user
Senior Member
 
ATI user's Avatar
 
Join Date: Apr 2006
Location: Toronto
Posts: 1,321
Thanks: 1
Thanked 7 times in 7 posts
Default

Doh!

My cs picks up public variable values from several indicators all the time. Why not just have a dummy one that only holds the variables I want to change in my cs? Simple.

Will advise
ATI user is offline  
Reply With Quote
Old 09-18-2008, 11:57 AM   #12
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

ATI user,

If you want to write to the file you will need to use StreamWriter. Reading from the file is done with StreamReader. Alternatively you can use the System.IO example one.
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-18-2008, 12:09 PM   #13
ATI user
Senior Member
 
ATI user's Avatar
 
Join Date: Apr 2006
Location: Toronto
Posts: 1,321
Thanks: 1
Thanked 7 times in 7 posts
Default

Quote:
Originally Posted by ATI user View Post
Doh!

My cs picks up public variable values from several indicators all the time. Why not just have a dummy one that only holds the variables I want to change in my cs? Simple.

Will advise
Josh

There is no way to get the above to work is there?

Problem being the strategy feeds the variables to the indicator to then get back a result. I can not change an input parameter in the indicator in order to have it read by the strategy can I?

Bummer
ATI user is offline  
Reply With Quote
Old 09-18-2008, 12:11 PM   #14
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

I am not exactly sure what you mean, but you can definitely expose variables in the indicator that can be read by the strategy. Please see this reference sample: http://www.ninjatrader-support.com/v...ead.php?t=4991
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-18-2008, 12:15 PM   #15
ATI user
Senior Member
 
ATI user's Avatar
 
Join Date: Apr 2006
Location: Toronto
Posts: 1,321
Thanks: 1
Thanked 7 times in 7 posts
Default

Quote:
Originally Posted by NinjaTrader_Josh View Post
ATI user,

If you want to write to the file you will need to use StreamWriter. Reading from the file is done with StreamReader. Alternatively you can use the System.IO example one.
Ok. I just want a simple switch to turn on/off a variable in my strategy....without refreshing the chart. So I assume I need to have an indicator that writes a variable to a file (the indicator must be exclusive to the chart running my strategy so the chart does not refresh when I change the input to the writing indicator) and then have my strategy read the variable from the same file using streamreader code. Is that correct?

Is this what users are doing to input variables to a strategy without the plots refreshing?...or is there any method?

Thanks.
ATI user is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
API fees for Interactive Brokers copodon Connecting 5 04-27-2011 11:42 AM
Chart data in Strategy Analyzer does not match real chart data Greg1 Strategy Analyzer 12 04-20-2009 02:02 PM
To All Interactive Brokers Users... trader65 Charting 0 05-12-2008 10:33 AM
Running a Strategy on German Stocks with Interactive Brokers EvolveK Automated Trading 17 12-04-2007 05:53 AM
Interactive Broker mic_ninja Automated Trading 1 11-30-2007 03:52 AM


All times are GMT -6. The time now is 01:30 AM.