Converting ParabolicSARCrossover Study into Strategy


Category:
0
0

I have tried to code PSAR_LE and PSAR_SE based on the ParabolicSARCrossover Study. However, when it plots on the chart, the entire chart data gets compressed. Can you provide the sample code for such a strategy. The ParabolicSARCrossover Code is as follows:

input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
input crossingType = {default Bearish, Bullish};

def sar = ParabolicSAR(accelerationFactor=accelerationFactor, accelerationLimit=accelerationLimit);

plot signal = crosses(sar, close, CrossingType == CrossingType.Bearish);

signal.DefineColor(“Bullish”, GetColor(5));
signal.DefineColor(“Bearish”, GetColor(6));
signal.AssignValueColor(if crossingType == CrossingType.Bullish then signal.color(“Bullish”) else signal.color(“Bearish”));

signal.SetPaintingStrategy(if crossingType == CrossingType.bullish
then PaintingStrategy.BOOLEAN_ARROW_UP
else PaintingStrategy.BOOLEAN_ARROW_DOWN);

How to convert it into a SE and LE strategy?

Marked as spam
Posted by (Questions: 6, Answers: 1)
Asked on January 13, 2020 10:42 pm
135 views
0
Private answer

I believe you will find this question has already been asked and answered:

https://www.hahn-tech.com/ans/parablic-sar-signal-not-firing-in-tos-strategy/

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on January 14, 2020 6:32 pm