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 > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 10-23-2007, 03:12 PM   #1
jlm0@infionline.net
Member
 
Join Date: Sep 2007
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Default Ending Ninjascript strategy

How can I check in a Ninjascript strategy, to see if a certain profit level has been reached, and then have the strategy stop?
jlm0@infionline.net is offline  
Reply With Quote
Old 10-23-2007, 04:32 PM   #2
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

We have seriously enhanced the area of accessing performance data in a strategy with our upcoming NT 6.5. What you want to do can be accomodated in this release. We expect beta next week sometime.
NinjaTrader_Ray is offline  
Reply With Quote
Old 10-24-2007, 09:36 AM   #3
jlm0@infionline.net
Member
 
Join Date: Sep 2007
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Default Ending Ninjascript strategy

Thanks Ray,
Can I test Beta version, and be notifyed when available?
Jim
jlm0@infionline.net is offline  
Reply With Quote
Old 10-24-2007, 12:06 PM   #4
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

Yes, we will provide public access to the beta software when available.
NinjaTrader_Ray is offline  
Reply With Quote
Old 10-30-2007, 09:17 AM   #5
jlm0@infionline.net
Member
 
Join Date: Sep 2007
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Default ending ninjascript

is this beta version on target to be released this week?
jlm0@infionline.net is offline  
Reply With Quote
Old 10-30-2007, 09:38 AM   #6
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

Yes, that is what we are shooting for.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-04-2007, 06:37 AM   #7
dendy
Member
 
Join Date: Jun 2007
Posts: 79
Thanks: 0
Thanked 0 times in 0 posts
Default

This will be a serious enhancement. Can you tell us how to access it? Let's say we want to measure the current P/L in ticks, the max adverse excursion in ticks and the max favorable excursion in ticks and set each equal to a user variable. What would be the code to call the P/L this bar, MAE and the MFE?

Thanks,

dendy.
dendy is offline  
Reply With Quote
Old 11-04-2007, 10:22 AM   #8
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

When the beta is out, it will come with documentation that will answer your questions.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-05-2007, 06:20 AM   #9
dendy
Member
 
Join Date: Jun 2007
Posts: 79
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks Ray,

Will the Beta version be announced just like one of the regular versions (on program start-up)? Or will it be announced only on the website somewhere.

Thanks,

dendy.
dendy is offline  
Reply With Quote
Old 11-05-2007, 06:55 AM   #10
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

It will be announced in the 6.5 Beta section of this forum to start.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-05-2007, 07:04 AM   #11
dendy
Member
 
Join Date: Jun 2007
Posts: 79
Thanks: 0
Thanked 0 times in 0 posts
Default

I see.

Thanks,

dendy.
dendy is offline  
Reply With Quote
Old 11-07-2007, 07:29 AM   #12
jlm0@infionline.net
Member
 
Join Date: Sep 2007
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Default ending ninjascript

I have 6.5 installed and am back to my original question:

How can I check in a Ninjascript strategy, to see if a certain profit level has been reached, and then have the strategy stop?
jlm0@infionline.net is offline  
Reply With Quote
Old 11-07-2007, 08:03 AM   #13
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 see the Help Guide section Strategy Performance Methods. We will post reference samples in this area in the coming weeks.
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-07-2007, 08:56 AM   #14
jlm0@infionline.net
Member
 
Join Date: Sep 2007
Posts: 99
Thanks: 0
Thanked 0 times in 0 posts
Default ending ninjascript

Will this coding do what I want?
Stop the strategy from running once I have achieved a net realized profit of at leat $100?


// If the profit on real-time trades is > $100 stop trading
if (Performance.RealtimeTrades.TradesPerformance.Curr ency.CumProfit > 100)
return;
jlm0@infionline.net is offline  
Reply With Quote
Old 11-07-2007, 09:07 AM   #15
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

To be technically accurate:

- If you include that code in any public event driven method (such as OnBarUpdate()) it will return from that method. Thus, if its the first line in that method, it will no longer process your code underneath that condition check.

- So if you only have strategy order logic in OnBarUpdate(), you could add that line of code and prevent any further processing of this method. It will not stop your strategy from running but it will do what you want.

- If you want to terminate the strategy (remove it from a chart its running etc..) you can set the strategy "Running" property to "false".

// If the profit on real-time trades is > $100 stop trading
if (Performance.RealtimeTrades.TradesPerformance.Curr ency.CumProfit > 100
)
Running = false
;
NinjaTrader_Ray 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
Calling an ATM Strategy Within NinjaScript Jim-Boulder Strategy Development 5 08-26-2010 02:54 AM
Ninjascript Columns svrz Market Analyzer 5 05-26-2007 06:01 PM
NinjaScript Strategy Orders ThePatientOne Automated Trading 1 05-25-2007 11:11 AM
NT6 NinjaScript Vs NT5 underground Indicator Development 2 11-22-2006 05:44 AM
Using DLL's in NinjaScript SigmaTrader Indicator Development 5 09-24-2006 04:23 PM


All times are GMT -6. The time now is 04:30 PM.