DEMA Crossover with Heikin-Ashi Candle Confirmation for ThinkorSwim

T

theelderwand

New member
VIP
Built up this DEMA Crossover strategy with Heikin-Ashi candle confirmation. Works best in Daily setup.



ThinkScript Code

Rich (BB code):
def demaSlow = DEMA(close, 8);
def demaFast = DEMA(close, 21);

def HAclose = ohlc4;
def HAopen = CompoundValue(1,(HAopen[1] + HAclose[1]) / 2,
(open[1] + close[1]) / 2);
def HAhigh = Max(Max(high, HAopen), HAclose);
def HAlow = Min(Min(low, HAopen), HAclose);

def demaCrossingOverGoingDown = demaSlow[1] > demaFast[1] and demaSlow < demaFast;
def demaCrossingOverGoingUp = demaSlow < demaFast and demaSlow[-1] > demaFast[-1];

def HARed = HAOpen > HAclose;
def HAGreen = !HARed;
def HADecidedRed = HARed and HAHigh == HAopen;
def HADecidedGreen = HAGreen and HAlow == HAOpen;

def sell = demaCrossingOverGoingDown and (HADecidedRed or HADecidedRed[1] or HADecidedRed[2]);

def buy = demaCrossingOverGoingUp and (HADecidedGreen or HADecidedGreen[1] or HADecidedGreen[2]);

AddOrder(OrderType.SELL_AUTO, sell equals 1, open, 100, Color.RED, Color.RED, "Sell @" + open);
AddOrder(OrderType.BUY_AUTO, buy equals 1, open, 100, Color.GREEN, Color.GREEN, "Buy @" + open);
 
Last edited by a moderator:
N

Nick

New member
VIP
Thanks for sharing. May i know if what indicator can we use to measure the strength of the momemtum when DEMA shows a positive signal?

 
Last edited:
N

Nick

New member
VIP
Built up this DEMA Crossover strategy with Heikin-Ashi candle confirmation. Works best in Daily setup.



ThinkScript Code

Rich (BB code):
def demaSlow = DEMA(close, 8);
def demaFast = DEMA(close, 21);

def HAclose = ohlc4;
def HAopen = CompoundValue(1,(HAopen[1] + HAclose[1]) / 2,
(open[1] + close[1]) / 2);
def HAhigh = Max(Max(high, HAopen), HAclose);
def HAlow = Min(Min(low, HAopen), HAclose);

def demaCrossingOverGoingDown = demaSlow[1] > demaFast[1] and demaSlow < demaFast;
def demaCrossingOverGoingUp = demaSlow < demaFast and demaSlow[-1] > demaFast[-1];

def HARed = HAOpen > HAclose;
def HAGreen = !HARed;
def HADecidedRed = HARed and HAHigh == HAopen;
def HADecidedGreen = HAGreen and HAlow == HAOpen;

def sell = demaCrossingOverGoingDown and (HADecidedRed or HADecidedRed[1] or HADecidedRed[2]);

def buy = demaCrossingOverGoingUp and (HADecidedGreen or HADecidedGreen[1] or HADecidedGreen[2]);

AddOrder(OrderType.SELL_AUTO, sell equals 1, open, 100, Color.RED, Color.RED, "Sell @" + open);
AddOrder(OrderType.BUY_AUTO, buy equals 1, open, 100, Color.GREEN, Color.GREEN, "Buy @" + open);
Thanks for your sharing..
May i know how can we remove the labels? All i would like to see is only the arrows up or down. Secondly, can this be configured into a scan?

May i also know what does those "dash line and its colour" mean to us?

Thanks again.
 

Top