![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jan 2012
Posts: 28
Thanks: 11
Thanked 2 times in 1 post
|
Hi, I want to write a method that will take an indicator parameter and then check swings on it. I want to pass various indicators to this function... I don't know how to do that.
Here is what I want to do from an indicator or strategy: CCI(14) is the indicator I want to pass to the method then call MFSwing (CCI(14)) or MFSwing (ROC(14)) publicbool MFSwing ("somehow pass in CCI(14)") { bool retval = false; // Swing if (Swing("somehow use CCI(14) here ",1).SwingLowBar(1, 1, 4)) { retval=true; } return (retval); } I don't know how or if I can do that. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
Thanks for the note. You would use this syntax: Code:
private void Method(IDataSeries dataSeries)
{
}
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
Just to make sure I had to make an edit to the below post. Please recheck the below if you have already read my post. -Brett
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#4 | |
|
Junior Member
Join Date: Jan 2012
Posts: 28
Thanks: 11
Thanked 2 times in 1 post
|
Quote:
MFSwing (CCI(14)) - not the value, but tell the method to start using the indicator passed in. or MFSwing (ROC(14)) publicbool MFSwing ("passed in indicator and parameter - IE: CCI(14)") { private int indicatorvalue; indicatorvalue = "passed in indicator and parameter - IE: CCI(14)" I want this to look like: indicatorvalue = CCI(14); or indicatorvalue = ROC(14); this is so I can reuse all the code for doing some custom swing stuff and keep it all together in 1 method and just pass in different indicators } |
|
|
|
|
|
|
#5 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
We are on the same page as you. I think the following code example will better illustrate the concept.
Code:
protected override void OnBarUpdate()
{
DoSomething(CCI(14));
}
private void DoSomething(IDataSeries dataSeries)
{
double indicatorValue = 0;
indicatorValue = dataSeries[0];
Print(indicatorValue);
}
Ray
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Ray for this post: |
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
Please see this information as well on this to further round out your understanding and let me know if you have further questions. http://www.ninjatrader.com/support/h...dataseries.htm -Brett
Brett
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_Brett for this post: |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to pass Instrument traded to another chart? | Taddypole | General Programming | 1 | 11-13-2011 11:30 AM |
| Two Pass Scanning of Data - Possible? | tazatek | Indicator Development | 16 | 11-18-2009 08:57 PM |
| CCI Ninja Versus CCI Tradestation | bamill11 | Indicator Development | 4 | 12-01-2008 07:48 PM |
| Which symbol should I pass to NTCommand()? | clearpicks | Automated Trading | 5 | 05-27-2008 11:00 PM |
| New Pass in MB now I can't login to NT | eudamonia | Connecting | 3 | 03-07-2007 06:18 AM |