Last active
July 3, 2020 04:34
-
-
Save bongkook/702832e5fb0c9444bcebc723b6081575 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@version=3 | |
strategy(“Heiken Ashi + Ichimoku Kinko Hyo Strategy”, shorttitle=”HaI”, overlay=true, default_qty_type=strategy.percent_of_equity, max_bars_back=1000, default_qty_value=100, calc_on_order_fills= true, calc_on_every_tick=true, pyramiding=0) | |
hahigh = security(heikinashi(tickerid), period, high) | |
halow = security(heikinashi(tickerid), period, low) | |
TenkanSenPeriods = input(9, minval=1, title=”Tenkan Sen Periods”) | |
KijunSenPeriods = input(24, minval=1, title=”Kijun Sen Periods”) | |
SenkouSpanBPeriods = input(51, minval=1, title=”Senkou Span B Periods”) | |
displacement = input(24, minval=1, title=”Displacement”) | |
donchian(len) => avg(lowest(len), highest(len)) | |
TenkanSen = donchian(TenkanSenPeriods) | |
KijunSen = donchian(KijunSenPeriods) | |
SenkouSpanA = avg(TenkanSen, KijunSen) | |
SenkouSpanB = donchian(SenkouSpanBPeriods) | |
SenkouSpanH = max(SenkouSpanA[displacement – 1], SenkouSpanB[displacement – 1]) | |
SenkouSpanL = min(SenkouSpanA[displacement – 1], SenkouSpanB[displacement – 1]) | |
ChikouSpan = close[displacement-1] | |
plot(TenkanSen, color=blue, title=”Tenkan Sen”, linewidth = 2) | |
plot(KijunSen, color=maroon, title=”Kijun Sen”, linewidth = 3) | |
plot(close, offset = -displacement, color=orange, title=”Chikou Span”, linewidth = 2) | |
sa=plot (SenkouSpanA, offset = displacement, color=green, title=”Senkou Span A”, linewidth = 2) | |
sb=plot (SenkouSpanB, offset = displacement, color=red, title=”Senkou Span B”, linewidth = 3) | |
fill(sa, sb, color = SenkouSpanA > SenkouSpanB ? green : red) | |
longCondition = hahigh > max(hahigh[1],hahigh[2]) and close>ChikouSpan and close>SenkouSpanH and (TenkanSen>=KijunSen or close>KijunSen) | |
if (longCondition) | |
strategy.entry(“Long”,strategy.long) | |
shortCondition = halow < min(halow[1],halow[2]) and close if (shortCondition) | |
strategy.entry(“Short”,strategy.short) | |
closelong = halow < min(halow[1],halow[2]) and (TenkanSen max(hahigh[1],hahigh[2]) and (TenkanSen>KijunSen or close>SenkouSpanA or close>KijunSen or close>SenkouSpanL or close>ChikouSpan) | |
if (closeshort) | |
strategy.close(“Short”) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment