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)
Sorry I was not able to reply sooner. Been working for a living and doing some unsociable hours Thanks for your reply and suggestion. I am not too sure how to do this, as my NTScript/C# skills are limited to just nicking snippets of codes here and there and trial and error If you do have the time to come up with a sample code to do what you have suggested above, I would be most grateful. If you can't, no problem, I am still very grateful for your assistance so far.
I have basic C# skills, just enough to be dangerous. But I'll point you in the right direction.
This code should remove all the user drawn horizontal lines if the instrument changes. I haven't tried to run it or compile it and it might be all horribly wrong so good luck.
Thanks for the reply. I have tried your code above, but it didn't seem to work. I am switching instruments via Market Analyser, if that makes any difference. Thanks
Dan
Thanks for the reply. I have tried your code above, but it didn't seem to work. I am switching instruments via Market Analyser, if that makes any difference. Thanks
Dan
I just realised that when I change instruments on my charts NT does not carry over any drawing objects from the previous instrument to the new instrument. So if I have a marker in EURUSD and I switch to AUDUSD that marker will go away automatically. So I don't know how come your horizontal line objects are persisting even after you have changed instruments on the chart.
I just realised that when I change instruments on my charts NT does not carry over any drawing objects from the previous instrument to the new instrument. So if I have a marker in EURUSD and I switch to AUDUSD that marker will go away automatically. So I don't know how come your horizontal line objects are persisting even after you have changed instruments on the chart.
Hi Traderji
Thanks for your reply. Below is my code. The only thing I have added is your suggested code for getting the price under protected override void OnStartUp(). Basically, my code without your suggested code does not seem to have this problem, so not sure what the problem might be. I am using NT version 7.0.1000.8
Anyway, I am still grateful for your code and assistance, and I will just have to live with having to manually remove the horizontal lines anytime I change instruments, if I can't come up with a solution.
Ok, I think it's probably to do with with calculations in my formula, as even when I manually remove the horizontal lines, same thing happens. I think it's to do with my price value defaulting to 0, if the price range of the new instrument is not within the price range of the last instrument on the chart when the horizontal line was drawn and from which the price value got.
Ok, I think it's probably to do with with calculations in my formula, as even when I manually remove the horizontal lines, same thing happens. I think it's to do with my price value defaulting to 0, if the price range of the new instrument is not within the price range of the last instrument on the chart when the horizontal line was drawn and from which the price value got.
Cheers
Dan
quite easy to fix. Move my code to OnBarUpdate instead of OnStartUp. Also add something to the horizontallines you are drawing in your calculation code so that it does not grab yvalues from those. For example
Thank you for your response, time and efforts, I am most grateful. I tried your suggestion above (first code below), but it didn't seem to make any difference. So working on my theory that the cause is probably due to the price value defaulting to zero when I change instruments, and getting some ideas from your previous codes, I came up with the following code (second code below), and it seems to work.