NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


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 06-03-2011, 08:02 AM   #1
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 740
Thanks: 19
Thanked 14 times in 9 posts
Default move stoplosses

Hello,

when working with auto-strategies it occurs that I need to move stoplosses. It happened today that I moved stoploss but few seconds later the stoploss was pulled back to the posiiton from where I moved it away.

Does this happen wiht setstoploss and using a strategy? Or when using settrailstop? Or isnīt it possible anyway to move the stoploss of the strategy? If so, what is the reaction time that the stoploss(es) is/are pulled back?

Thanks
Tony
tonynt is offline  
Reply With Quote
Old 06-03-2011, 08:16 AM   #2
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hi Tony,

How are you moving stop losses? Through code or manually in a different chart or order entry screen?
NinjaTrader_RyanM is offline  
Reply With Quote
Old 06-03-2011, 08:36 AM   #3
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 740
Thanks: 19
Thanked 14 times in 9 posts
Default

Hello Ryan,

thank you for your prompt reply - great support as usual with NinjaTrader!

The stoploss is defined in the strategy (initial stoploss and then move to entry price eg after 90 ticks).

But when price is in my direction I want to pull stoploss manually closer to actual price for not giving back profits when price falls back to entry-price.

I can move with chart-trader but few seconds later it moves back "from ghost-hand" to where I took it away.

Best
Tony
tonynt is offline  
Reply With Quote
Old 06-03-2011, 08:39 AM   #4
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

The strategy code will continue to set the value of the stop loss, even if you manually move it. If you want manual adjustments to stop losses after an automated entry, you can use the NinjaScript > ATM model for this.

http://www.ninjatrader.com/support/h...strategies.htm
NinjaTrader_RyanM is offline  
Reply With Quote
Old 06-03-2011, 09:04 AM   #5
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 740
Thanks: 19
Thanked 14 times in 9 posts
Default

Thank you!
tonynt is offline  
Reply With Quote
Old 06-03-2011, 09:09 AM   #6
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 740
Thanks: 19
Thanked 14 times in 9 posts
Default

Ryan,

it seems that only ATM-strategies (like to "build" in chart-trader) can be moved stoplosses? Or also strategies with conditions created in strategy-analyzer?

Thanks
Tony
tonynt is offline  
Reply With Quote
Old 06-03-2011, 10:42 AM   #7
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Strategies will set the level of stop loss orders, unless you integrate an ATM strategy into the NinjaScript strategy.

The use model for creating an ATM Strategy within a NinjaScript Strategy is when you want to programmatically monitor and generate an entry signal and then manualy manage the resulting open position via an ATM Strategy in one of NinjaTrader's order entry windows.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 06-03-2011, 01:26 PM   #8
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 740
Thanks: 19
Thanked 14 times in 9 posts
Default

So, I understand that I can code in the strategy that the stoplosses are managed by ATM-strategy (so that I can move the stoplosses with chart-trader, which I couldnīt do when stoplosses managed by strategy) and the exit-conditions (NOT profit-targets, as in this case I could do all as ATM and donīt need a strategy) work with the coded strategy.

Is that right or some misunderstanding on my end?

And if so do you have a sample how to do ATM-strategy within a coded strategy (like your samplepricemodification or samplemultiinstrument....)?

Thanks
Tony
Last edited by tonynt; 06-03-2011 at 01:27 PM. Reason: typing error
tonynt is offline  
Reply With Quote
Old 06-03-2011, 01:43 PM   #9
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Yes, your understanding is correct. The ATM sample is built into the platform. Click Tools > Edit NinjaScript > Strategy > SampleAtmStrategy

http://www.ninjatrader.com/support/h...strategies.htm
NinjaTrader_RyanM is offline  
Reply With Quote
The following user says thank you to NinjaTrader_RyanM for this post:
Old 06-03-2011, 03:04 PM   #10
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 740
Thanks: 19
Thanked 14 times in 9 posts
Default

Hi Ryan,

thanks for all the support. Have a great weekend!

Another hint at this opportunity - if posts would be assorted most recent post at bottom (I think this occurs sometimes in threads) then this makes it more easier and faster to reply as one doesnīt need to scroll up where last post is to answer correctly.

Best
Tony
tonynt is offline  
Reply With Quote
Old 06-03-2011, 03:11 PM   #11
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Thanks, Tony. I agree and have set up my forum display to work this way.

Click User CP on the forum toolbar.
Edit Options
Under Thread Display Mode, change to Linear - Oldest first.

Hope that trick helps you out. Thanks - Have a great weekend!
NinjaTrader_RyanM is offline  
Reply With Quote
Old 06-03-2011, 03:33 PM   #12
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 740
Thanks: 19
Thanked 14 times in 9 posts
Default

Hi Ryan,

sorry for asking again now;-)

The ATM-strategies are easy to do, also strategy-development and coding is easy already. But how can I join both? Checking the sampleatmstrategy I donīt see where I can code my exit conditions. Sorry!

Thanks
Tony
Last edited by tonynt; 06-03-2011 at 03:34 PM. Reason: wrong translation into english
tonynt is offline  
Reply With Quote
Old 06-03-2011, 03:44 PM   #13
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

It's similar. Define your exit conditions but then use the AtmStrategyClose() method instead of ExitLong, ExitShort.

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

http://www.ninjatrader.com/support/h...gy_methods.htm
NinjaTrader_RyanM is offline  
Reply With Quote
Old 06-03-2011, 04:32 PM   #14
tonynt
Senior Member
 
Join Date: Jun 2009
Posts: 740
Thanks: 19
Thanked 14 times in 9 posts
Default

Hi Ryan,

sorry for causing some misunderstanding - already midnight here;-)

What I mean is not - if I understand right your reply - how to manage the ATMStrategyClose but I mean

* WHERE to code the exit conditions in the strategy - not with ATM as I want to have exits with conditions and not fixed profittargets as in ATM? (in help guide using atm strategies there is not a sample how to do the exits - or are the "strategy-coded-exits" not important and not referred by the ATM?

* which strings in the sampleatmstrategy (eg) are "samples" and which are the core and necessary to join with an ATM? I canīt understand this sample as there are no "normal" entries and exits defined. Isnīt there another sample?

Thanks
Tony
Last edited by tonynt; 06-03-2011 at 04:35 PM. Reason: correction question
tonynt is offline  
Reply With Quote
Old 06-03-2011, 04:45 PM   #15
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

The sample has a lot to it and most all of it is required for a working NS > ATM solution. About the only part that is not required is the change stop target block.

The entry condition is simple: Close[0] > Open[0]

The sample does not have explicit exit conditions. The only exits are determined by the target and stop loss defined within the ATM strategy. You can define your own exits conditions if you want, and use the AtmStrategyClose() call to programatically close an ATM strategy.

Since there's a lot to it, you should try first to get it submitting orders with a simple ATM strategy attached. Once things work as you expect, add additional layers of complexity like separate exit conditions.
Last edited by NinjaTrader_RyanM; 06-03-2011 at 04:50 PM.
NinjaTrader_RyanM 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
How to supersede Ninja ProfitTargets and StopLosses kenb2004 Strategy Development 7 01-28-2011 02:57 PM
backtesting trailing stoplosses Eddy-2d Strategy Analyzer 3 02-03-2010 08:27 AM
Move Chart velocity NinjaScript File Sharing Discussion 3 01-30-2010 02:10 AM
Move to breakeven mballagan Strategy Development 18 05-18-2009 12:53 PM
Being able to move up and down on the chart Mike_32 Suggestions And Feedback 1 11-21-2008 07:22 AM


All times are GMT -6. The time now is 07:53 PM.