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 > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 06-04-2008, 11:28 AM   #1
Hugo1
Member
 
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
Default My Questions

Hello,

I have programm this ExitRule:

if(BarsSinceEntry() == 3)
ExitLong("BarsLO");

But it do not work?!
Is there a bug?
Hugo1 is offline  
Reply With Quote
Old 06-04-2008, 11:49 AM   #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

No.

You probably have issues with signal names. Try not using ANY signal names and it will likely work.
NinjaTrader_Ray is offline  
Reply With Quote
Old 06-04-2008, 12:02 PM   #3
Hugo1
Member
 
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
Default

@ Ray
Ok, That works!
Can you give my an Example how to use a ATR Profit Target in a skript?
Hugo1 is offline  
Reply With Quote
Old 06-04-2008, 01:36 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

Here is a reference sample that demonstrates how to change stop prices. You would then just pass in a price that represents the current bar's ATR indicator value.

http://www.ninjatrader-support.com/v...ead.php?t=3222
NinjaTrader_Ray is offline  
Reply With Quote
Old 06-05-2008, 03:03 PM   #5
Hugo1
Member
 
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
Default

I will that the ProfitTarget is active if Bars since entry >0.
But this Code sems not ok for this?

if(BarsSinceEntry() > 0)
SetProfitTarget("", CalculationMode.Ticks, 15);

I But it unter OnBarUpdate.
What is wrong?
Hugo1 is offline  
Reply With Quote
Old 06-05-2008, 03:25 PM   #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

SetProfitTarget() once called will always submit orders on incoming fills from an entry. If you want to delay submission, call ExitLongLimit() for example.
NinjaTrader_Ray is offline  
Reply With Quote
Old 06-08-2008, 03:38 AM   #7
Hugo1
Member
 
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
Default Variables

How I can put a Pattern in to a Variable?
For example I like to to this:

Patter = Close[0] > Close[1] ;

if Patter then
Buy ;

Witch declaration for such a Pattern is the right?
Hugo1 is offline  
Reply With Quote
Old 06-08-2008, 03:58 AM   #8
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

You could code something like:
Code:
if (Close[0] > Close[1])
   EnterLong();
NinjaTrader_Dierk is offline  
Reply With Quote
Old 06-08-2008, 04:03 AM   #9
Hugo1
Member
 
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
Default

@ Dierk

Yes, but I would like to put the Pattern in a Variable.
Wow I must do this?
Hugo1 is offline  
Reply With Quote
Old 06-08-2008, 04:06 AM   #10
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

Unfortunately this is not supported. You would need to take an approach like below.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 06-09-2008, 08:50 AM   #11
Hugo1
Member
 
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
Default Equity Indicator

I am wondering that there is no Indicator for the Equity of a System?
Witch colud be insert to a Chart where a System is running.
Hugo1 is offline  
Reply With Quote
Old 06-09-2008, 08:58 AM   #12
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

You could custom code your own like here: http://www.ninjatrader-support.com/v...ead.php?t=6651
NinjaTrader_Dierk is offline  
Reply With Quote
Old 06-09-2008, 01:35 PM   #13
Hugo1
Member
 
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
Default

Ok, Thanks!

How I can to this?

ExitLongLimit(EntryPrice+0.0020);

Is there a Function for the EntryPrice of a Trade?
Position.AvgPrice is not the right?
Hugo1 is offline  
Reply With Quote
Old 06-09-2008, 02:19 PM   #14
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

Position.AvgPrice is the average price of the position. If you want the fill price of an order you would have to venture into advanced programming with OnOrderUpdate() and OnExecution() methods.

http://www.ninjatrader-support.com/H...verview51.html
NinjaTrader_Ray is offline  
Reply With Quote
Old 06-10-2008, 03:09 AM   #15
Hugo1
Member
 
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
Default Input

Wow I can create a Input for a Script without to use the Wizzard?
For Example I like to do something like this:

MaPeriode = 10 ;

if Close crossover MA then
Buy
Hugo1 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
IB questions Gregory Arkadin Connecting 15 04-23-2008 03:39 AM
MB/EFX questions Pinnacle Installation and Licensing 1 01-20-2008 08:19 AM
More Log questions Bogan7 Miscellaneous Support 1 12-13-2007 11:39 PM
A few NT6 questions miked11 Charting 2 01-14-2007 10:28 AM
Few questions MAX General Programming 8 11-16-2006 06:53 AM


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