#5mins Chart Strategy
#Pairs: Any
#Indicator
#EMA(50) Indicator
ema50 = EMA(applyTo: close, period: 50)
#EMA(100) Indicator
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)
#Pips calculation, 10pips = 0.0010 in (USD/USD)
pip10 = (10 * 0.01)/open
pip5 = (5 * 0.01)/open
#Rule
longEntryRule1 = open > (ema50 + pip10)
longEntryRule2 = open > ema100
longEntryRule3 = 0
series longEntryRuleMacd:
once: 0
rest: CrossesUpwards(value: macd, crosses: macdSignal)
#MACD crosses to positive within the last five bars, otherwise wait for the next
longEntryRule3 = longEntryRuleMacd or longEntryRuleMacd[1] or longEntryRuleMacd[2] or longEntryRuleMacd[3] or longEntryRuleMacd[4]
#Final Long Entry Rule
FinalLongEntryRule = longEntryRule1 and longEntryRule2 and longEntryRule3
#Setting initial Stop
period = 5
series stopLoss:
once: open
rest: open
for distance from 1 to (period - 1)
if low[distance] < stopLoss update stopLoss: low[distance]
#Setting initial Stop
period = 5
series StopLoss:
once: open
rest: open
for distance from 1 to (period - 1)
if low[distance] < StopLoss update StopLoss: low[distance]
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}