Facebook
From Jackson, 3 Years ago, written in Plain Text.
This paste is a reply to Untitled from Torrid Curlew - view diff
Embed
Download Paste or View Raw
Hits: 168
  1. # Indicators
  2. #50 EMA and 100 EMA
  3. ema50 = EMA(applyTo: close, period:50)
  4. ema100 = EMA(applyTo: close, period:100)
  5. #MACD and MACD signal.
  6. macd = MACD(
  7.   applyTo: close,
  8.   fastPeriod: 12,
  9.   slowPeriod: 26
  10. )
  11. macdSignal = MACDSignal(
  12.   applyTo: close,
  13.   signalPeriod: 9,
  14.   fastPeriod: 12,
  15.   slowPeriod: 26
  16. )
  17. #Rule/Triggers, 10pips = 0.0010 in EUR/USD
  18. #Pip calculation
  19. pip10 = 10* ((1/100)/(open))
  20. pip5 = 5 * ((1/100)/(open))
  21. longEntryRule = open > (ema50 + pip10)
  22. longEntryRule2 = open > (ema100 + pip10)
  23. series longEntryRule3:
  24.   once: 0
  25.   rest: CrossesUpwards(value: macd,crosses: macdSignal)
  26. #Final Long Entry Rule
  27. FinalLongEntryRule = longEntryRule and longEntryRule2 and ( longEntryRule3 or longEntryRule3[1] or longEntryRule3[2] or longEntryRule3[3] or longEntryRule3[4] )
  28. #Setting initial Stop
  29. period = 5
  30. InitialStop = open
  31. for distance from 1 to (period - 1)
  32.   isNewLow = low[distance] < InitialStop
  33.   InitialStop = low[distance] if isNewLow else InitialStop
  34.  
  35.  
  36. # Signals
  37. series StopRepeat:
  38.   once: 0
  39.   rest: 1 if (FinalLongEntryRule and StopRepeat == 0) else StopRepeat
  40.  
  41. series TakeProfit:
  42.   once: 0
  43.   rest : ((open - InitialStop) * 2 + open) if ((FinalLongEntryRule) and StopRepeat == 1) else TakeProfit
  44.  
  45. if (open > TakeProfit or open < InitialStop) update StopRepeat: 0
  46. if (open <= TakeProfit or open >= InitialStop) update StopRepeat: 2
  47. #Final Long Exit Rule
  48. FinalLongExitRule = open > TakeProfit or open < InitialStop
  49. enter long when FinalLongEntryRule
  50. exit long when FinalLongExitRule

Replies to 5min Chart Strategy Script rss

Title Name Language When
Re: 5min Chart Strategy Script Jackson text 3 Years ago.