Plot close of stock when SlowK crosses over SlowD


Category:
0
0

Hello, I need a study that plots the closing price of the stock when the SlowK indicator crosses above the SlowD on the StochasticSlow indicator.

Here is what I have so far:

def KoverDcross = StochasticSlow().”SlowK” crosses above StochasticSlow().”SlowD”;

 

I am having trouble plotting the close price of the stock on the day of the crossover. Thank you!

Marked as spam
Posted by (Questions: 34, Answers: 56)
Asked on August 18, 2017 7:24 pm
104 views
0
Private answer

Well this one leaves an awful lot to the imagination. You want to plot the close that coincides with the Stochastic cross. Do you wan’t to plot the close only on the bar where the Stochastic cross occurs?

def KoverDcross = StochasticSlow().”SlowK” crosses above StochasticSlow().”SlowD”;
plot theClose = if KoverDcross then close else Double.Nan;

Or did you want to capture that closing value and carry it forward until the next cross occurs?

def KoverDcross = StochasticSlow().”SlowK” crosses above StochasticSlow().”SlowD”;
rec signal = if KoverDcross then close else signal[1];
plot theClose = signal;

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on August 18, 2017 9:03 pm