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)
Need help with coding please...trying to add plotted shapes to a script
I'm new to Ninja and know how to write Pine and some EasyL but can't seem to figure out how to plot shapes on the price chart with Ninja. Would someone be able to help add a diamond shape to a script when MA's cross?
Can you help answer these questions from other members on NexusFi?
// Paints a red diamond on the current bar 1 tick below the low
Draw.Diamond(this, "tag1", true, 0, Low[0] - TickSize, Brushes.Red);
Drawing objects must have a unique name so with the above example you will only see the latest diamond. When the name is not unique any previously drawn diamond with that name would be removed so that only the latest version would be seen. To create unique names you can add +CurrentBar, for example: Draw.Diamond(this, "tag1"+CurrentBar, true, 0, Low[0] - TickSize, Brushes.Red); This would allow you to see every occurrence of a diamond because the bar number is added to the name tag1 to create a unique (per bar) tag name.
So generically:
if (CrossAbove (EMA(13), SMA(20), 1))
{
Draw.Diamond(this, "tag1"+CurrentBar, true, 0, Low[0] - TickSize, Brushes.Red); // Draw red diamond when crossabove is true at 1 tick below the low of the bar
}
Be yourself; everyone else is already taken. Oscar Wilde
Just an update I can't get it to work right. I downloaded a script from here to practice on, it's a moving average that changes color based on rising/falling bar values. I was able to get the red and green diamonds to plot on the chart but they plot on every bar instead of a single time when the moving average color changes. I have been scouring the internet trying to find examples of something similar but can't find anything.
Alternatively I tried to modify a 2nd indicator that has 2 moving averages in it using crossover/crossunder. The problem there is I tried every parameter and plot value I could find in the script but kept getting 'does not exist in context' errors.
I'm not giving up, but I have never used C# before. Seems the Python based languages are easier to pickup and modify for me.