Add alert to the TOS study KST


Category:
0
0

Pete,

Could you add an audible alert for a cross of the fast and slow KST study in TOS…

Thanks….Glad your doing well…God Bless

 

declare lower;

#–Input variables

input rocLength1 = 10;

input rocLength2 = 15;

input rocLength3 = 20;

input rocLength4 = 30;

def sumRocLength = rocLength1+rocLength2+rocLength3+rocLength4;

def avgLength1 = 10;

def avgLength2 = 10;

def avgLength3 = 10;

def avgLength4 = 15;

#–Calc ROC – RateOfChange(length, color norm length, price)

def ROC1 = RateOfChange(rocLength1, rocLength1, close);

def ROC2 = RateOfChange(rocLength2, rocLength2, close);

def ROC3 = RateOfChange(rocLength3, rocLength3, close);

def ROC4 = RateOfChange(rocLength4, rocLength4, close);

#–Plot lines

plot zeroLine = 0;

plot fastKST = (Average(ROC1,avgLength1)*(rocLength1/sumRocLength))+

(Average(ROC2,avgLength2)*(rocLength2/sumRocLength))+

(Average(ROC3,avgLength3)*(rocLength3/sumRocLength))+

(Average(ROC4,avgLength4)*(rocLength4/sumRocLength));

plot slowKST = Average(fastKST,rocLength1);

#–Set Colors and Style

zeroLine.SetDefaultColor(GetColor(7));

fastKST.SetDefaultColor(GetColor(5));

fastKST.SetStyle(Curve.LONG_DASH);

slowKST.SetDefaultColor(GetColor(1));

#–End Code————————————–

Marked as spam
Posted by (Questions: 49, Answers: 42)
Asked on May 14, 2019 5:58 pm
298 views
0
Hi Pete, May i request if you can help to add the different time frames into the script. Eg Short-term Daily = KST(10,15,20,30,10,10,10,15,9) Medium-term Weekly = KST(10,13,15,20,10,13,15,20,9) Long-term Monthly = KST(9,12,18,24,6,6,6,9,9)
( at May 19, 2019 8:18 am)
0
I would need more details about these "different time frames". But I would not provide this type of solution in our Q&A forum. You are welcome to submit this as a custom project request, subject to our rates and terms. Details here: https://www.hahn-tech.com/about/
( at May 20, 2019 4:47 pm)
0
Private answer

Add these two lines at the very bottom of your existing code.

Alert(fastKST[1] < slowKST[1] and fastKST > slowKST, "Cross Above", Alert.BAR, Sound.RING);
Alert(fastKST[1] > slowKST[1] and fastKST < slowKST, "Cross Below", Alert.BAR, Sound.RING);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 16, 2019 3:50 pm