![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
|
Hello,
I have programm this ExitRule: if(BarsSinceEntry() == 3) ExitLong("BarsLO"); But it do not work?! Is there a bug? |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
No.
You probably have issues with signal names. Try not using ANY signal names and it will likely work.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
|
@ Ray
Ok, That works! Can you give my an Example how to use a ATR Profit Target in a skript? |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#6 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
SetProfitTarget() once called will always submit orders on incoming fills from an entry. If you want to delay submission, call ExitLongLimit() for example.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Member
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#8 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
You could code something like:
Code:
if (Close[0] > Close[1]) EnterLong();
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Member
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
|
@ Dierk
Yes, but I would like to put the Pattern in a Variable. Wow I must do this? |
|
|
|
|
|
#10 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Unfortunately this is not supported. You would need to take an approach like below.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Member
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#12 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
You could custom code your own like here: http://www.ninjatrader-support.com/v...ead.php?t=6651
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
Member
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#14 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#15 |
|
Member
Join Date: May 2008
Location: Austria
Posts: 62
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |