Persons Pivots Same Day Crossover Study


Category:
0
0

Hello Pete,

Creating a study that gives signals from crossing Persons Pivots levels has been plaguing me the past few days. Although it can create good signals, the pivot levels change from day to day creating false signals. I am looking to create signals from price crossing multiple levels of the Persons Pivots in the same trading day. Hopefully you can assist.

Thanks,

Branson

Attachments:
Marked as spam
Posted by (Questions: 4, Answers: 5)
Asked on January 5, 2019 3:13 pm
242 views
0
Private answer

Well, if you provide some details we may be able to get something working for you. But based on what you have given us so far: “I am looking to create signals from price crossing multiple levels of the Persons Pivots in the same trading day”…. we don’t have all the details.

I have to read your code to get a hint of what you are trying to achieve. But trying to read someone’s intention from the code is fraught with error. So let me explain the english version of what your two signals are doing.

up signal: “current bar crossed above PP and close has crossed above SS within the last 90 bars”

down signal: “current bar crossed below PP and close has crossed below RR within the last 90 bars”

So please use the comment section immediately below this answer to provide some more details.

Update: After receiving some clarification on this request I have a solution.

In order to make this correction you will locate and delete the following two lines of code:

plot up = close crosses above pp and (close crosses above ss) within 90 bars;
plot down = close crosses below pp and (close crosses below rr) within 90 bars;

Then within the exact same section of code you will replace those deleted lines with these:

def newDay = GetDay() <> GetDay()[1];
rec hasCrossedAbovePP = if newDay and !newDay[1] then 0 else if close[1] < PP[1] and close > PP then 1 else hasCrossedAbovePP[1];
rec hasCrossedBelowPP = if newDay and !newDay[1] then 0 else if close[1] > PP[1] and close < PP then 1 else hasCrossedBelowPP[1];
def crossAboveRR = close[1] < RR[1] and close > RR;
def crossBelowSS = close[1] > SS[1] and close < SS;
plot up = hasCrossedAbovePP and crossAboveRR;
plot down = hasCrossedBelowPP and crossBelowSS;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 6, 2019 10:15 am
0
Yes, the signals you specified are correct with a few more details. Price crossing above the pp first, then crossing above the ss is the goal for the up signal and price crossing below the pp first, then crossing below the rr is the goal for the down signal. The problem I am having is that price may only cross the pp, and not the rr or ss in the same day. The next day, all 3 levels will change, either being higher or lower than price creating a false signal that price has crossed the rr or ss. Using the signals that were in my code and restricting them to only give signals when both levels have been crossed in the same day is the goal.
( at January 6, 2019 1:27 pm)
0

Thanks for clarifying. However it seems possible you have confused SS for RR. It’s a real shame you did not include a screenshot with your original question as this would have removed all doubt and made this much easier.

On the chart, RR is ABOVE the PP line and SS is BELOW PP. You have stated you want to detect price crossing above PP first, then crossing above SS, which is below PP. So what you have actually stated is that you need price to cross above PP, then cross back below it, and follow through to cross below SS, then finally cross back above SS. Did you really intend to state it his way?

( at January 7, 2019 8:37 am)
0

Yes, indeed. Sorry for the confusion.

up = price crosses ABOVE the PP and then continues to cross ABOVE the RR
down = price crosses BELOW the PP and then continues to cross BELOW the SS

( at January 7, 2019 9:18 am)
0

I have updated my answer with the code to correct the behavior of chart study.

( at January 10, 2019 4:29 pm)