NexusFi: Find Your Edge


Home Menu

 





How to override Stoploss generated by a strategy in Superdom


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one puppeye with 5 posts (9 thanks)
    2. looks_two aslan with 2 posts (2 thanks)
    3. looks_3 Prtester with 1 posts (0 thanks)
    4. looks_4 nanobiotech with 1 posts (0 thanks)
    1. trending_up 4,343 views
    2. thumb_up 11 thanks given
    3. group 5 followers
    1. forum 9 posts
    2. attach_file 2 attachments




 
Search this Thread

How to override Stoploss generated by a strategy in Superdom

  #1 (permalink)
 
puppeye's Avatar
 puppeye 
hk
 
Experience: Beginner
Platform: ninjatrader
Posts: 56 since Aug 2009
Thanks Given: 89
Thanks Received: 445

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.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Quant vue
Trading Reviews and Vendors
How to apply profiles
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
ZombieSqueeze
Platforms and Indicators
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #3 (permalink)
 
nanobiotech's Avatar
 nanobiotech 
Brisbane, Australia
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus/Zen-Fire
Trading: CL
Posts: 670 since Jun 2009
Thanks Given: 134
Thanks Received: 430


I have wished I could do this many times, but haven't seen a way to do it yet.

Nano

Reply With Quote
  #4 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127

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().

Reply With Quote
Thanked by:
  #5 (permalink)
 
puppeye's Avatar
 puppeye 
hk
 
Experience: Beginner
Platform: ninjatrader
Posts: 56 since Aug 2009
Thanks Given: 89
Thanks Received: 445

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.

Started this thread Reply With Quote
  #6 (permalink)
 
puppeye's Avatar
 puppeye 
hk
 
Experience: Beginner
Platform: ninjatrader
Posts: 56 since Aug 2009
Thanks Given: 89
Thanks Received: 445

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."

Started this thread Reply With Quote
Thanked by:
  #7 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127


puppeye View Post
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.

Reply With Quote
  #8 (permalink)
 Prtester 
SE-Asia
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Amp
Trading: ES
Posts: 151 since Jun 2009
Thanks Given: 66
Thanks Received: 124


nanobiotech View Post
I have wished I could do this many times, but haven't seen a way to do it yet.

Nano

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;
}

Reply With Quote
  #9 (permalink)
 
puppeye's Avatar
 puppeye 
hk
 
Experience: Beginner
Platform: ninjatrader
Posts: 56 since Aug 2009
Thanks Given: 89
Thanks Received: 445

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".


Attached Files
Elite Membership required to download: ManualStop.zip
Started this thread Reply With Quote
  #10 (permalink)
 
puppeye's Avatar
 puppeye 
hk
 
Experience: Beginner
Platform: ninjatrader
Posts: 56 since Aug 2009
Thanks Given: 89
Thanks Received: 445


Prtester, even if setstoploss() is called once only, the strategy will continue to control it as long as the strategy is still running.

Started this thread Reply With Quote




Last Updated on February 27, 2010


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts