ClearOutputWindow() can be called selectively to clear the results of this. You can also manually clear it out using the Right Click > Clear option in the output window. If you manually clear it like this and still see output, then there is something running that's generating it.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Intrabar Logic
Collapse
X
-
There shouldn't be lag that lasts hours long. Output window is universal for all indicators and strategies, so likely there was a strategy or indicator applied somewhere else. Maybe you have something running in an inactive workspace?
ClearOutputWindow() can be called selectively to clear the results of this. You can also manually clear it out using the Right Click > Clear option in the output window. If you manually clear it like this and still see output, then there is something running that's generating it.Last edited by NinjaTrader_RyanM1; 01-03-2011, 04:40 PM.Ryan M.NinjaTrader Customer Service
-
Output windows
Thanks Ryan, I'm trying out these print commands. The problem is I cannot tell which instrument name the true/false relate as I have a few different instruments going. See output below. I have this right now and would like to put an instrument name at the top. How do I do that? Also, how do I put the strategy name in as well? Thanks.DJ
Print(Time[0]);
Print("Long first condition:\t"+(longflag));
Print("Go Long Second Condition:\t" +(longflag1));
10/2011 12:14:50 PM
Long first condition: False
Go Long Second Condition: False
1/10/2011 12:14:50 PM
Short first condition: False
Go Short Second Condition: False
1305
1/10/2011 12:14:50 PM
Long first condition: False
Go Long Second Condition: False
1/10/2011 12:14:50 PM
Short first condition: False
Go Short Second Condition: False
1305
1/10/2011 12:14:50 PM
Long first condition: False
Go Long Second Condition: False
1/10/2011 12:14:50 PM
Short first condition: False
Go Short Second Condition: False
1305
1/10/2011 12:14:50 PM
Long first condition: False
Go Long Second Condition: False
1/10/2011 12:14:50 PM
Short first condition: False
Go Short Second Condition: False
190
1/10/2011 12:14:50 PM
Long first condition: False
Go Long Second Condition: False
1/10/2011 12:14:50 PM
Short first condition: False
Go Short Second Condition: False
190
1/10/2011 12:14:50 PM
Long first condition: False
Go Long Second Condition: False
1/10/2011 12:14:50 PM
Short first condition: False
Go Short Second Condition: False
1305
1/10/2011 12:14:50 PM
Long first condition: False
Go Long Second Condition: False
1/10/2011 12:14:50 PM
Short first condition: False
Go Short Second Condition: False
1305
1/10/2011 12:14:50 PM
Long first condition: False
Comment
-
You can print the values for instrument and strategy name. Please see the instrument class here for what's available.
For printing the strategy name, you can use
Print(this.ToString());
Print(Name);
this will include all the strategy parameters in the output.Ryan M.NinjaTrader Customer Service
Comment
-
Yes, please take a look at the link for instrument class for proper formatting.
Print(Instrument.MasterInstrument.Name);Ryan M.NinjaTrader Customer Service
Comment
-
Intrabar Logic Issues
Hi Ryan, please find attached some code that I have a question. Finally, I've managed to include two if then conditions which work as they should. Thanks for your help so far. However this has established another issue. Basically how I want the code to works is as follows (say for longs):
1. Action one order per bar
2. If condition one is satisfied then check condition two. Lines 116-135
3. If condition 2 is satisfied place limit order 3 ticks below the high of the last bar. Line 146
4. Cancels the order if the order is not filled on the same bar - lines 223-229
5. Reset conditions - lines 149 - 150
The problem I'm left with is that it is not processing one order per bar. For example, if this gets stopped out OR targets are met then the conditions remain active on the same bar and will then place another order. I've spent sometime playing with the bool flag logic with no luck. What I'm trying to achieve is once the order is completed on the bar (stopped out or targets met) then don't process any rules or place orders as per lines 116 to 150 until current bar is completed.
I'm stumped totally on it so any ideas on this one to help!!
Thanks
DJAttached FilesLast edited by djkiwi; 01-19-2011, 05:16 PM.
Comment
-
Hi DJ,
There is always more than one way to do thing in programming so you will have to identify what works for you. If the conditions evaluate true then the code is executed following these conditions. You have to structure it then so that conditions aren't true when you don't want it processing orders.
You will have to custom code for this, and an additional bool may work. You have to check it before your order, set to opposite direction in the same block that places your order, and then identify the conditions when you need to reset it so you can start evaluating for order placement again.
The above is only a general principle to follow when you want to code for sequences but you will first need to identify exactly what you're going for. If you don't want it submitted multiple times per bar, this could also be done by working with CurrentBar value, capturing it during order placement and using this captured value as a condition for entry. The snippet below isn't meant as a working solution, but hopefully can give you some ideas to create the sequence you want.
PseudoCode Example Below
if (conditionsforEntry && myOrderBar != CurrentBar)
//placeEntry
myOrderBar = CurrentBar;
if ( CurrentBar - myOrderBar > 0) //this resets myOrderbar to -1 after more than one bar has elapsed.
myOrderbar = -1;Ryan M.NinjaTrader Customer Service
Comment
-
Code Update
Thanks Ryan. That makes sense I think. That's an interesting idea to change the myorderbar to -1, never even crossed my mind. Ok, so here I am as per your suggestion with my lines:
if (conditionsforEntry && myOrderBar != CurrentBar) - Line 120 and Line 134
//placeEntry
myOrderBar = CurrentBar; - Line 141
if ( CurrentBar - myOrderBar > 0) - Line 145
myOrderbar = -1; - Line 146
So the questions are:
1. I put the first test in both long conditions - line 120 and line 134. Is this correct? Neither option seems to solve the issue.
2. I assume the reset happens after the ATM startegy has actioned. Plese see Lines 145 & 146.
The thing is I put all of the code in and it basically ignored everything that was included and kept processing the next order on the same bar. I'd be grateful on some guidance on the order of my code. I've tried various iterations.
Thanks
DJAttached Files
Comment
-
Hi DJ,
Unfortunately there isn't much additional support I can offer here. Your implementation matches what I was thinking for this. You're checking that orderBarL != CurrentBar and then assigning its value to CurrentBar in the same block that places the ATM order. It then shouldn't be executing that block of code until the value is reset.
It's possible my suggestion wasn't related to the problem you're having so you will have to play with it so you can identify why it's placing multiple orders. If it's not that block of code, what else is causing it? Use print statements to track the flow of your code and TraceOrders output to track order submission.
If you're looking for professional coding assistance, please consider a NinjaScript consultant for this:
Ryan M.NinjaTrader Customer Service
Comment
-
Intrabar/region variables
Hi Ryan, thanks I will hunt around some more and maybe post this on some other thread that is relevant. I think I am close on it. In the interim I was hoping you could me with an annoying issue. Here is the scenario:
1. 3 strategies are being loaded on the charts of 4 different instruments using 10 range bars.
2. On arming each strat on each chart I insert about 20 different inputs into the region variables for each of the 4 different instruments - using public int in the code.
Issues:
1. If I remove the strategies from the chart then add them back in I lose all of the region variables for each instrument and have to put them in each time which is time consuming.
2. Also, if I go from sim to market replay it forces me to delete the strategy and then put it back in otherwise when I set enable strategy to true it automatically resets to false.
Wishlist:
Is it possible to set it up so that in the strategy code I can tell it to set the region variables for each instrument separately in the program. For example, say it had a private int for setting volume, it would be:
private int volume1 = 10000; (and I set on the chart for each instrument) would become something like the following in the program:
private int CL-03 volume1 = 10000;
private int NQ-03 volume1 = 20000;
private int TF-03 volume1 = 5000;
Any ideas on this one?
Thanks
DJ
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
612 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
355 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
561 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
564 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment