![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Senior Member
Join Date: Nov 2011
Posts: 238
Thanks: 94
Thanked 14 times in 12 posts
|
Ninjas, this should be very easy to solve for you, this situation is this
If I add this condition below, it works perfectly: if (Close[0]-Median[1]> 0) { EnterLong(); } But if I add this one, I have non result, zero event, why? if (Close[0]-Median[2]> 0) { EnterLong(); } |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
pstrusi,
Could you possible post your code here? It could be you are trying to access Median[2] when it doesn't exist yet. if ( CurrentBar < 2) return; added to the beginning of your OnBarUpdate() may help.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_AdamP for this post: |
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2011
Posts: 238
Thanks: 94
Thanked 14 times in 12 posts
|
I'ts no necessary, a very fool error from me...as you well said Median[2] didn't exist cause in Barsrequired I had set 1.
Thanks my friend |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| NT on tablets; what is the situation? | Martinigue | Miscellaneous Support | 1 | 04-30-2012 02:25 AM |
| Rare situation | "CJS" | General Programming | 4 | 02-13-2012 09:19 AM |
| strange situation with strategy names | daglas | Strategy Development | 3 | 10-03-2011 10:37 AM |
| Median indicator ? | SARdynamite | Indicator Development | 10 | 11-05-2010 09:06 AM |
| Calculating the median of 4 values | poseidon_sthlm | General Programming | 3 | 11-12-2009 06:50 AM |