// these are declared in class scope. private int entryBar =0; private bool entryAllowed = false; protected override void OnBarUpdate() { if (IsFirstTickOfBar) entryBar = 0; //this resets this on entry to each bar, effectively allowing orders to be made, [I](q.v.)[/I] if (/* all your entry conditions are met */) entryAllowed = true; else entryAllowed = false; if (CurrentBar != entryBar && entryAllowed) { /*your entry order here - EnterLong(... etc) */ entryBar = CurrentBar; //this ensures that the block cannot be entered again until the entryBar variable is reset on the open of the next bar } }
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Strategy Filling 2-4 Order In Succession
Collapse
X
-
Originally posted by Sadat View Post
Code:
-
Hello Sadat,
This syntax would need to be part of a condition similar to the samples shown in the help guide. Your strategy likely has other conditions in it, you could use these items in your conditions if that would assist in refining the condition to happen less frequently. I just mentioned these items because they deal with a number of bars since an event. If you wanted to ensure the condition cannot become true again in the same bar, these are good items for that use case.
I look forward to being of further assistance.
Leave a comment:
-
Hello Jesse,
You mentioned using logic. Where would you place this logic in the strategy?
Leave a comment:
-
Hello Sadat,
If there should be no point where two or more entries/exits should happen in the same bar you could look into using the BarsSinceEntryExecution or BarsSinceExitExecution in your logic. For conditions that would be difficult to make more specific, you can always look at using logic to control that situation better.
I look forward to being of further assistance.
Leave a comment:
-
The stop is 3 ticks. I am using market replay with a strategy. The part you said about conditions being specific enough could be the problem. I tightened up my values for volume and Buysell pressure before and it seemed to decrease the orders in succession. Right now my volume values are within 50 of each other and my buysell pressure values are within three of each other. Maybe that is not tight enough. I do not want to make it too tight to the point it will not trigger
Leave a comment:
-
Hello Sadat,
This is likely due to the logic being used in combination with the strategy settings being used. It is possible that if your condition remains true after your stop is filled it will repeat the same process over and over.
Are you currently setting the stop very close to the entry price where it may be filled within the same bar? Another item would be using the strategy OnEachTick, intrabar calculations can also result in many entries per bar with a condition that is not specific enough or an order placement that is very close to the entry price.
If you are seeing this occur in playback during live playback, it is very likely that something similar may happen in realtime. Depending on what logic is being used and how specific the conditions to trade are will control this type of occurrence.
I look forward to being of further assistance.
Leave a comment:
-
Strategy Filling 2-4 Order In Succession
I am running a strategy on playback and it placed 2 orders in a row instantaneously one after the other and added extra ticks to my stop loss. It seems to happen if my stop loss is hit right after order is filled. Is there a way to stop this? Will this happen in Live trading? I'm scared.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Brevo, Today, 01:45 AM
|
0 responses
6 views
0 likes
|
Last Post
by Brevo
Today, 01:45 AM
|
||
Started by aussugardefender, Today, 01:07 AM
|
0 responses
3 views
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
242 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
384 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
||
Started by oviejo, Today, 12:28 AM
|
0 responses
6 views
0 likes
|
Last Post
by oviejo
Today, 12:28 AM
|
Leave a comment: