![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Nov 2011
Posts: 14
Thanks: 1
Thanked 0 times in 0 posts
|
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], "", ""); |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
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?
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |