Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
How to override Stoploss generated by a strategy in Superdom
Hi everyone, I have created a strategy which sets my stop automatically (using setstoploss). I want to be able to change my stop manually in superdom while the strategy is still running. The problem is whenever I change my stop in superdom manually, my stop will automatically change back to the level defined in setstoploss() in the strategy.
I understand that instead of using iorder related procedures (such as enterlonglimit), I can use AtmStrategyCreate() which will allow me to change my stop or profit target manually in superdom. But my strategy requires iorder functions.
Is there a way which I can manually change my stop and override setstoploss() in a strategy while it is still running?
Thanks in advance.
Can you help answer these questions from other members on NexusFi?
I have been working on this recently, and can post some examples next week when I get back from vacation. What you need to do, is monitor the stop and target orders as they change state. As the state changes to pending change, you can capture the new stop/limit price and store it in a var, and then use that var to set your new stop/target on the next tick in OnBarUpdate().
Thanks aslan, I figured that out as well after i posted, i have also added a discretionary button to the chart so that i can switch to "manual mode". Will post an example soon.
by the way, this forum is far better than ninja support forum!
This is the "standard answer" i've got from them ---- "puppeye, unfortunately not - to be able to manage strategy generated orders manually on ChartTrader and the DOM's you would need need work with calling ATM templates for exit management."
Isn't that hilarious, not. They don't even know how to use their own platform. I started working on this for similar reasons that you did. In the past I used ATM strategies live because I could manage them from the DOM, but that has a major disadvantage in that you can not back test with ATM. I had searched the forums, and I found nothing. So, I started working on a generic strategy that was like the ATM strategy. The one useful thing I found in the forum recently was a nice example to add a button to the toolbar, which you can use to set a var to enable/disable the strategy on the fly or to flatten a position.
This behavior is because you continuously make a call to setstoploss, you can add some bool to the initial statement just to ensure your code only manipulate the stop once, then afterward you can manipulate manual.
Maybe similar to this:
if( your condition && !Breakeven)
{
set your stop in here
Breakeven = true;
}
Attached is an example which I have created to allow you to manually change the stop controlled by a strategy. You will see that I have also added a button to the chart to switch between "auto mode" and "manual mode".