# Trading Script that I developed: HELPFUL SIMPLE 10/20 SMA HA STRATEGY for LONGS & SHORTS DYOR

#1

As always do your own research before doing anything.

#2

Awesome stuff. Love it that you’re using Heikin-Ashi candlesticks as it’s the same I use on daily basis.

I was wondering about the math to calculate your own H/A open/high/low/close and wondering if it’s correct…

``````#   HA-Close = (Open(0) + High(0) + Low(0) + Close(0)) / 4
HAClose = (open + high + low + close )/4  # GOOD!

#   HA-Open = (HA-Open(-1) + HA-Close(-1)) / 2
HAOpen = (close[1] + open[1]) /2  # GOOD!

#   HA-High = Maximum of the High(0), HA-Open(0) or HA-Close(0)
HAHigh =  max(close,max(high, open))  # max(high,max(HAOpen, HAClose))

#   HA-Low = Minimum of the Low(0), HA-Open(0) or HA-Close(0)
HALow = min(low,(min(open, close))) # min(low,min(HAOpen,HAClose))
``````

Formulas above taken from:

http://stockcharts.com/school/doku.php?id=chart_school:chart_analysis:heikin_ashi

I haven’t used Pine Script all that much, but I’d double check what the supplied values of the open/high/low/close candles are. If H/A candles are already selected, these variables may already be set to H/A values!

The rest looks solid to me and I will definitely play around with this!

#3

mmm nice catch, I will double check this points. Thank you!