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 -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I would suggest that you take a look at the MC help file and the explanation of SetPercentTrailing. From the code snippet I am under the impression you did not code what you have in mind. So curing the situations where entryprice(0) = 0 might not help you out.
setpercenttrailing is a macro command with 1 input parametr in dollar risk value! set up only once in any place of code!
try to use this
setstopposition;
mp=marketposition;
ep=entryprice;
if mp=1 then SetPercentTrailing( (ep* 1.1 ) );
If you're not having any luck with EntryPrice( 0 ) you could try OpenEntryPrice( 0 ) - the difference is the first references the position (i.e. a zero references the open position, whereas a 1 is the previous position), and the second references trades (i.e. a zero references the first trade in an open position, a 1 references the 2nd trade etc).
You should also look up the difference between SetStopPosition, SetStopContract and SetStopShare which should be added before your SetPercentTrailing code. Based on your code i think SetStopContract is what you're after (by default SetStopPosition is applied). Your code "entryprice(0)* 1.1" suggests a position size of 1 contract and a profit threshold of 110%.
Finally another thing I learned using SetBreakEven and SetPercentTrailing is you should not have them nested within any other code (e.g. IF ... THEN SetPercentTrailing() )