![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Miscellaneous Support Miscellaneous support issues. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Nov 2008
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
|
Greetings,
As an investment strategy I determine the number of shares to purchase based on a fixed percentage of my portfolio divided by the current market price. Example: (percentage x total portfolio) / price = #shares to purchase Is there a feature to specify a dollar amount in the order quantity field that will automatically determine the # shares based on the current price? If not, then perhaps there might be some creative way to at least display the calculated "# of shares" value associated with a symbol, somewhere else for reference purposes? I'm not familiar with NinjaScript but if it can allow simple calculations I would think a custom indicator can be built and added as a new column in the Market Analyzer window to handle this? Thanks! |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Change your strategy to run "by account size" in the "Set order quantity" option when you first start up your strategy.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Nov 2008
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Josh,
As I understand it the solution you provided is for fully automated orders. My intention is to use this feature with manual or semi-auto (ATM) orders. My hope is after selecting an instrument and ATM strategy in the order bar the qty field is automatically updated according to the formula mentioned previously. The next best solution would be to have a custom column in the Market Analyzer, with the calculated qty's for each instrument row that I can reference when manually entering an order. Are either of these solutions possible? Thanks! |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Nov 2008
Posts: 9
Thanks: 0
Thanked 0 times in 0 posts
|
Still waiting for a response if there is a means to have the "quantity" field auto determine shares based on price using manual orders but I figured out the next best thing...
I made a simple custom indicator that calculates the shares based on last price and portfolio size as an input, then included it as a column in the Market Analyzer. Now I can easily reference the desired share quantity for each symbol when manually placing an order. It would be awesome if I could somehow link that column to the order entry quantity field when selecting a symbol row. |
|
|
|
|
|
#5 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Pardon the delay. To do what you want is just a matter of custom programming based off of AccountSize. You want to keep track of PnL to determine your most recent buying power given a certain starting account size. Then run your logic to determine what quantity you want to submit at.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Dec 2008
Location: Austin, TXs
Posts: 111
Thanks: 9
Thanked 0 times in 0 posts
|
I would like to change several of my strategies from purchasing a fixed number of shares to trading a number of shares based on the dollar value of the position. Let's say I want to always initiate positions with $5000. worth of stock -- how do I do that? Poking around the message boards gives me the feeling that "by account size" is involved -- can I do that in some way as an edit rather that having to re-create the strategies? Can you point me to the step-by- step process? I don't know how to do programming. Thx.
|
|
|
|
|
|
#7 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
You will most likely need to adjust programming. "By account size" will not necessarily work because after the first trade your account size is no longer $5000.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Dec 2008
Location: Austin, TXs
Posts: 111
Thanks: 9
Thanked 0 times in 0 posts
|
Hmm, maybe I'm off base by thinking that's the starting point. It's not that I want to put the whole account into a trade. It's that I want to trade several different systems (eventually automatically) with the same $ position in each system -- say 3 $5000. positions in a $25K account. How can I do this? Hopefully without having to write code since I don't know how.
|
|
|
|
|
|
#9 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
This would indeed require some custom coding, please take a look at this thread here - http://www.ninjatrader-support2.com/...t=12252&page=2
Accessing brokerage account values is not supported in NinjaTrader 6.5, but it will be in our upcoming NinjaTrader 7 release.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Dec 2008
Location: Austin, TXs
Posts: 111
Thanks: 9
Thanked 0 times in 0 posts
|
So in the strategy setup if I "Set order quantity" "by strategy" where do I
build that specification into the strategy? I want something like: number of shares = 5000/last price |
|
|
|
|
|
#11 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
If you set it "By strategy" it takes whatever you are submitting your order quantity at. You build it anywhere you want. When you call EnterLong() you specify the quantity you want to buy.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#12 |
|
Senior Member
Join Date: Dec 2008
Location: Austin, TXs
Posts: 111
Thanks: 9
Thanked 0 times in 0 posts
|
So the line reads:
EnterLong(Shares, "") Where Shares is listed on the User Defined Input page as type int, Default 100 and Min 1. Where can I define the number of shares as 5000/last price? Would I have to create this as a variable which would then be accessed byt the EnterLong command??? Sorry that I don't know the code but I'm hoping to be able to blunder thru this to get what I want |
|
|
|
|
|
#13 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Yes you need to create a variable and set its value. You need to be outside of the Wizard for this.
Code:
Shares = 5000 / Close[0];
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| price channels based on the CLOSE | zq655 | Charting | 5 | 01-08-2008 10:52 PM |
| Strategy based on indicator value, not price? | cassb | Strategy Analyzer | 2 | 12-19-2007 06:44 AM |
| coloring indicator based upon price parameters | Thomas | Indicator Development | 10 | 08-28-2007 11:44 AM |
| Use Last Price for Auto Trail Checkbox | pivot44 | Miscellaneous Support | 1 | 06-07-2006 11:00 AM |
| Stops based on price vs. increments. | rmmsmh | Miscellaneous Support | 5 | 05-09-2005 12:11 AM |