PROTECTED SOURCE SCRIPT

Danish Algo - BTC V- 1.2.1

//version=6
strategy('Danish Algo - BTC V- 1.2.1 ', overlay = true)

// Input periods for top and bottom signals
bottom_period = input(14, title = 'Bottom Period')
top_period = input(14, title = 'Top Period')

// Default target points at 500, but adjustable
target_points = input(500, title = 'Target Points (Default 500)')
stop_loss_points = input(0, title = 'Additional SL Points (0 for 2-candle SL only)') // Additional points for SL adjustment

// Calculate bottom and top conditions
bottom_condition = low < ta.lowest(low[1], bottom_period) and low <= ta.lowest(low[bottom_period], bottom_period)
top_condition = high > ta.highest(high[1], top_period) and high >= ta.highest(high[top_period], top_period)

// Signal times since last condition met
bottom_signal = ta.barssince(bottom_condition)
top_signal = ta.barssince(top_condition)

// BUY-SELL Conditions
Buy = ta.crossover(bottom_signal, top_signal)
Sell = ta.crossunder(bottom_signal, top_signal)

// Define stop loss and target levels based on 2 candles back high/low
buy_sl = Buy ? low[2] - stop_loss_points : na // Buy पर 2 candles पीछे का low SL के साथ custom adjustment
buy_target = Buy ? close + target_points : na // Fixed 500 points TP for Buy (adjustable)
sell_sl = Sell ? high[2] + stop_loss_points : na // Sell पर 2 candles पीछे का high SL के साथ custom adjustment
sell_target = Sell ? close - target_points : na // Fixed 500 points TP for Sell (adjustable)

// Signal cancellation logic
if Buy and strategy.position_size < 0 // Close Sell if Buy signal appears
strategy.close('Sell')
if Sell and strategy.position_size > 0 // Close Buy if Sell signal appears
strategy.close('Buy')

// Strategy Entry and Exit for Buy
if Buy
strategy.entry('Buy', strategy.long)
strategy.exit('Sell Target/SL', 'Buy', stop = buy_sl, limit = buy_target)

// Strategy Entry and Exit for Sell
if Sell
strategy.entry('Sell', strategy.short)
strategy.exit('Buy Target/SL', 'Sell', stop = sell_sl, limit = sell_target)

// Plot Buy/Sell Signals on chart
plotshape(Buy, title = 'BUY', location = location.belowbar, color = color.new(color.green, 0), style = shape.labelup, text = 'BUY', textcolor = color.new(color.black, 0))
plotshape(Sell, title = 'SELL', location = location.abovebar, color = color.new(color.red, 0), style = shape.labeldown, text = 'SELL', textcolor = color.new(color.black, 0))

// Background Color for Buy and Sell Zones
bgcolor(Buy ? color.new(color.blue, 85) : Sell ? color.new(color.red, 85) : na)

// Alert Conditions for Buy and Sell
alertcondition(Buy, title = 'Buy Signal', message = 'Buy signal detected')
alertcondition(Sell, title = 'Sell Signal', message = 'Sell signal detected')
Bill Williams IndicatorsBreadth IndicatorsChart patterns

Script protégé

Ce script est publié en code source fermé et vous pouvez l'utiliser librement. Vous pouvez le préférer pour l'utiliser sur un graphique. Vous ne pouvez pas visualiser ou modifier son code source.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité