PDA

View Full Version : AutoTrading Stock


gregw
10-09-2006, 02:29 AM
Hi

I am building an application that will monitor a watch list of stocks and if conditions are met send a trading order to NT using the autotrader. it is not a charting application but my own stand alone app.

the watch list of stocks changes every day, do I need to manually add the stock symbols to the NT data base? or can I specify the stock symbol from within the code to execute the trade
Can you point me to any information you may have about autotrading stocks, sample scripts anything at all

Thanks

Greg

NinjaTrader_Ray
10-09-2006, 03:21 AM
Greg,

You do not have to enter symbols in the Instrument Managerfor stocks. Just specify the stock symbol.

Ray

gregw
10-12-2006, 08:25 AM
Thanks Ray,

Unlike trading futures, when I trade stock I can have as many as 20 + on my watch list.
In an attempt to better manage these I wasconsidering building a stand alone application to work with Ninja.
While trying to describe how I envisioned this working, I found it easier to cut and paste together the actual form. I simply used the Ninja Orders page and made some modifications that would allow a stock trader, to enter, exit and monitor trades from a single page.

below is the graphic of what I am trying to achieve.

2 Questions.
1, could you incorporate these changes in a future release of NT or
2. Are there / do you know of any talented programmers, familiar with NT who could program this for me as an add on


Thanks

Greg

http://www.thetradingzone.com/i5/NtStockTrades.JPG

http://www.thetradingzone.com/i5/NtStockTrades.JPG

NinjaTrader_Ray
10-12-2006, 10:15 AM
Hi Greg,

NT6 has automated system development capabilities. You may be able to accomplish what you want using NinjaScript. It will be out in beta end of the month. You would need to have someone program. There are currently no individuals familiar with what we have yet to release.

Ray

gregw
10-13-2006, 08:07 AM
Thanks Ray, I will wait for the release.

Question regarding Close At Time.
Today I entered a bunch of Stockorders in the SIM account. For each one I selected "close at time" by right clicking and placing the check mark when I created the order
Under tools>options>misc , i put in 3:51 pm, and did NOT check flatten all, as I did not want my positions in my regular account to be flattened

Well 3:51 came and went, and my stock position in CMVT was still open, so I closed it manually.

Did I set this up correctly? Is there a time time zone to consider that I did not?

NinjaTrader_Ray
10-13-2006, 09:37 AM
Were they strategies?I just tested here and worked as designed. They will only close strategies in the DOM.

Ray

gregw
10-13-2006, 11:59 AM
Yes they were all entered as a strategy called stock1, and were entered using the Basic Entry Window

At one point I loaded an active trade into a DOM window, and I did notice that the check mark was not present for the Close at Time. I went back and loaded it again in a Basic Window, and the check was there. So there was an inconsistency to begin with.

While monitoring my positions on the Orders pagem there is no way of knowing if Close at Time is active or not

I don't know of any other way to check if Close At Time was activated or not

the strategy worked fine, stop limit entries, scale out, trailing stops...

gregw
10-16-2006, 08:24 AM
Again today, 3 stock positions all of which had Close At Time, selected and 3:51 pm as the time to close. None of the positions were closed.

Any suggestions?

Greg

NinjaTrader_Ray
10-16-2006, 09:55 AM
Yes,

Tomorrow, set time to close a few minutes ahead of the current time.
Open a position in Sim101 account, enable close at time.
When the time comes, does it close?

Please let me know as it does work here. This would be the first step, then we can take it from there.

gregw
10-17-2006, 03:50 AM
I did about 10 trials today.

Entering a position, and setting the Close at time a few minutes ahead

About 50 % of the time it worked, and 50% it did not.

It seems like when I went to Close at Time, and turned it on/off (about 5 times), while in the trade, it worked

When I just left it checked, without toggling it, it did not work

I would think that a check box in the advanced options would be easier to use,

Also, once in a position there is nowhere to check if it is selected asone of positions to close

NinjaTrader_Ray
10-17-2006, 09:54 AM
Greg,

Thanks for your help here. Can you only try the following.

Set the time 5 minutesahead.
Open a new DOM
Open a strategy inSim101
Enable TimeToClose (only check it once)

Does it close?

Thanks

gregw
10-17-2006, 11:12 AM
Hi Ray,

I did 2 tests, and both worked fine

One was entered via the DOM, and the other via the BEW.

Seleted time to close ahead ~ 5 min, and both positions were successfully closed.

I don't think I did anything differently in this test than I did in the others.
Only yhing I can think of is that when it failed to trigger I had multiple positions on.

I will try it again with a few positions



Greg

gregw
10-17-2006, 11:18 AM
Here is a thought

When the TimeToClose failed, all the orders I entered were Stop Limit Orders to enter, I invoked the TimeToClose when I originally entered the order, Not once it was filled.
In these tests I have been selecting TimeToClose, only once the order is filled.
Could it be that the TimeToClose needs to be activated only after a position is in the market. Or is it enough to select it when the order is initially placed

Greg

gregw
10-17-2006, 11:38 AM
Ok I'm stumped

multiple positions worked.
Selecting TimeToClose when order is submitted worked

The only one I have not tried is the Stop Limit entry, because it's after hours and the market is not moving enough to triggera fill

Otherwise it seems to be working, go figure, any thoughts?

Greg

gregw
10-17-2006, 11:48 AM
sorry for all these posts,

But as I went to shut down NT, it alerted me to open positions. 1 of the 3 that were on at the same time did not close out.

I reloaded it into a BEW, and on right click it showed a check mark for TimeToClose.

I changed the time for 3 min ahead, and deselected and reselected TimeToClose, and it did close out.

So I am not sure if the problem is intermittent, or maybe I made an error when I entered the order. But, it clearly showed a check next to TimetoClose, so I would be led to believe that it was working

As I mentioned in an earlier post, maybe a radio button or check box in the advanced section, or a column on the orders page, would make it easier to track which positions are set to close out

Thanks

Greg

NinjaTrader_Ray
10-17-2006, 12:32 PM
Thanks Greg -

I have spent a good 15 minutes testing this (you can use the Simulated Data Feed and control the trend up or down) with different ordertypesall has produced expected results. I am sure I am missing something....I suspecta reproducible scenario will surface soon.

Ray

gregw
10-18-2006, 08:04 AM
Hi Ray

I entered 2 positions using Stop Limit Buy at around 2 pm today

Both were set with TimeToClose at 3:51, and neither of them closed out.
I am pretty sure I am setting it up properly, it did work with my trials.

Some thoughts:
1.Maybe it works on a close 5to 10 minutes ahead but fails if close time is too far out
2. These were both stock trades, and the Stock symbol is not in the symbol list, i just enter the symbol in the BEW and hit enter. Maybe the problem lies there

Greg

gregw
10-19-2006, 09:23 AM
Just in case you wanted me to keep you updated here is what played out today

24 Stop Limit orders were entered at the open of trading - all stocks
10 orders triggered
trade management worked great until 1 trade was stopped out on a trailing stop, and the Positions page went blank. I sent the error code to Vincent at support.
I restarted Ninja, and all positions and working orders were there

trade management worked perfectly for the rest of the day, profits were taken, stops were moved up etc...

At 3:51 TimeToClose, there were 8 positions open, none of them got closed out.
All of them had been selected to TimeToClose when they were entered.

Another thought is this:
because I enter so many orders, I don't keep a BEW or a DOM open for them. I enter them, see that they are on the Orders page correclty entered, then I close out the BEW.
All of the trials I performed I kept the trade in a BEW while waiting for the TimeToClose. Maybe it loses track of the TimetoClose if there is no entry window maintained, but it is not reasonable to keep 24 windows open

I hope this helps



Greg

NinjaTrader_Ray
10-19-2006, 10:34 AM
I will check this out. Thanks for the update Greg.

NinjaTrader_Ray
10-19-2006, 10:45 AM
Greg,

Here is the issue, you have to enable CloseAtTime after a position is established not before the strategy or while the entry order of the strategy is pending.

Ray

gregw
10-19-2006, 11:07 AM
ok thanks,

so once the position is live in the mkt, I will pull it up in a BEW or DOM, right click and select CloseAtTime.

I will try this tomorrow or Monday, (probably wont trade tomorrow Friday of option exp can get a bit funky)

I should mention to you that shortly before the CloseAtTime, about 10 min ahead, I loaded each trade that was in the market into a BEW, I checked to see if the CloseAtTime was selected, and fior each it was, but yet it still did not close out the position. Perhaps that is not the same as only selecting it once it's inthe mkt.
In any case I test it out.

Thanks

Greg

gregw
10-24-2006, 08:14 AM
Worked perfectly.
I waited until the position was in the market to initiate the CloseAtTime.

All positions were closed out at 3:51 pm,

I am still moving ahead with building this add-on application so that I can enter all my stock trade setups ahead of time, on a single page, and have them sent over to Ninja for trade management.
Do you think using NinjaScript, I will be able to automate that step, i.e engaging the CloseAtTime once the position is filled?
Any idea when the new v. is due out?

Thanks

Greg

NinjaTrader_Ray
10-25-2006, 01:56 AM
Greg, using NinjaScript you can automate the process within our application, not using external application.