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)
If close>close[1] then buy this bar at close;
{Target & Stop Exits go here}
now, I have seen that you can have something like
setprofittarget(300)
and
setstoploss(100)
and while this will get you out when you have made 300 or lost 100, this is NOT what I want.
I want to be able to give it a price value.
For example, you enter at the close and the price you paid is 20.50, and you want to get out at 25.50
How do I tell it to get me when the last is 25.50? I do not want to tell it to get me out at 5.00 because that price target can change.
sptrader's suggestion will work on all bars as long as MarketPosition = 1 - the order won't get cancelled at the end of the next bar.
You can also use the build in profit target and stop loss from your first post, but instead of using fixed values you can change them according to the price you want to exit at.
Look into the reserved word SetStopShare and then you can just use the difference between your entry and exit in dollars as the value for the target.
So this is what I have. The script enters a position, but It does NOT exit my position at next bar as I have told it to do.
it should know that I have a marketposition of 1 since I can visually see an entry on the chart.
What is going on? Why isn't it getting me out?
The way it's written, I think it will exit at the close of the next bar... if you want it to exit at the 1st tick of the next bar instead of waiting until the close, you need to use something like: IntrabarOrderGeneration = true; at the beginning of your code.
That's what it's called in Multicharts, I think there is an Easylanguage equivalent, if not the same...
When I've used this exact code on my chart on multicharts, it creates an entry, but it doesn't create an exit. It only shows the long entry. It doesn't even get me out at next bar.
this is to be expected from the way you wrote your code. Your exit check is within the MarketPosition = 0 check, so the condition can never become true.