NinjaTrader Support Forum  
X

Attention!

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


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-19-2008, 04:00 AM   #1
Czarek
Senior Member
 
Join Date: Jun 2008
Posts: 159
Thanks: 0
Thanked 0 times in 0 posts
Default Print stop loss and profit target.

Hi.
My strategy when working with TWS do not print stop loss and profitt target on chart when stop loss or profit target is filled. This stop loss or profit target appear on chart when I reload the strategy. Buy and sell order are printed Ok.
Same strategy if working with NT simulator acc print stop loss and profit target on chart, no problem. What colud be possible reason of this?
Rgds
Czarek
Czarek is offline  
Reply With Quote
Old 08-19-2008, 11:43 AM   #2
Czarek
Senior Member
 
Join Date: Jun 2008
Posts: 159
Thanks: 0
Thanked 0 times in 0 posts
Default

I will check my problem carrefully and I see that olny stop loss order are not printed. Trarget limit, buy to cover enter orders are OK. Only stop are not shown on chart. I use simple strategy made by strategy wizard.
This is stop loss code:
protected override void Initialize()
{

SetStopLoss("", CalculationMode.Ticks, Stop1, false);
SetProfitTarget("", CalculationMode.Ticks, Limit1);
CalculateOnBarClose = true;
}

What colud be the possible reason for it?
Czarek is offline  
Reply With Quote
Old 08-19-2008, 12:27 PM   #3
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Please enable "TraceOrders = true" in the Initialize() method, then inspect the output in the Output window to get an idea why this method may be ignored.
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-20-2008, 08:57 AM   #4
Czarek
Senior Member
 
Join Date: Jun 2008
Posts: 159
Thanks: 0
Thanked 0 times in 0 posts
Default

Ray.
I enabled "TraceOrders = true.
If I set stop and profit as show in former message
stop loss orders are placed or filled there is nothing shown in Output window but orders are placed and executed by TWS.
Only enteries and update on bar close are shown:
2008-8-20 8:41:00 Entered internal PlaceOrder() method at 2008-8-20 8:41:00: Action=Buy OrderType=Market Quantity=25,000 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''

If I stop loss and profit to each entry. Output window shows:
2008-8-20 9:16:00 Entered internal PlaceOrder() method at 2008-8-20 9:16:00: Action=SellShort OrderType=Market Quantity=25,000 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
2008-8-20 9:16:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=3 Currency=0 Simulated=False
2008-8-20 9:16:00 Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=7 Currency=0 Simulated=False

But in both cases only entry orders are printed. Do you have any idea about possiblem reason??
Czarek
Czarek is offline  
Reply With Quote
Old 08-20-2008, 09:54 AM   #5
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

What instrument are you trading?
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-20-2008, 10:23 AM   #6
Czarek
Senior Member
 
Join Date: Jun 2008
Posts: 159
Thanks: 0
Thanked 0 times in 0 posts
Default

I've just test it right now with 3 instruments MHI, EuroDollar and NQ. EuroDollar, MHI - both has same problem. The sample I send you before comes from Eurodollar.
NQ working OK.
Czarek is offline  
Reply With Quote
Old 08-20-2008, 11:48 AM   #7
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Can you see if you have the same problem on ZS (SoyBeans)? Also, this is a live account and NOT an NT internal sim account such as SIM101?
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-25-2008, 11:36 PM   #8
Czarek
Senior Member
 
Join Date: Jun 2008
Posts: 159
Thanks: 0
Thanked 0 times in 0 posts
Default

Ray.
I have tested 4 instruments NQ,MHI, EURUSD ans ZS with TWS connection.
With Sim101 all of them print all orders on chart, no problem.
With real account only NQ working properly.
MHI, EURUSD and ZS print only entry ordres (Buy, Sell, ). StopLoss and ProfitTaget are not printed during strategy working. All orders apprared when I reload strategy.
Do you have idea of possbile reason??
Czarek
Czarek is offline  
Reply With Quote
Old 08-25-2008, 11:44 PM   #9
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

This is a bug which will be fixed with next update (2-3 weeks from now).
NinjaTrader_Dierk 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
Profit Target and Stop loss change the number of trades ssierra Strategy Development 9 12-17-2010 04:32 AM
Strategy: Monitoring Stop-Loss and Profit Target Orders NinjaTrader_Josh Reference Samples 0 02-23-2008 11:15 PM
Profit Target and Stop Loss not honored pjwinner Strategy Analyzer 6 11-30-2007 09:45 AM
Stop Loss - profit target settings deanldavis475 Miscellaneous Support 1 11-26-2007 07:31 AM
Default stop loss and profit target as GTC equitydealer General Programming 4 06-18-2007 11:31 PM


All times are GMT -6. The time now is 11:47 AM.