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)
I am using a trailing dollar stop loss by following exponential moving average. I have modified trailing stop loss so that I can set stop loss to the ema value at the end of each bar. So only if the price hits the ema value the position is exited.
However, I noticed that the stop loss is being hit even when the ema is still far away from the lowest point. Is there an error in the way I have coded this?
But are you sure that Amount as defined in your code is expressed in $?
For sure, it is expressed in price (I mean: the price displayed on the screen).
But, except for equities (?), this is not $.
In order to obtain $, you have to multiply it with the value of a full point in $.
First, I do not pretend that my answer closes the issue. There may be other problems in your code. I am not in position to review it. Read carefully the comments made by other NexusFi (formerly BMT) members.
To implement my suggestion, just multiply Amount by the value of a full point in $.
You should know it for the instruments you trade.
Otherwise, you can use BigPointValue.
But I think it requires this field to be correctly input in QuoteManager (to be checked).