Facebook
From Flying Agouti, 3 Years ago, written in Plain Text.
This paste is a reply to Re: Re: Re: 5min Chart Strategy Script from Funky Cat - view diff
Embed
Download Paste or View Raw
Hits: 131
  1. #5mins Chart Strategy
  2. #Pairs: Any
  3.  
  4. #Indicator
  5. #EMA(50) Indicator
  6. ema50 = EMA(applyTo: close, period: 50)
  7.  
  8. #EMA(100) Indicator
  9. ema100 = EMA(applyTo: close, period: 100)
  10.  
  11. #MACD and MACD signal.
  12. macd = MACD(applyTo: close, fastPeriod: 12, slowPeriod: 26)
  13. macdSignal = MACDSignal(applyTo: close, signalPeriod: 9, fastPeriod: 12, slowPeriod: 26)
  14.  
  15.  
  16. #Pips calculation, 10pips = 0.0010 in (USD/USD)
  17. pip10 = (10 * 0.01)/open
  18. pip5 = (5 * 0.01)/open
  19.  
  20. #Rule
  21. longEntryRule1 = open > (ema50 + pip10)
  22. longEntryRule2 = open > ema100
  23. longEntryRule3 = 0
  24.  
  25. series longEntryRuleMacd:
  26.   once: 0
  27.   rest: CrossesUpwards(value: macd, crosses: macdSignal)
  28.  
  29. #MACD crosses to positive within the last five bars, otherwise wait for the next
  30. longEntryRule3 = longEntryRuleMacd or longEntryRuleMacd[1] or longEntryRuleMacd[2] or longEntryRuleMacd[3] or longEntryRuleMacd[4]
  31.  
  32. #Final Long Entry Rule
  33. FinalLongEntryRule = longEntryRule1 and longEntryRule2 and longEntryRule3
  34.  
  35. #Setting initial Stop
  36. period = 5
  37. series stopLoss:
  38.   once: open
  39.   rest: open
  40. for distance from 1 to (period - 1)
  41.   if low[distance] < stopLoss update stopLoss: low[distance]
  42.  
  43.  
  44.  #Setting initial Stop
  45. period = 5
  46. series StopLoss:
  47.   once: open
  48.   rest: open
  49. for distance from 1 to (period - 1)
  50.   if low[distance] < StopLoss update StopLoss: low[distance]