Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Automated Strategy Re-Activation
Collapse
X
-
Automated Strategy Re-Activation
HI. Can anyone tell me.....suggest... the code required to keep an automated script running, throughout the active session ? I have simply...EnterLong () ( reverse for short ) at the end of the code...this works for the first entry, but then the strategy is de-activated and sits idle for the rest of the session. All suggestions appreciated. -
Hi lincor, welcome to our forums : that would depend on your conditions for a new entry, if a new entry point in the session is given the strategy would be able to react. Do you allow entries only when flat? Do you work with IOrder objects in your code? If you have a snippet of what you're doing that would be helpful.
-
Hi Bertrand. Thank you for the prompt reply. Not sure a snippet would assist. It is just very simple code, nothing fancy, just getting up to speed with it all. For example, a few lines of conditions, then open curley bracket EnterLong (); close curley bracket. Not using IOrder objects, and yes, within NT settings, enter only when flat. My flawed understanding is that because CalculateOnBarClose = true;...the OnBarUpdate() would make the script available again after a trade. Another observation is that even if you are trading manually ( manual entry) but have the script running over a chart ( say, drawing a diamond dot ), when the target is reached, the script will drop off and have to be re-applied. I can send you a snippet if required, but as I say, it is very simple code at this point. Thanks Bertrand.
Comment
-
Hi lincor, correct - if you trade manually and then use the 'Close' button for example on DOM / ChartTrader the active script would be disabled as part of the close routine triggered internally. To reactivate you would need to reenable it. If this has not happend in your case, then only an order rejection could deactivate the script automatically (realtime error handling - http://www.ninjatrader.com/support/h...orhandling.htm)
If the script only takes the first long, but does not reverse - are you sure the EnterShort() conditions you have coded in are happening, so evaluating to triggering the order you expect?
Easiest to check would be by adding Print statements into your code to better understand what is happening - http://www.ninjatrader.com/support/f...ead.php?t=3418
Comment
-
I guess the question is Bertrand....is there any special code necessary, apart from EnterLong (); or EnterShort (); at the end of a piece of code, that compiles correctly ( so all brackets are accounted for )....that allows an automated script to re-engage, once the first trade has completed...in an automated fashion ? Like is there...'resume trading' or the like ?
Comment
-
Yes Bertrand, all works well in backtest, I can draw dots / diamonds etc, all of that part is fine and everything is where I expect it to be. So OK, no special 'resume trading' code required. I will look further into it then and get back to you, at least I know now that the code is complete, thank you. Be in touch...lincor
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
649 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 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
573 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
576 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment