![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Junior Member
Join Date: Sep 2007
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
|
Hello
I am trying to create a simple indicator that plots the difference Bollinger Band Top and price(High). Could someone help with the codes. Thanks |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Hi Ronin,
To get started you can run the NinjaScript indicator wizard (Tools->New NinjaScript->Indicator). Make sure you have at least one plot when you go through the wizard pages. After you finish, press the "Generate" button to get the NinjaScript editor to open with your new indicator. If you look in the OnBarUpdate() section you will notice this line of code: Code:
Plot0.Set(Close[0]); Code:
Plot0.Set(Bollinger(2, 14).Upper[0] - High[0]);
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Sep 2007
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Josh
Thanks. The code is working great. Regards |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Sep 2007
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
|
In the case below I am trying to build an indicator to determine whether BB is sloping or not.
The code is Plot0.Set(((Bollinger(2, 20).Upper[0] - Bollinger(2, 20).Upper[5])/Bollinger(2, 20).Upper[0]*100)); Formula is Bollinger Upper Band -Bollinger upper band 5 period ago/Bollinger upper band *100 But this code is not returning any value. Could someone please correct my code. Thanks
Last edited by Ronin; 09-11-2007 at 12:51 AM.
|
|
|
|
|
|
#5 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
The problem can likely be resolved by reviewing this "Tip".
http://www.ninjatrader-support.com/v...ead.php?t=3170
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Sep 2007
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
|
This partly sorted the problem. The code now plots the values. However there seems to be huge gaps in plotting the indicator.
What I am actually trying to do is simply apply ROC indicator to Boll Band, SMA etc. I want to calculate rate of change of indicator value instead of price. Could you please guide me how to do this. Thanks much. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A simple question about performance. | MGDavid | Miscellaneous Support | 2 | 06-21-2007 08:47 AM |
| Problems with simple donchian cross test | zoltran | Strategy Development | 2 | 04-02-2007 10:21 AM |
| Simple Strategy | Oli | Automated Trading | 2 | 03-05-2007 11:42 PM |
| Simple profit/stop strategy | Steveinvest | Miscellaneous Support | 1 | 12-30-2005 02:50 AM |