igoooor

Cowabunga V2 Alert Trigger

51 0 3
Refer to http://forums.babypips.com/free-forex-trading-systems/572-cowabunga-system-mt4-indicator-post30491.html#post30491

This is the translation from mql4 files, credits goes to original poster
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title="Cowabunga V2 Alert Trigger", shorttitle="CowabungaV2AlertTrigger", precision=0)
    
fastLength = input(defval=5, title="Fast MA Length", type=integer)
slowLength = input(defval=10, title="Slow MA Length", type=integer)
rsilength = input(defval=9, title="RSI Length", type=integer)
stochlength = input(defval=10, title="Stochastic Length", type=integer)
stirct4H = input(defval=true, title="Strict 4H", type=bool)
price = close

mafast15M = ema(price, fastLength)
maslow15M = ema(price, slowLength)
rsi15M = rsi(price, rsilength)
stoch15M1 = sma(stoch(close, high, low, stochlength), 3)
signal15M1 = sma(stoch15M1, 3)
stoch15M2 = stoch15M1[1]
signal15M2 = signal15M1[1]
[macdLine15M1, signalLine15M1, _] = macd(close, 12, 26, 9)
macdLine15M2 = macdLine15M1[1]
signalLine15M2 = signalLine15M1[1]

OsMA15M1 = macdLine15M1 - signalLine15M1
OsMA15M2 = macdLine15M2 - signalLine15M2

MACDChangebuy = OsMA15M2<0 and OsMA15M2<OsMA15M1
MACDChangesell = OsMA15M2>0 and OsMA15M2>OsMA15M1

mafast4H = security(tickerid, "240", mafast15M)
maslow4H = security(tickerid, "240", maslow15M)
rsi4H = security(tickerid, "240", rsi15M)
stoch4H1 = security(tickerid, "240", stoch15M1)
stoch4H2 = security(tickerid, "240", stoch15M2)
signal4H1 = security(tickerid, "240", signal15M1)
signal4H2 = security(tickerid, "240", signal15M2)

StochCHANGE4Hbuy = (stoch4H1>stoch4H2 and signal4H1>signal4H2) or (stoch4H1>signal4H1) ? 1 : 0
StochCHANGE4Hsell = (stoch4H1<stoch4H2 and signal4H1<signal4H2) or (stoch4H1<signal4H1) ? 1 : 0
StochCHANGE15Mbuy = (stoch15M1>stoch15M2 and signal15M1>signal15M2) or (stoch15M1>signal15M1 and stoch15M2<signal15M2) ? 1 : 0
StochCHANGE15Msell = (stoch15M1<stoch15M2 and signal15M1<signal15M2) or (stoch15M1<signal15M1 and stoch15M2>signal15M2) ? 1 : 0

maCrossover15M = crossover(mafast15M, maslow15M)
maAbove4H = mafast4H > maslow4H
maCrossunder15M = crossunder(mafast15M, maslow15M)
maUnder4H = mafast4H < maslow4H

trendBuyOn = stirct4H ? (maAbove4H and (rsi4H > 50) and StochCHANGE4Hbuy) : maAbove4H
trendSellOn = stirct4H ? (maUnder4H and (rsi4H < 50) and StochCHANGE4Hsell) : maUnder4H

valplot15M = (maCrossover15M and (rsi15M > 50) and StochCHANGE15Mbuy and MACDChangebuy and trendBuyOn ) ? 1 : ((maCrossunder15M and (rsi15M < 50) and StochCHANGE15Msell and MACDChangesell and trendSellOn ) ? 1 : 0)
//1 = buy, -1 = sell

plot(valplot15M, "cowabunga", color=red, linewidth=1, style=line)

Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out