• API
• FAQ
• Tools
• Archive
SHARE
TWEET # Untitled selnomeria   Aug 6th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. def price = close;
2. def superfast_length = 9;
3. def fast_length = 14;
4. def slow_length = 21;
5. def displace = 0;
6.
7. def mov_avg9 = ExpAverage(price[-displace], superfast_length);
8. def mov_avg14 = ExpAverage(price[-displace], fast_length);
9. def mov_avg21 = ExpAverage(price[-displace], slow_length);
10.
11. #moving averages
12. def Superfast = mov_avg9;
13. def Fast = mov_avg14;
14. def Slow = mov_avg21;
15.
16. def buy = mov_avg9 > mov_avg14 and mov_avg14 > mov_avg21 and low > mov_avg9;
17. def stopbuy = mov_avg9 <= mov_avg14;
20.
23.
24. def sell = mov_avg9 < mov_avg14 and mov_avg14 < mov_avg21 and high < mov_avg9;
25. def stopsell = mov_avg9 >= mov_avg14;
26. def sellnow = !sell and sell;
27. def sellsignal = CompoundValue(1, if sellnow and !stopsell then 1 else if sellsignal == 1 and stopsell then 0 else sellsignal, 0);
28. def Sell_Signal = sellsignal == 0 and sellsignal;
29.
30. input method = {default average, high_low};
31. def bubbleoffset = .0005;
32. def percentamount = .01;
33. def revAmount = .05;
34. def atrreversal = 2.5;
35. def atrlength = 5;
36. def pricehigh = high;
37. def pricelow = low;
38. def averagelength = 9;
39. def averagetype = AverageType.EXPONENTIAL;
40. def mah = MovingAverage(averagetype, pricehigh, averagelength);
41. def mal = MovingAverage(averagetype, pricelow, averagelength);
42. def priceh = if method == method.high_low then pricehigh else mah;
43. def pricel = if method == method.high_low then pricelow else mal;
44. def EI = ZigZagHighLow("price h" = priceh, "price l" = pricel, "percentage reversal" = percentamount, "absolute reversal" = revAmount, "atr length" = atrlength, "atr reversal" = atrreversal);
45. rec EISave = if !IsNaN(EI) then EI else GetValue(EISave, 1);
46. def chg = (if EISave == priceh then priceh else pricel) - GetValue(EISave, 1);
47. def isUp = chg >= 0;
48. def EIL = if !IsNaN(EI) and !isUp then pricel else GetValue(EIL, 1);
49. def EIH = if !IsNaN(EI) and isUp then priceh else GetValue(EIH, 1);
50. def dir = CompoundValue(1, if EIL != EIL or pricel == EIL and pricel == EISave then 1 else if EIH != EIH or priceh == EIH and priceh == EISave then -1 else dir, 0);
51. def signal = CompoundValue(1, if dir > 0 and pricel > EIL then if signal <= 0 then 1 else signal else if dir < 0 and priceh < EIH then if signal >= 0 then -1 else signal else signal, 0);
52.
53. def bullish2 = signal > 0 and signal <= 0;
54. plot upArrow = bullish2;
55. upArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
56. upArrow.SetDefaultColor(Color.LIGHT_GRAY);
57.
58. def bearish2 = signal < 0 and signal >= 0;
59. plot downArrow = bearish2;
60. downArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
61. downArrow.SetDefaultColor(Color.LIGHT_GRAY);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top