Facebook
From Jackson, 3 Years ago, written in Plain Text.
This paste is a reply to 5min Chart Strategy Script from Jackson - go back
Embed
# Indicators
#50 EMA and 100 EMA
ema50 = EMA(applyTo: close, period:50)
ema100 = EMA(applyTo: close, period:100)
#MACD and MACD signal. 
macd = MACD(
  applyTo: close,
  fastPeriod: 12,
  slowPeriod: 26
)
macdSignal = MACDSignal(
  applyTo: close,
  signalPeriod: 9,
  fastPeriod: 12,
  slowPeriod: 26
)
#Rule/Triggers, 10pips = 0.0010 in EUR/USD
#Rule/Triggers
#Pip calculation
pip10 = 10* ((1/100)/(open))
open * 1.001
pip5 = open ((1/100)/(open))
1.0005
longEntryRule = open > (ema50 + pip10)
longEntryRule2 = open > (ema100 + pip10)
series longEntryRule3:
  once: 0
  rest: CrossesUpwards(value: macd,crosses: macdSignal)
#Final Long Entry Rule
FinalLongEntryRule = longEntryRule and longEntryRule2 and ( longEntryRule3 or longEntryRule3[1] or longEntryRule3[2] or longEntryRule3[3] or longEntryRule3[4] )
#Setting initial Stop
period = 5
InitialStop = series StopLoss:
  once: open
  rest: 
open
for distance from 1 to (period - 1)
  isNewLow = if low[distance] < InitialStop
  InitialStop = low[distance] if isNewLow else InitialStop


StopLoss update StopLoss: low[distance]
# Signals
#StopRepeat is to protect Take profit and StopLoss base on open postions. 
series StopRepeat:
  once: 0
  rest: 1 if (FinalLongEntryRule and StopRepeat == 0) else StopRepeat

StopRepeat
series InitialStop:
  once: open
  rest: StopLoss if  ((FinalLongEntryRule) and StopRepeat == 1) else InitialStop
series TakeProfit:
  once: 0
  rest : ((open - InitialStop) * 2 + open) if ((FinalLongEntryRule) and StopRepeat == 1) else TakeProfit

if (open > TakeProfit or open < InitialStop) update StopRepeat: 0
if (open <= TakeProfit or open >= InitialStop) update StopRepeat: 2
#Final Long Exit Rule
FinalLongExitRule = open > TakeProfit or open < InitialStop
InitialStop or open < (ema50-pip10)
enter long when FinalLongEntryRule
exit long when FinalLongExitRule

Replies to Re: 5min Chart Strategy Script rss

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