NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

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

Reply
 
Thread Tools Display Modes
Old 11-09-2011, 10:43 PM   #1
dirygoatee
Junior Member
 
Join Date: Nov 2011
Posts: 14
Thanks: 1
Thanked 0 times in 0 posts
Default Basic Or Statement?

I'm trying to test a strategy that exits at close by either an RSI level or a certain amount of days. However, I can't get it to work were the exit by days is working. I have tried if else statements and || seperators along with DaysSinceEntry statements? I know this sounds completely stupid but I can't find how to use or statements in the strategy creator. Any insight as to what I am doing wrong? I am only using yahoo free data. I thought the below would work....Please note I have no programming experience.



// Condition set 2
if (RSI(4, 0).Avg[0] > 55 || BarsSinceEntry[0] > 5)
{
ExitLongLimit(Close[
0], "", "");



// Condition set 2
if (RSI(4, 0).Avg[0] > 55)
else if (BarsSinceEntry() >5)
{
ExitLongLimit(Close[
0], "", "");


dirygoatee is offline  
Reply With Quote
Old 11-10-2011, 02:51 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

dirygoatee, first thing you would want to do is changing the Exit limit order to for example a market order, this way you can easily test if the issue is the condition you created or getting the resulting order to fill.

So first exit condition you list here works for you?

What is the signal name of your entry order?
NinjaTrader_Bertrand is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

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 Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Switch or else statement help skikg General Programming 2 06-01-2011 01:05 AM
If statement as variable shaihulud Indicator Development 2 12-05-2010 01:16 PM
Help with IF Statement Taddypole Indicator Development 2 04-25-2010 07:54 AM
if statement velocity General Programming 3 02-20-2009 08:12 AM
Goto statement? Burga1 General Programming 3 12-28-2007 09:37 AM


All times are GMT -6. The time now is 08:21 PM.