X

## Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com

 NinjaTrader Support Forum Why not get the same result?

 Indicator Development Support for the development of custom indicators using NinjaScript.

 10-06-2009, 09:45 AM #1 pequemec Junior Member   Join Date: Apr 2009 Location: Elche, Spain Posts: 10 Thanks: 0 Thanked 0 times in 0 posts Why not get the same result? Hi in my first post My code is: if (Close[0] > Close[1] && Close[1] > Close[2] && Close[2] > Close[3]) Tradicional.Set(1); else Tradicional.Set(-1); Compared with: if (CurrentBar < Period) return; for (int i = 0; i < Period; i++) { if (Close[i] > Close[i+1]) Iterativos.Set(1); else Iterativos.Set(-1); } I do not get the same results. TIA. Best regards.
 10-06-2009, 09:51 AM #2 NinjaTrader_Josh NinjaTrader Product Manager     Join Date: May 2007 Location: Denver, CO Posts: 17,458 Thanks: 1 Thanked 107 times in 70 posts pequemec, If you could describe what you see differently between the two then we could be able to help you understand why it would be different. Thank you. Josh NinjaTrader Customer Service Use Kinetick, NinjaTrader’s preferred market data service - Learn More Free online training events - View Schedule
10-06-2009, 02:22 PM   #3
pequemec
Junior Member

Join Date: Apr 2009
Location: Elche, Spain
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts

The plot obtained is different. Why? View image.
Attached Images
 result1.png (39.3 KB, 8 views) result2.png (48.7 KB, 9 views)

 10-06-2009, 02:37 PM #4 NinjaTrader_Josh NinjaTrader Product Manager     Join Date: May 2007 Location: Denver, CO Posts: 17,458 Thanks: 1 Thanked 107 times in 70 posts The logic in the two are fundamentally different. In the first case, you require all 4 closes to be the greater than the previous close at the exact same time. In the second case, what you ultimately set your plot to only depends on the last run through of your for loop. You just override old settings with each new loop through instead of assuring that all 4 closes are > than previous simultaneously. Josh NinjaTrader Customer Service Use Kinetick, NinjaTrader’s preferred market data service - Learn More Free online training events - View Schedule
 10-06-2009, 04:56 PM #5 pequemec Junior Member   Join Date: Apr 2009 Location: Elche, Spain Posts: 10 Thanks: 0 Thanked 0 times in 0 posts Correct, but the question is: Can represent case 1 with a similar logic to the case 2? What would be the logic using looping commands? Thank you.
 10-07-2009, 07:08 AM #6 NinjaTrader_Josh NinjaTrader Product Manager     Join Date: May 2007 Location: Denver, CO Posts: 17,458 Thanks: 1 Thanked 107 times in 70 posts You would need to keep track of each state during the loop and only at the end can you set the plot. Josh NinjaTrader Customer Service Use Kinetick, NinjaTrader’s preferred market data service - Learn More Free online training events - View Schedule

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home News and Announcements     News and Announcements Application Technical Support     ATM Strategies (Discretionary Trading)     Automated Trading     Charting     Connecting     Installation and Licensing     Market Analyzer     Miscellaneous Support         Historical Version 7 Beta Threads             Critical Information - Please review             Version 7 Beta General Questions & Bug Reports         Historical NinjaTrader 6.5 Archive             Historical NinjaTrader 6.5 Beta Threads     Strategy Analyzer     SuperDOM and other Order Entry Windows NinjaScript Development Support     General Programming     Indicator Development     Strategy Development NinjaScript Educational Resources     Reference Samples     Tips NinjaScript File Sharing     NinjaScript File Sharing Discussion     Version 7 Indicators     Version 7 Strategies     Version 7 Miscellaneous Suggestions and Feedback     Suggestions And Feedback

 Similar Threads Thread Thread Starter Forum Replies Last Post Jim W. Suggestions And Feedback 6 11-29-2010 06:11 AM ninjaq Strategy Development 5 03-25-2009 10:53 AM chuckt101 Strategy Development 1 02-10-2009 12:05 AM adelvalle General Programming 2 12-04-2008 11:01 PM JonesWooHoo Automated Trading 4 10-21-2007 03:15 AM

All times are GMT -6. The time now is 05:24 PM.

 -- Fixed Width ---- Fluid Width NinjaTrader Support Forum - Archive - Top