How to Set Different Colors for ParabolicSAR


Category:
0
0

Greetings,

In TOS Is there a way to have the ParabolicSAR  display different colors when plotting above and below the candles?

The settings dialogue box only allows one color.

Attachments:
RESOLVED
Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on December 12, 2021 8:57 pm
100 views
0
Private answer

This is a duplicate question but I will approve this post because you were not able to locate the previous solutions by using the search function on this forum. Here is a link to the original:

https://www.hahn-tech.com/ans/parabolicsar-set-different-colors-for-long-and-short/

But while I'm here, I guess I will provide a more robust solution than what I provided in that previous post:

input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
assert(accelerationFactor > 0, "'acceleration factor' must be positive: " + accelerationFactor);
assert(accelerationLimit >= accelerationFactor, "'acceleration limit' (" + accelerationLimit + ") must be greater than or equal to 'acceleration factor' (" + accelerationFactor + ")");
plot parSAR = ParabolicSAR(accelerationFactor, accelerationLimit).parSAR;
parSAR.SetPaintingStrategy(PaintingStrategy.POINTS);
parSAR.DefineColor("Buy", GetColor(0));
parSAR.DefineColor("Sell", GetColor(1));
parSAR.AssignValueColor(if low > parSAR then parSAR.Color("Sell") else parSAR.Color("Buy"));

 

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on December 12, 2021 9:57 pm
0
Thank-you Pete. Clean and concise.
( at December 12, 2021 11:56 pm)