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 have this Show Me code that I would like to plot only once, only the first time the conditions are met. Or if the last plot was a "Buy" plot, then the next plot can only be a "Sell" plot. So it would alternate between one plot for a sell and the next plot for a buy and then the next plot would be a sell. But I think it would be easier if the code would just plot it once the first time the conditions are met. Any help is appreciated.
Can you help answer these questions from other members on NexusFi?
I tried the following but it only plotted the first time the condition happened on the chart. I don't think I was clear. I would like it to plot every time my condition is met, but only the first bar that it is met and not every single bar.
This is where I would like it to plot but only on the bars with arrows:
you could use a boolean variable that you check together with your condition. If your conditions are met, you will set the boolean to true as well. Now you just have to reset the boolean to false again in order to allow for a new plot - when you do that depends on when you want to allow another plot again (for example after X bars, when the conditions are not fulfilled anymore or with the opposite plot etc.).
Thanks for the help. I understand in English what I need to do, but I have no idea how I should state it or where to place it in the code. I want to have only one bar with a dot and alternating dots, one for a sell and the next for a buy and the next for a sell again. This only plots once on the first occurrence on the chart.
your code correctly does the first part of "If your conditions are met, you will set the boolean to true", you just need to do the second part "reset the boolean to false again [...] with the opposite plot". This is missing in the code and that's why you just get one plot for the very first occurrence at the moment.
In other words, when you set haveBuyPlot to true, you need to set haveSellPlot to false and vice versa. This will allow a new plot the next time your conditions are fulfilled.