![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#16 |
|
Senior Member
Join Date: Aug 2008
Posts: 238
Thanks: 20
Thanked 5 times in 5 posts
|
Ok, the print output is showing the correct information most of the time, what I would like to do is not include the inside ask so only positions 1 through to 4 if you could help me out with the syntax that would be great.
maxValue=0; maxAskSizeLevel=0; for(int i=0; i<5; i++) { if (e.MarketDepth.Ask[i].Volume > maxValue) { maxValue = e.MarketDepth.Ask[i].Volume; maxAskSizeLevel = i; |
|
|
|
|
|
#17 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,569
Thanks: 261
Thanked 1,017 times in 998 posts
|
...then you would need to do your loop from 1 to <5, so starting at the first level instead of level 0.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#18 |
|
Senior Member
Join Date: Aug 2008
Posts: 238
Thanks: 20
Thanked 5 times in 5 posts
|
I would be grateful if I could get some assistance as to why the Print() function for the code below is sending out "extra" prints 1 correct at the time and 2 not correct. Here I will give example. The code is in addition to the market depth sample.
Code:
maxValue=0;
maxAskSizeLevel=-1;
for(int i=1; i<5; i++)
{
if (e.MarketDepth.Ask[i].Volume > maxValue)
{
maxValue = e.MarketDepth.Ask[i].Volume;
maxAskSizeLevel = i;
Print("MAX Ask |" + maxValue + " | " + maxAskSizeLevel);
}
}
MAX Ask |41 | 1 Time 10:42:44 - ? MAX Ask |50 | 2 Time 10:42:44 - ? MAX Ask |89 | 3 Time 10:42:44 - Correct Output MAX Ask |41 | 1 Time 10:42:44 - ? MAX Ask |50 | 2 Time 10:42:44 - ? MAX Ask |89 | 3 Time 10:42:44 - Correct Output MAX Ask |41 | 1 Time 10:42:44 - ? MAX Ask |50 | 2 Time 10:42:44 - ? MAX Ask |89 | 3 Time 10:42:44 - Correct Output MAX Ask |41 | 1 Time 10:42:44 - ? MAX Ask |50 | 2 Time 10:42:44 - ? MAX Ask |89 | 3 Time 10:42:44 - Correct Output Regards, suprsnipes |
|
|
|
|
|
#19 | |
|
Senior Member
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,269
Thanks: 193
Thanked 332 times in 287 posts
|
It is coded exactly as you have put.
Each one is increasing ![]() Try moving your print OUTSIDE of the IF statement ![]() Quote:
|
|
|
|
|
|
The following user says thank you to sledge for this post: |
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Recalculating position size based on account size, % risked and stop loss | clivehunt | Strategy Development | 18 | 03-22-2009 11:25 AM |
| OnMarketDepth callback | CraigC | General Programming | 17 | 06-30-2008 11:34 PM |
| Bug in OnMarketDepth | maxima | Indicator Development | 2 | 05-05-2008 02:44 PM |
| OnMarketDepth details | ct | General Programming | 5 | 11-30-2007 06:01 AM |
| Play beep OnMarketDepth | MrBaffalo | Indicator Development | 4 | 11-19-2007 10:39 PM |