DEMA - TEMA Cross overs

MakePlays

New member
Platform
  1. Thinkorswim
  2. TradingView
Short - 50 DEMA < 200 DEMA and/or 10 DEMA crosses below 50 DEMA.

Long - 50 DEMA > 200 DEMA and/or 10 DEMA crosses above 50 DEMA.

@barbaros When time allows can you generate an arrow/label or transparent chart bubble for these parameters? With possible toggle settings with which ones we want to select. If possible, TEMA as well. This may exist already. Thank you gent!
 

barbaros

Administrator
Staff member
Is this what you are looking for?

Code:
# DEMA_TEMA_CrossOver
# Free for use. Header credits must be included when any form of the code included in this package is used.
# barbaros - created for b4indiscators.com

input AverageType = {default "DEMA", "TEMA"};
input Include10n50 = no;

def dema10 = DEMA(close, 10);
def dema50 = DEMA(close, 50);
def dema200 = DEMA(close, 200);

def tema10 = TEMA(close, 10);
def tema50 = TEMA(close, 50);
def tema200 = TEMA(close, 200);

def Long = if AverageType == AverageType.DEMA then dema50 > dema200 and (!Include10n50 or dema10 > dema50)
           else if  AverageType == AverageType.TEMA then tema50 > tema200 and (!Include10n50 or tema10 > tema50)
           else no;

def Short = if AverageType == AverageType.DEMA then dema50 < dema200 and (!Include10n50 or dema10 < dema50)
            else if  AverageType == AverageType.TEMA then tema50 < tema200 and (!Include10n50 or tema10 < tema50)
            else no;

def Direction = if BarNumber() == 1 then 0
                else if Direction[1] != 1 and Long then 1
                else if Direction[1] != -1 and Short then -1
                else if Direction[1] == 1 and !Long then 0
                else if Direction[1] == -1 and !Short then 0
                else Direction[1];

plot Buy = Direction crosses above 0;
Buy.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Buy.SetDefaultColor(Color.CYAN);

plot Sell = Direction crosses below 0;
Sell.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Sell.SetDefaultColor(Color.MAGENTA);
 

MakePlays

New member
Yes sir, I use them from time to time for confirmation to hold a position or even to catch the reversal. Thanks Barb.
 
Top