I'm trying to create a script on NT8, that could automaticly trail a stop, without being a strategy, but there is not a lot of threads and answers about this subject, and its pretty annoying to have to wait over 8 hours in front of a screen sometimes, to just press 2 buttons to trail, so i would really aprecciate some help

I'm sure its a little bit more tricky than an atm strategy trail stop, but i'm sure there is tallented peoples that can figure it out ! So here's the idea :
Having a script, that can detect if an alert on a chart is declenched (the script know which alert to look for, because the script will only accept an alert with a specific name). Then, the script will look if there is a stop created by an atm strategy, or a limit stop order. (only if the orders are created in the account the script care about, and the account where he will start to adjust the order, like explained below, we can take an Sim101 account for example).
If there is one (stop order), it will start to adjust automaticly the order (with the change option in the account class maybe ?), to the value of the plot of an indicator (indicator calculate on a certain type of chart), but with an offset of +1 (or -1 if long); (the indicator is just a little thing, that create a dot if the bar on the chart is up or down, to have a trail stop value, to be enable to when; (that's how i actually proceed) i see that the target is hit, i attach the stop to the indicator (actually there is a version for short, and one for long, to have only the type of dot that i need), with an offset of +1 or -1, to trail the position).
Then, after the first time the order is adjusted (adjusted right after that the alert got declenched and the script see it), the script will wait for every bar close, to see if the value of the plot is different, if yes, it will re-adjust the order to the value of the plot, with an offset of +1 or -1 (i thought, that it would be easier to create 2 versions of the script, one for the shorts, and one for the longs).
The script will keep adjusting the order, until the order is filled, and when the script see that the order is cancelled, or filled (that the order dont exist anymore), the script is going to stop.
That's the idea, but there is not a lot of info about making script on NT7 (if it was possible on nt7, i dont know) or NT8, so if anyone have thoughts or ideas on how this can be possible (i created this way of how the script could work, because from what i read, its a way of making the thing that can work on NT8, but i dont know how to program this
).Here's some link of the NT8 helpguides that are really related to making this script work : (https://ninjatrader.com/support/help...rderupdate.htm and https://ninjatrader.com/support/help...us/?change.htm ).
Also, if you think this is not possible to do, first it would be sad, but second, do you think, it would be possible to make the same thing with a strategy and not a script, but having the possibilitie to make the entry for the strategy manually (like if the automated strategy was an atm strategy), i have tried on NT7, without success, maybe its possible on NT8 ?
Thanks a lot for reading all this topic, and a huge thanks if you can help on this problem !
Have a great day !

Comment