![]() |
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
|
|||||||
| Miscellaneous Support Miscellaneous support issues. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Feb 2011
Posts: 29
Thanks: 3
Thanked 1 time in 1 post
|
double iMAOnArray( double array[], int total, int period, int ma_shift, int ma_method, int shift) Calculation of the Moving Average on data stored in a numeric array. Unlike iMA(...), the iMAOnArray function does not take data by symbol name, timeframe, the applied price. The price data must be previously prepared. The indicator is calculated from left to right. To access to the array elements as to a series array (i.e., from right to left), one has to use the ArraySetAsSeries function. Parameters:
array[] - Array with data. total - The number of items to be counted. 0 means whole array. period - Averaging period for calculation. ma_shift - MA shift ma_method - MA method. It can be any of the Moving Average method enumeration value. shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). Sample: double macurrent=iMAOnArray(ExtBuffer,0,5,0,MODE_LWMA,0); double macurrentslow=iMAOnArray(ExtBuffer,0,10,0,MODE_LWM A,0); double maprev=iMAOnArray(ExtBuffer,0,5,0,MODE_LWMA,1); double maprevslow=iMAOnArray(ExtBuffer,0,10,0,MODE_LWMA,1 ); //---- if(maprev<maprevslow && macurrent>=macurrentslow) Alert("crossing up"); |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Futuretrader,
Yes, this is indicator of indicator essentially. For example, you could use : SMA ( MyIndicator(input), 16) Every indicator allows you to specify the input series to be something other than the default chart series as defined by an overridden method.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Feb 2011
Posts: 29
Thanks: 3
Thanked 1 time in 1 post
|
thanks for the info. tried to find equivalent function in NT for the following but failed. just wonder if there is one.
int IndicatorCounted( ) The function returns the amount of bars not changed after the indicator had been launched last. The most calculated bars do not need any recalculation. In most cases, same count of index values do not need for recalculation. The function is used to optimize calculating. Note: The latest bar is not considered to be calculated and, in the most cases, it is necessary to recalculate only this bar. However, there occur some boundary cases where custom indicator is called from the expert at the first tick of the new bar. It is possible that the last tick of the previous bar had not been processed (because the last-but-one tick was being processed when this last tick came), the custom indicator was not called and it was not calculated because of this. To avoid indicator calculation errors in such situations, the IndicatorCounted() function returns the count of bars minus one. Sample: int start() { int limit; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- the last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- main loop for(int i=0; i<limit; i++) { //---- ma_shift set to 0 because SetIndexShift called abowe ExtBlueBuffer[i]=iMA(NULL,0,JawsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i) ; ExtRedBuffer[i]=iMA(NULL,0,TeethPeriod,0,MODE_SMMA,PRICE_MEDIAN,i ); ExtLimeBuffer[i]=iMA(NULL,0,LipsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i) ; } //---- done return(0); } |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Futuretrader,
I am not aware of any function that does the same thing here. OnBarUpdate() is called for each bar (or each tick) only once, but there is no repainting in Ninjatrader without specifically going back and doing so. Basically the plot's data series get set once per bar (or per tick) and never again so I am not sure where this function would be useful.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#5 | |
|
Senior Member
|
Quote:
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| error/bug in add() function in initialise function | PolarBear | Strategy Development | 15 | 10-29-2011 06:42 AM |
| MouseMove() or similar function | David Lean | Indicator Development | 1 | 05-09-2011 05:51 AM |
| Does NT7 have this function? | Avn_0903 | Miscellaneous Support | 1 | 04-20-2010 03:01 AM |
| NT7 function suggestions. | protran | Suggestions And Feedback | 1 | 10-29-2009 02:22 AM |
| Bid/Offer | gbrandme | Miscellaneous Support | 3 | 03-09-2009 04:56 PM |