NinjaTrader Support Forum Quick question on this exit

 Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

 03-09-2009, 01:13 PM #1 tortexal Member   Join Date: Dec 2008 Location: Panama! Posts: 82 Thanks: 0 Thanked 0 times in 0 posts Quick question on this exit // Condition set 1 if (Close[0] > CurrentDayOHL().CurrentOpen[0]) { EnterLong(DefaultQuantity, "Long"); } // Condition set 2 if (Close[0] < CurrentDayOHL().CurrentOpen[0]) { ExitLong(); } // Condition 3 if (High[0] >= CurrentDayOHL().CurrentOpen[0] + (CurrentDayOHL().CurrentOpen[0] * 0.05)) { ExitLong(); } conditions 1 and 2 work fine, condition 3 does not do anything. how do i calculate the target exit in this manner and have it execute? (closes the position if the current price is a 5% increase over the session open price) Thanks!
 03-09-2009, 01:43 PM #2 NinjaTrader_Josh NinjaTrader Product Manager     Join Date: May 2007 Location: Denver, CO Posts: 17,458 Thanks: 1 Thanked 106 times in 70 posts How are you determining that condition 3 is not working? Your high price needs to be >= 105% of the day's open. Please ensure such a condition does in fact evaluate to true. Say your day open was 100. Then your high needs to be >= 105. Josh NinjaTrader Customer Service Use Kinetick, NinjaTrader’s preferred market data service - Learn More Free online training events - View Schedule
 03-09-2009, 01:57 PM #3 tortexal Member   Join Date: Dec 2008 Location: Panama! Posts: 82 Thanks: 0 Thanked 0 times in 0 posts I'm running this strategy on FAS right now on my IB feed. The open was 2.53 and the high was 2.96. 2.53*1.05=2.65, or 2.53+(2.53*.05)=2.65 which should make condition 3 true either way i would assume, and should trigger the exit. condition 1 and 2 work just fine on multiple time frames, but it never exits at 2.65 or above. edit: it just exited before mkt close, so that part works too Last edited by tortexal; 03-09-2009 at 02:00 PM.
 03-09-2009, 02:00 PM #4 NinjaTrader_Josh NinjaTrader Product Manager     Join Date: May 2007 Location: Denver, CO Posts: 17,458 Thanks: 1 Thanked 106 times in 70 posts tortexal, The only way you can test this is by actually printing values. Print out the value of High[0] as well as CurrentDayOHL().CurrentOpen[0] + (CurrentDayOHL().CurrentOpen[0] * 0.05). That is the only way you can follow the code. Code: `Print(High[0] + " " + CurrentDayOHL().CurrentOpen[0] + (CurrentDayOHL().CurrentOpen[0] * 0.05));` Also, if your second condition was already evaluated to true there would be no position to close for your third condition. Ensure there is actually an open position as condition three is true. Josh NinjaTrader Customer Service Use Kinetick, NinjaTrader’s preferred market data service - Learn More Free online training events - View Schedule
 03-09-2009, 02:01 PM #5 tortexal Member   Join Date: Dec 2008 Location: Panama! Posts: 82 Thanks: 0 Thanked 0 times in 0 posts haha awesome, thanks i'll give that a shot totally got it fixed, thanks again. i was doing this all types of screwy Last edited by tortexal; 03-09-2009 at 06:46 PM.

 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 BigDog008 Strategy Development 3 01-20-2009 02:16 PM Icetech ATM Strategies (Discretionary Trading) 5 12-17-2008 03:28 PM Butterback Indicator Development 4 10-23-2008 06:24 AM twaydow Strategy Development 1 09-30-2008 10:34 AM Bogan7 Automated Trading 1 08-21-2008 01:59 AM

All times are GMT -6. The time now is 02:01 AM.

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