Professional Documents
Culture Documents
Half3 Bit Star
Half3 Bit Star
// Part 1
amplitude_1 = input(title="Amplitude 1", defval=2)
channelDeviation_1 = input(title="Channel Deviation 1", defval=2)
showArrows_1 = input(title="Show Arrows 1", defval=true)
showChannels_1 = input(title="Show Channels 1", defval=true)
atr2_1 = atr(100) / 2
dev_1 = channelDeviation_1 * atr2_1
highPrice_1 = high[abs(highestbars(amplitude_1))]
lowPrice_1 = low[abs(lowestbars(amplitude_1))]
highma_1 = sma(high, amplitude_1)
lowma_1 = sma(low, amplitude_1)
if nextTrend_1 == 1
maxLowPrice_1 := max(lowPrice_1, maxLowPrice_1)
atr2_2 = atr(100) / 2
dev_2 = channelDeviation_2 * atr2_2
highPrice_2 = high[abs(highestbars(amplitude_2))]
lowPrice_2 = low[abs(lowestbars(amplitude_2))]
highma_2 = sma(high, amplitude_2)
lowma_2 = sma(low, amplitude_2)
if nextTrend_2 == 1
maxLowPrice_2 := max(lowPrice_2, maxLowPrice_2)
atr2_3 = atr(100) / 2
dev_3 = channelDeviation_3 * atr2_3
highPrice_3 = high[abs(highestbars(amplitude_3))]
lowPrice_3 = low[abs(lowestbars(amplitude_3))]
highma_3 = sma(high, amplitude_3)
lowma_3 = sma(low, amplitude_3)
if nextTrend_3 == 1
maxLowPrice_3 := max(lowPrice_3, maxLowPrice_3)
if trend_3 == 0
if not na(trend_3[1]) and trend_3[1] != 0
up_3 := na(down_3[1]) ? down_3 : down_3[1]
arrowUp_3 := up_3 - atr2_3
else
up_3 := na(up_3[1]) ? maxLowPrice_3 : max(maxLowPrice_3, up_3[1])
atrHigh_3 := up_3 + dev_3
atrLow_3 := up_3 - dev_3
else
if not na(trend_3[1]) and trend_3[1] != 1
down_3 := na(up_3[1]) ? up_3 : up_3[1]
arrowDown_3 := down_3 + atr2_3
else
down_3 := na(down_3[1]) ? minHighPrice_3 : min(minHighPrice_3, down_3[1])
atrHigh_3 := down_3 + dev_3
atrLow_3 := down_3 - dev_3