![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Aug 2012
Location: Pennsylvania
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
I am new to Ninja Trader after working with e-signal for several years.
I need to re-develop my primary indicator. (I'm clueless with Ninja at this point) When a bar closes above/below both of 2 EMA's and the shorter is above for a buy and below for a sell. When this occurs for the first time after not occurring for at least 3 bars it will mark an arrow on the chart (above price for sell, below price for buy) and give an audible "Buy" or "Sell" All assistance will be appreciated |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Mar 2012
Location: Denver, CO
Posts: 1,317
Thanks: 158
Thanked 206 times in 205 posts
|
Hello chiropharm,
Welcome to the NinjaTrader Support Forums! To start we have a fully documented help guide which will help you get started with Ninja Script. In the help guide you will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts. http://www.ninjatrader.com/support/h..._resources.htm With that said, here is an example of how you can use the EMA to check the Close[] of the current bar. Code:
if(EMA(14)[0] < Close[0] && EMA(15)[0] < Close[0])
{
//Do Something
}
EMA: http://www.ninjatrader.com/support/h...onential_e.htm Using Brackets []: http://www.ninjatrader.com/support/f...ad.php?t=19346 Alert: http://www.ninjatrader.com/support/h...html?alert.htm To see an example of an Alert() function you can view the code of the PriceAlert Indicators that comes preloaded in NinjaTrader by going to the Control Center -> Tools -> Edit NinjaScript -> Indicator and double click on the PriceAlert. Also here is a link to our support forums that goes over how to debug your code which comes in handy if you run into a compiling errors when writing custom code. http://www.ninjatrader.com/support/f...ead.php?t=3418 Let us know if we can be of further assistance.
JC
NinjaTrader Customer Service
Last edited by NinjaTrader_JC; 08-10-2012 at 07:57 AM.
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Aug 2012
Location: Pennsylvania
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
Thank You.
This will get me started |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jan 2012
Location: Portsmouth, NH
Posts: 13
Thanks: 0
Thanked 5 times in 4 posts
|
Can you post an example picture of the buy and sell signals? I get a little confused when reading your description, but a picture could help me to understand this.
|
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Aug 2012
Location: Pennsylvania
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
I will try and attach a screen shot from Ninja that has been manually annotated
|
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Jan 2012
Location: Portsmouth, NH
Posts: 13
Thanks: 0
Thanked 5 times in 4 posts
|
Thanks, I've been playing around with this a bit and have it almost done. I'm going to be out for the rest of the weekend so I'll probably finish it next week.
|
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Jan 2012
Location: Portsmouth, NH
Posts: 13
Thanks: 0
Thanked 5 times in 4 posts
|
Here's what I've put together. It's drawing an arrow whenever the price is above the fast EMA and the fast EMA is above the slow EMA as long as there hasn't been an arrow drawn in the last 3 bars. I added in a BarsAgo parameter in case you want to change how many bars back to look for previous arrows.
I also played around with the idea of only drawing arrows if price crossed above the fast EMA while fast was still above slow or when the fast EMA crossed above slow EMA and price was above the fast. Minor difference, but it did result in fewer arrows. Let me know if you want to see that one. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Syntax assistance | safetrading | Automated Trading | 1 | 01-03-2012 07:34 AM |
| Assistance with indicator for Range bars | nicbizz | Indicator Development | 3 | 01-03-2011 03:12 PM |
| Assistance with MFI Indicator | carlton | Indicator Development | 11 | 01-03-2011 02:26 PM |
| Alerts programming assistance | JackWittaker | Indicator Development | 28 | 11-05-2009 02:30 AM |
| Indicator Assistance | rollinghills | Indicator Development | 5 | 11-01-2009 03:02 PM |