//@version=5 strategy('strategy mt5', overlay=true, max_bars_back=500, calc_on_order_fills=true, pyramiding = 5, default_qty_type=strategy.fixed, default_qty_value=1000, initial_capital=100, currency=currency.USD) //bactesting useDateFilter = input.bool(true, title="Filter Date Range of Backtest", group="Backtest Time Period") backtestStartDate = input.time(timestamp("1 Jan 2021"), title="Start Date", group="Backtest Time Period", tooltip="This start date is in the time zone of the exchange " + "where the chart's instrument trades. It doesn't use the time " + "zone of the chart or of your computer.") backtestEndDate = input.time(timestamp("1 Jan 2022"), title="End Date", group="Backtest Time Period", tooltip="This end date is in the time zone of the exchange " + "where the chart's instrument trades. It doesn't use the time " + "zone of the chart or of your computer.") inTradeWindow = not useDateFilter or (time >= backtestStartDate and time < backtestEndDate) sell = close[5] > open[5] and close[4] > open[4] //not real pattern...just for building mt5 EA.....will replace with my pattern after sell1 = close[6] > open[6] and close[5] > open[5] //not real pattern...just for building mt5 EA.....will replace with my pattern after sell2 = close[7] > open [7] and close[6] > open[7] //not real pattern...just for building mt5 EA.....will replace with my pattern after plotshape(sell, text='Sell', textcolor=color.new(color.white, 0), style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), size=size.tiny) plotshape(sell1, text='Sell1', textcolor=color.new(color.white, 0), style=shape.labeldown, location=location.belowbar, color=color.new(color.red, 0), size=size.tiny) plotshape(sell2, text='Sell2', textcolor=color.new(color.white, 0), style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), size=size.tiny) buy = close[5] > open[5] and close[4] > open[4] //not real pattern...just for building mt5 EA.....will replace with my pattern after buy1 = close[6] > open[6] and close[5] > open[5] //not real pattern...just for building mt5 EA.....will replace with my pattern after buy2 = close[7] > open [7] and close[6] > open[6] //not real pattern...just for building mt5 EA.....will replace with my pattern after plotshape(buy, text='Buy', textcolor=color.new(color.white, 0), style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), size=size.tiny) plotshape(buy1, text='Buy1', textcolor=color.new(color.white, 0), style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), size=size.tiny) plotshape(buy2, text='Buy2', textcolor=color.new(color.white, 0), style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), size=size.tiny) if inTradeWindow and sell strategy.order("Sell", strategy.short , qty = 1000 ) strategy.exit("EXS", qty = 1000 ,profit = 200, loss = 50) if inTradeWindow and sell1 strategy.order("Sell", strategy.short , qty = 1000) strategy.exit("EXS", qty = 1000 , profit = 200, loss = 50) if inTradeWindow and sell2 strategy.order("Sell", strategy.short , qty = 1000 ) strategy.exit("EXS", qty = 1000 ,profit = 200, loss = 50) if inTradeWindow and buy strategy.order("Buy", strategy.long , qty = 1000 ) strategy.exit("EXB", qty = 1000 ,profit = 200, loss = 50) if inTradeWindow and buy1 strategy.order("Buy", strategy.long , qty = 1000 ) strategy.exit("EXB", qty = 1000 ,profit = 200, loss = 50) if inTradeWindow and buy2 strategy.order("Buy", strategy.long , qty = 1000 ) strategy.exit("EXB", qty = 1000 ,profit = 200, loss = 50) red = color.red green = color.lime white = color.white alertcondition(sell, title='Sell', message='go short') alertcondition(sell1, title='Sell1', message='go short') alertcondition(sell2, title='Sell2', message='go short') alertcondition(buy, title='Buy', message='go long') alertcondition(buy1, title='Buy1', message='go long') alertcondition(buy2, title='Buy2', message='go long')