NexusFi: Find Your Edge


Home Menu

 





Possible to relocate a stoploss after position open?


Discussion in MultiCharts

Updated
    1. trending_up 1,878 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 8 posts
    2. attach_file 0 attachments




 
Search this Thread

Possible to relocate a stoploss after position open?

  #1 (permalink)
 Speculationist 
Calgary, Alberta/Canada
 
Experience: Advanced
Platform: Tradestation, Multicharts
Broker: IB, AMP
Trading: Stocks, ES, NQ
Posts: 6 since Sep 2012
Thanks Given: 2
Thanks Received: 0

Need a little help. I've been working on this for a couple of days now with no success.

I like using Risk/Reward multiples for money management...
For example, go long at 10 with a stop at 9 the Risk/Reward amount would be 1.
Should the price reach 11 I would like my new stop to be 10..
Should the price reach 12 I would like my new stop to be 11 and so on...

I have coded this up a number of ways in Multicharts, and the limiting factor seems to always be the sell "next bar" at ... The stop isn't always hit during the next bar, it can be any number of bars later.

The only way I can come up with to make this work is to change the setstoploss function as price progresses, but I have not been able to do this.

Any suggestions would be great

Thanks in advance.

Jeff

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
What broker to use for trading palladium futures
Commodities
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
 
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

Jeff,

what exactly is the problem you are running into? What if the stop is not hit next bar, what happens?

Regards,
ABCTG


Speculationist View Post
Need a little help. I've been working on this for a couple of days now with no success.

I like using Risk/Reward multiples for money management...
For example, go long at 10 with a stop at 9 the Risk/Reward amount would be 1.
Should the price reach 11 I would like my new stop to be 10..
Should the price reach 12 I would like my new stop to be 11 and so on...

I have coded this up a number of ways in Multicharts, and the limiting factor seems to always be the sell "next bar" at ... The stop isn't always hit during the next bar, it can be any number of bars later.

The only way I can come up with to make this work is to change the setstoploss function as price progresses, but I have not been able to do this.

Any suggestions would be great

Thanks in advance.

Jeff


Follow me on Twitter Reply With Quote
  #3 (permalink)
 NW27 
Newcastle, Australia
 
Experience: Intermediate
Platform: Multicharts 8 - Full Version
Broker: IB
Trading: SPI,FTSE100, 6E, 6A
Posts: 285 since Oct 2010
Thanks Given: 108
Thanks Received: 188


Go to the multicharts download area and look for "NWT Exits"
This will do what you want and 500% more.
If your brave, have a look at the code

Sent from my SM-N9005 using Tapatalk

Reply With Quote
Thanked by:
  #4 (permalink)
 Speculationist 
Calgary, Alberta/Canada
 
Experience: Advanced
Platform: Tradestation, Multicharts
Broker: IB, AMP
Trading: Stocks, ES, NQ
Posts: 6 since Sep 2012
Thanks Given: 2
Thanks Received: 0

Thanks for the responses so far.

ABCGT.... if the stop is not hit the next bar, it will ignore the new stop placement, and revert to the original setstoploss and settarget functions.

NW27..... I have downloaded "NWT Exits" and had a good look through the code, actually for inspiration for what I'm trying to do, and from what I was able to tell it didn't do what I'm trying to do. But I will have another hard look at it tonight and see what there is to see.

Regards,
Jeff

Started this thread Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

Jeff,

you could prevent it from doing so by using a flag for example that blocks the code from resetting the stop to the original values when you have moved it.

Regards,
ABCTG


Speculationist View Post
ABCGT.... if the stop is not hit the next bar, it will ignore the new stop placement, and revert to the original setstoploss and settarget functions.


Follow me on Twitter Reply With Quote
  #6 (permalink)
 Speculationist 
Calgary, Alberta/Canada
 
Experience: Advanced
Platform: Tradestation, Multicharts
Broker: IB, AMP
Trading: Stocks, ES, NQ
Posts: 6 since Sep 2012
Thanks Given: 2
Thanks Received: 0


ABCTG View Post
Jeff,

you could prevent it from doing so by using a flag for example that blocks the code from resetting the stop to the original values when you have moved it.

Regards,
ABCTG

I'm not familiar with flags, what would something like that look like?
Basically all I'm after is the ability to move my stop as the close of a bar reaches a new price level then have it stay there until it is hit or moved once again. It sounds simple enough don't you think?

Jeff

Started this thread Reply With Quote
  #7 (permalink)
 Speculationist 
Calgary, Alberta/Canada
 
Experience: Advanced
Platform: Tradestation, Multicharts
Broker: IB, AMP
Trading: Stocks, ES, NQ
Posts: 6 since Sep 2012
Thanks Given: 2
Thanks Received: 0

Hey Guys

Thanks for your suggestions.
I finally cracked it.
Instead of using "If C > " blah blah blah, I used "If Highest( C , Barssinceentry_checked( 0 ) ) >" blah blah blah.
That way it is continually checking back to the entry candle the highest close on every bar, and then the sell at next bar stop is not a problem.

Thanks again.

Jeff

Started this thread Reply With Quote
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

Speculationist,

I am glad to hear that you got it working. A flag can be something simple like a boolean variable that you set to true when your condition is met. Something like this, which is just a very basic example and is not meant to be used:

 
Code
if HaveFirstStop = false and MarketPosition > 0 then //HaveFirstStop would be the flag
begin
    HaveFirstStop = true;
    StopValue = EntryPrice - 10;
end;

//update the stop when the bar is rising
if HaveFirstStop and Close > Open and MarketPosition > 0 then
   StopValue = Open - 1;
end;
You could set the flag to false again when you are flat. This way the code can only set the initial stop once at the beginning of the position and after that only updates would be possible.

Regards,
ABCTG


Speculationist View Post
I'm not familiar with flags, what would something like that look like?
Basically all I'm after is the ability to move my stop as the close of a bar reaches a new price level then have it stay there until it is hit or moved once again. It sounds simple enough don't you think?

Jeff


Follow me on Twitter Reply With Quote
  #9 (permalink)
 Speculationist 
Calgary, Alberta/Canada
 
Experience: Advanced
Platform: Tradestation, Multicharts
Broker: IB, AMP
Trading: Stocks, ES, NQ
Posts: 6 since Sep 2012
Thanks Given: 2
Thanks Received: 0


ABCTG View Post
Speculationist,

I am glad to hear that you got it working. A flag can be something simple like a boolean variable that you set to true when your condition is met. Something like this, which is just a very basic example and is not meant to be used:

 
Code
if HaveFirstStop = false and MarketPosition > 0 then //HaveFirstStop would be the flag
begin
    HaveFirstStop = true;
    StopValue = EntryPrice - 10;
end;

//update the stop when the bar is rising
if HaveFirstStop and Close > Open and MarketPosition > 0 then
   StopValue = Open - 1;
end;
You could set the flag to false again when you are flat. This way the code can only set the initial stop once at the beginning of the position and after that only updates would be possible.

Regards,
ABCTG



This looks interesting. I will definitely play around with it. Might be simpler to implement into a strategy than what I cam up with too. Thanks

Jeff

Started this thread Reply With Quote




Last Updated on May 8, 2014


© 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