Paint Arrows on last 5 bars only


Category:
0
0

This is ToS script that paints Up/Down Arrows.
I want to paint only the 5 most recent Bars. Tx

# ARROWS
input showArrows = yes;
plot pUP = sState crosses above 0;
pUP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
pUP.SetDefaultColor(Color.GREEN);
pUP.SetLineWeight(2);

plot pDown = sState crosses below 0;
pDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
pDown.SetDefaultColor(Color.RED);
pDown.SetLineWeight(2);

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on December 9, 2019 6:20 am
65 views
0
Private answer

Without a full working chart study this post is of little use to the rest of our viewers. The code you posted does not plot anything in its current form.

So the only solution I have to offer is this:

def filterSignals = IsNaN(close[-5]) and !IsNaN(close);

The sole purpose of this forum is to create a searchable knowledge-base of custom solutions that serve the broadest audience possible. Not for one-off solutions that serve a single individual. If you do not wish to post your entire code then you will need to submit your question as a custom project request:

https://www.hahn-tech.com/about/

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on December 9, 2019 8:01 am