Hello, my strategy is a basic ema cross but with Emma's stacked in the direction of the trade.
9 ema above 13 ema above 100 ema then go long, if they are all stacked on the short side, then go short.
can someone combine these 2 scripts that would then produce the arrow when the above lines up. Now the arrow and trade zone happens with a 9 and 100 cross over, it is missing the ema stacked part with the third ema.
Thank you
#
# Trade Lines
# v1.0 by @mark.917
#
# Trade Lines will plot lines with and optional cloud showing where you entered your
# position and the location of your stop loss and profit target.
#
# To use, your code will need to set "your_buy_signal" or "your_sell_signal" to true.
# The profit target and stop loss are based on an ATR multplier. You may modify this
# to be whatever you would like.
declare upper;
#######################
# YOUR CODE STARTS HERE
#######################
# sample using moving average crossover for signals
Input FastMaLength = 5;
Input SlowMaLength = 50;
def FastMA = MovingAverage(AverageType.EXPONENTIAL, close, FastMaLength);
def SlowMA = MovingAverage(AverageType.EXPONENTIAL, close, SlowMaLength);
plot fastMAPlot = FastMA;
fastMAPlot.SetDefaultColor(GetColor(1));
plot slowMAPlot = SlowMA;
slowMAPlot.SetDefaultColor(GetColor(2));
def buy_signal = FastMA crosses above SlowMA;
def sell_signal = FastMA crosses below SlowMA;
###################
# BEGIN TRADE LINES
###################
input show_trade_zone = yes;
input calc_mode = {default fixed, atr}; #hint mode: Select fixed values or atr values for target and stop levels.
input ATRTargetMultiple = 2.5;
input ATRStopMultiple = 1.5;
input FixedTarget = 1.50;
input FixedStop = .75;
def atr = ATR(14, AverageType.EXPONENTIAL);
def target;
def stop;
switch (calc_mode) {
case atr:
target = atr * ATRTargetMultiple;
stop = atr * ATRStopMultiple;
case fixed:
target = FixedTarget;
stop = FixedStop;
}
def long_signal = if buy_signal then 1 else 0;
def long_target = if long_signal == 1 then target else long_target[1];
def long_stop = if long_signal == 1 then stop else long_stop[1];
def long_entry = if long_signal == 1 then open else if (high[1] > long_entry[1] + long_target or low[1] < long_entry[1] - long_stop) then Double.NaN else long_entry[1];
def long_exit = if long_entry > 0 then 0 else 1;
plot long_pt = if show_trade_zone and !long_exit then long_entry + long_target else Double.NaN;
long_pt.SetDefaultColor(Color.GREEN);
plot long_ep = if show_trade_zone and !long_exit then long_entry else Double.NaN;
long_ep.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
long_ep.SetDefaultColor(Color.WHITE);
plot long_sl = if show_trade_zone and !long_exit then long_ep - long_stop else Double.NaN;
long_sl.SetDefaultColor(Color.RED);
#AddCloud(if show_trade_zone then long_pt else Double.NaN, long_ep, Color.GREEN);
#AddCloud(if show_trade_zone then long_sl else Double.NaN, long_ep, Color.RED);
def short_signal = if sell_signal then 1 else 0;
def short_target = if short_signal == 1 then target else short_target[1];
def short_stop = if short_signal == 1 then stop else short_stop[1];
def short_entry = if short_signal == 1 then open else if (low[1] < short_entry[1] - short_target or high[1] > short_entry[1] + short_stop) then Double.NaN else short_entry[1];
def short_exit = if short_entry > 0 then 0 else 1;
plot short_pt = if show_trade_zone and !short_exit then short_entry - short_target else Double.NaN;
short_pt.SetDefaultColor(Color.GREEN);
plot short_ep = if show_trade_zone and !short_exit then short_entry else Double.NaN;
short_ep.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
short_ep.SetDefaultColor(Color.WHITE);
plot short_sl = if show_trade_zone and !short_exit then short_ep + short_stop else Double.NaN;
short_sl.SetDefaultColor(Color.RED);
#AddCloud(if show_trade_zone then short_pt else Double.NaN, short_ep, Color.GREEN);
#AddCloud(if show_trade_zone then short_sl else Double.NaN, short_ep, Color.RED);
#################
# END TRADE LINES
#################
#AddOrder(OrderType.BUY_AUTO, FastMA crosses above SlowMA[1]);
#AddOrder(OrderType.SELL_AUTO, FastMA crosses below SlowMA[1]);;
--------------------------------------------------------------------------------------------------------------------------------------------------
# Multi-Timeframe ElvisTrend
# Copyright (C) 2023 darkelvis twitter.com/TheOGdarkelvis
# Indicator uses a set of stacked moving averages to identify trend. Stacked low to high should indicate an uptrend, stacked high to low should indicate a downtrend, when moving averages are not stacked there is no trend. Green indicates bullish, red for bearish, and yellow for no trend.
declare lower;
##Settings
input AvgType = averageType.EXPONENTIAL;
input Fast_MA = 8;
input Mid_MA = 13;
input Slow_MA = 21;
input Show_Labels = yes;
input Timeframe = aggregationPeriod.HOUR;
##Calculations
def price = close;
def FastValue = MovingAverage(AvgType, close(period=Timeframe),Fast_MA);
def MidValue = MovingAverage(AvgType, close(period=Timeframe), Mid_MA);
def SlowValue = MovingAverage(AvgType, close(period=Timeframe), Slow_MA);
def bullish = FastValue >= MidValue AND MidValue >= SlowValue;
def bearish = FastValue <= MidValue AND MidValue <= SlowValue;
def no_trend = FastValue >= MidValue and MidValue <= SlowValue or FastValue <= MidValue and MidValue >= SlowValue;
##Label
#AddLabel(Show_Labels, If bullish then "LONG ONLY" else "", if bullish then color.green else color.black);
#AddLabel(Show_Labels, If bearish then "SHORT ONLY" else "", if bearish then color.red else color.black);
#AddLabel(Show_Labels, If no_trend then "SIT ON YOUR HANDS" else "", if no_trend then color.yellow else color.black);
##Background cloud
AddCloud(if bullish then Double.POSITIVE_INFINITY else Double.NaN,if bullish then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_GREEN);
AddCloud(if bearish then Double.POSITIVE_INFINITY else Double.NaN,if bearish then Double.NEGATIVE_INFINITY else Double.NaN, Color.PINK);
AddCloud(if no_trend then Double.POSITIVE_INFINITY else Double.NaN,if no_trend then Double.NEGATIVE_INFINITY else Double.NaN, Color.YELLOW);
##Color Candles
AssignPriceColor(if bullish then color.GREEN else if bearish then color.RED else color.yellow);
9 ema above 13 ema above 100 ema then go long, if they are all stacked on the short side, then go short.
can someone combine these 2 scripts that would then produce the arrow when the above lines up. Now the arrow and trade zone happens with a 9 and 100 cross over, it is missing the ema stacked part with the third ema.
Thank you
#
# Trade Lines
# v1.0 by @mark.917
#
# Trade Lines will plot lines with and optional cloud showing where you entered your
# position and the location of your stop loss and profit target.
#
# To use, your code will need to set "your_buy_signal" or "your_sell_signal" to true.
# The profit target and stop loss are based on an ATR multplier. You may modify this
# to be whatever you would like.
declare upper;
#######################
# YOUR CODE STARTS HERE
#######################
# sample using moving average crossover for signals
Input FastMaLength = 5;
Input SlowMaLength = 50;
def FastMA = MovingAverage(AverageType.EXPONENTIAL, close, FastMaLength);
def SlowMA = MovingAverage(AverageType.EXPONENTIAL, close, SlowMaLength);
plot fastMAPlot = FastMA;
fastMAPlot.SetDefaultColor(GetColor(1));
plot slowMAPlot = SlowMA;
slowMAPlot.SetDefaultColor(GetColor(2));
def buy_signal = FastMA crosses above SlowMA;
def sell_signal = FastMA crosses below SlowMA;
###################
# BEGIN TRADE LINES
###################
input show_trade_zone = yes;
input calc_mode = {default fixed, atr}; #hint mode: Select fixed values or atr values for target and stop levels.
input ATRTargetMultiple = 2.5;
input ATRStopMultiple = 1.5;
input FixedTarget = 1.50;
input FixedStop = .75;
def atr = ATR(14, AverageType.EXPONENTIAL);
def target;
def stop;
switch (calc_mode) {
case atr:
target = atr * ATRTargetMultiple;
stop = atr * ATRStopMultiple;
case fixed:
target = FixedTarget;
stop = FixedStop;
}
def long_signal = if buy_signal then 1 else 0;
def long_target = if long_signal == 1 then target else long_target[1];
def long_stop = if long_signal == 1 then stop else long_stop[1];
def long_entry = if long_signal == 1 then open else if (high[1] > long_entry[1] + long_target or low[1] < long_entry[1] - long_stop) then Double.NaN else long_entry[1];
def long_exit = if long_entry > 0 then 0 else 1;
plot long_pt = if show_trade_zone and !long_exit then long_entry + long_target else Double.NaN;
long_pt.SetDefaultColor(Color.GREEN);
plot long_ep = if show_trade_zone and !long_exit then long_entry else Double.NaN;
long_ep.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
long_ep.SetDefaultColor(Color.WHITE);
plot long_sl = if show_trade_zone and !long_exit then long_ep - long_stop else Double.NaN;
long_sl.SetDefaultColor(Color.RED);
#AddCloud(if show_trade_zone then long_pt else Double.NaN, long_ep, Color.GREEN);
#AddCloud(if show_trade_zone then long_sl else Double.NaN, long_ep, Color.RED);
def short_signal = if sell_signal then 1 else 0;
def short_target = if short_signal == 1 then target else short_target[1];
def short_stop = if short_signal == 1 then stop else short_stop[1];
def short_entry = if short_signal == 1 then open else if (low[1] < short_entry[1] - short_target or high[1] > short_entry[1] + short_stop) then Double.NaN else short_entry[1];
def short_exit = if short_entry > 0 then 0 else 1;
plot short_pt = if show_trade_zone and !short_exit then short_entry - short_target else Double.NaN;
short_pt.SetDefaultColor(Color.GREEN);
plot short_ep = if show_trade_zone and !short_exit then short_entry else Double.NaN;
short_ep.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
short_ep.SetDefaultColor(Color.WHITE);
plot short_sl = if show_trade_zone and !short_exit then short_ep + short_stop else Double.NaN;
short_sl.SetDefaultColor(Color.RED);
#AddCloud(if show_trade_zone then short_pt else Double.NaN, short_ep, Color.GREEN);
#AddCloud(if show_trade_zone then short_sl else Double.NaN, short_ep, Color.RED);
#################
# END TRADE LINES
#################
#AddOrder(OrderType.BUY_AUTO, FastMA crosses above SlowMA[1]);
#AddOrder(OrderType.SELL_AUTO, FastMA crosses below SlowMA[1]);;
--------------------------------------------------------------------------------------------------------------------------------------------------
# Multi-Timeframe ElvisTrend
# Copyright (C) 2023 darkelvis twitter.com/TheOGdarkelvis
# Indicator uses a set of stacked moving averages to identify trend. Stacked low to high should indicate an uptrend, stacked high to low should indicate a downtrend, when moving averages are not stacked there is no trend. Green indicates bullish, red for bearish, and yellow for no trend.
declare lower;
##Settings
input AvgType = averageType.EXPONENTIAL;
input Fast_MA = 8;
input Mid_MA = 13;
input Slow_MA = 21;
input Show_Labels = yes;
input Timeframe = aggregationPeriod.HOUR;
##Calculations
def price = close;
def FastValue = MovingAverage(AvgType, close(period=Timeframe),Fast_MA);
def MidValue = MovingAverage(AvgType, close(period=Timeframe), Mid_MA);
def SlowValue = MovingAverage(AvgType, close(period=Timeframe), Slow_MA);
def bullish = FastValue >= MidValue AND MidValue >= SlowValue;
def bearish = FastValue <= MidValue AND MidValue <= SlowValue;
def no_trend = FastValue >= MidValue and MidValue <= SlowValue or FastValue <= MidValue and MidValue >= SlowValue;
##Label
#AddLabel(Show_Labels, If bullish then "LONG ONLY" else "", if bullish then color.green else color.black);
#AddLabel(Show_Labels, If bearish then "SHORT ONLY" else "", if bearish then color.red else color.black);
#AddLabel(Show_Labels, If no_trend then "SIT ON YOUR HANDS" else "", if no_trend then color.yellow else color.black);
##Background cloud
AddCloud(if bullish then Double.POSITIVE_INFINITY else Double.NaN,if bullish then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_GREEN);
AddCloud(if bearish then Double.POSITIVE_INFINITY else Double.NaN,if bearish then Double.NEGATIVE_INFINITY else Double.NaN, Color.PINK);
AddCloud(if no_trend then Double.POSITIVE_INFINITY else Double.NaN,if no_trend then Double.NEGATIVE_INFINITY else Double.NaN, Color.YELLOW);
##Color Candles
AssignPriceColor(if bullish then color.GREEN else if bearish then color.RED else color.yellow);