NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 11-16-2011, 12:54 PM   #1
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 747
Thanks: 23
Thanked 14 times in 9 posts
Default script-atm-exit handling

Hello,

when there is a trade with eg 3 lots entered by calling a chart-trader-ATM from a NT-script-strategy can the exits of these positions be handled within the strategy like the entries would have been realized with NT-script? In the helpguide there is only the exit with unrealizedprofitloss but not with ticks or variables. Can the exit only be done with Target from ATM-chart-trader or also be handled like in a script eg
if (GetCurrentAsk(0) < Position.AvgPrice - 80 * TickSize)
ExitShort(1000, "SX2","S2");"

Thanks
Tony
tonynt is offline  
Reply With Quote
Old 11-16-2011, 02:00 PM   #2
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

tonynt,

Could you please clarify what you mean? Are you wanting to monitor stop losses, etc. outside of the ATM strategy code?

You can use the following methods for handling orders within an ATM strategy.

http://www.ninjatrader.com/support/h...gy_methods.htm

Please let me know if I may assist further.
NinjaTrader_AdamP is offline  
Reply With Quote
Old 11-16-2011, 03:23 PM   #3
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 747
Thanks: 23
Thanked 14 times in 9 posts
Default

Adam,

in a NT-script-strat I do an entry with 3 lots from Chart-Trader-ATM. This is because I want to move the stops in my script-strat during the trade (beside my conditions there- if necessary). And I do not work with profit-targets as OCO.

In my script-strats I do my exits as I have mentioned above eg for my 2nd short lot with "if (GetCurrentAsk(0) < Position.AvgPrice - 130 * TickSize)
ExitShort(1000, "SX2","S2");"

How can one do in the script-strat the exit of the 3 positions coming from ATM-chart-trader please? (There are no profit-targets for the positions as I never want to have a bracket on brokers-server after internet outage August, 2010 and I do the "targets" as mentioned above. So how can I do this when the entries are not coming from the script but from ATM-chart-trader)

I hope I could explain now better.

Thanks
Tony


Quote:
Originally Posted by NinjaTrader_AdamP View Post
tonynt,

Could you please clarify what you mean? Are you wanting to monitor stop losses, etc. outside of the ATM strategy code?

You can use the following methods for handling orders within an ATM strategy.

http://www.ninjatrader.com/support/h...gy_methods.htm

Please let me know if I may assist further.
Last edited by tonynt; 11-16-2011 at 03:25 PM. Reason: typing error
tonynt is offline  
Reply With Quote
Old 11-16-2011, 03:38 PM   #4
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

tonynt,

You can use the AtmStrategyClose() method along with the AtmStrategyRealizedProfitLoss() method to exit your trades at predefined levels.

PNL : http://www.ninjatrader.com/support/h...edprofitlo.htm

Close Strategy : http://www.ninjatrader.com/support/h...ategyclose.htm

Please let me know if I may assist further.
NinjaTrader_AdamP is offline  
Reply With Quote
Old 11-16-2011, 03:51 PM   #5
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 747
Thanks: 23
Thanked 14 times in 9 posts
Default

Adam,

this works with PL but not with variables, no? But if I do it this way and calculating the PL how can I refer to each of the 3 positons?


Thanks
Tony



Quote:
Originally Posted by NinjaTrader_AdamP View Post
tonynt,

You can use the AtmStrategyClose() method along with the AtmStrategyRealizedProfitLoss() method to exit your trades at predefined levels.

PNL : http://www.ninjatrader.com/support/h...edprofitlo.htm

Close Strategy : http://www.ninjatrader.com/support/h...ategyclose.htm

Please let me know if I may assist further.
tonynt is offline  
Reply With Quote
Old 11-16-2011, 04:01 PM   #6
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

TonyNT,

For that you would need to use AtmStrategyChangeStopTarget()

For more information, please see the following : http://www.ninjatrader.com/support/h...stoptarget.htm
NinjaTrader_AdamP is offline  
Reply With Quote
Old 11-16-2011, 04:51 PM   #7
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 747
Thanks: 23
Thanked 14 times in 9 posts
Default

Adam,

of course I can use STOP. But there is no TARGET (because no target is defined in the ATM-Charttrader - to avoid brackets on brokers server). Or do you mean "TARGET2" is linked per default with "STOP2" maybe?

In the meantime I did testing and I had same range-size a script with "direct entry" and a script with "entry from chart-trader-ATM. It occurs that entry by the strategy working with charttrader is sometime only next bar. Can this occur - time delay?

Thanks
Tony


Quote:
Originally Posted by NinjaTrader_AdamP View Post
TonyNT,

For that you would need to use AtmStrategyChangeStopTarget()

For more information, please see the following : http://www.ninjatrader.com/support/h...stoptarget.htm
tonynt is offline  
Reply With Quote
Old 11-17-2011, 08:47 AM   #8
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,547
Thanks: 261
Thanked 1,012 times in 993 posts
Default

Tony, if you have no profit target defined that's fine, STOP2 refers to the stop value of the second target stop price.

The entry is done whenever the conditions you programmed evaluate to 'true' - with CalculateOnBarClose = true the earliest entry is the next bar. If you run the script on 'false' it can enter intrabar as well.
NinjaTrader_Bertrand 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
Internal Order Handling w/ 2 Exit Orders Gumby Strategy Development 4 07-11-2011 02:05 PM
Exit on Close with Advanced Order Handling dbw451 Strategy Analyzer 3 01-27-2009 09:43 AM
ATM from script MelbourneRich Automated Trading 1 09-19-2008 09:38 AM
ninja script strategy exit grav_rat Automated Trading 2 04-20-2008 04:19 PM
Handling of Exit Long and Exit Short before EOD Trader Rob Strategy Development 3 10-22-2007 02:13 PM


All times are GMT -6. The time now is 12:13 AM.