
یہ حکمت عملی قیمتوں میں آرڈر بلاکس کی نشاندہی کرتی ہے تاکہ قیمتوں میں پھیلنے والی قیمتوں کی تلاش کی جاسکے ، اور جب خرید و فروخت کا اشارہ ہوتا ہے تو مارکیٹ میں داخل ہوجاتا ہے۔ آرڈر بلاکس اس علاقے کی نشاندہی کرتے ہیں جس میں اداروں کی شرکت ہوتی ہے ، جو مارکیٹ کی زیادہ طاقت کی عکاسی کرتی ہے۔ لہذا ، جب آرڈر بلاکس کا اشارہ ہوتا ہے تو ، اس میں قیمتوں میں رجحان سازی ہونے کا زیادہ امکان ہوتا ہے۔
آرڈر بلاک کو کثیر سر آرڈر بلاک اور خالی سر آرڈر بلاک میں تقسیم کیا گیا ہے۔ کثیر سر آرڈر بلاک کی تعریف ایک نیچے کی K لائن ((سرخ K لائن) کے بعد کثیر سر اوپر کی K لائن ((سبز K لائن) کے بعد کی گئی ہے۔ خالی سر آرڈر بلاک کی تعریف ایک اوپر کی K لائن ((سبز K لائن) کے بعد کثیر سر نیچے کی K لائن (سرخ K لائن) کے بعد کی گئی ہے۔
ایک آرڈر بلاک کی شناخت کے لئے، مندرجہ ذیل شرائط کو ایک ساتھ مل کر پورا کرنا ضروری ہے:
K لائن کا رنگ تبدیل ہوتا ہے: پچھلی K لائن سے موجودہ K لائن میں ، K لائن کا رنگ تبدیل ہوتا ہے (مثال کے طور پر سرخ سے سبز ، یا سبز سے سرخ) ۔ یہ اس رجحان کی نشاندہی کرتا ہے جو کسی ادارے کے اختتام سے پہلے ہوسکتا ہے ، نئے رجحانات شروع کرنے کے لئے تیار ہے۔
بعد کی K لائنوں کا رنگ یکساں ہے: پیرامیٹرز کی مدت کی مخصوص جڑ تک پہنچنے کے بعد ، بعد کی K لائنیں ایک ہی رنگ کی سمت کو برقرار رکھتی ہیں (مثال کے طور پر کثیر آرڈر بلاک کے پیچھے سبھی سبز K لائنیں ہیں) ۔ اس سے ظاہر ہوتا ہے کہ نیا رجحان مستحکم اور تصدیق شدہ ہے۔
حد سے زیادہ اتار چڑھاؤ: آرڈر بلاک کی افتتاحی قیمت سے لے کر اس کے بعد کی لائن کے اختتامی قیمتوں میں حد سے زیادہ اتار چڑھاؤ پیرامیٹر threshold کی ترتیب ((ڈیفالٹ 0) ۔ اس سے یہ یقینی بنتا ہے کہ نئے رجحانات کی کافی طاقت اور اثر و رسوخ ہو۔
جب مذکورہ بالا تینوں شرائط ایک ساتھ ملیں تو ، ایک آرڈر بلاک سگنل کو تسلیم کیا جاسکتا ہے۔
جب کثیر سر والے آرڈر بلاک کی شناخت کی جاتی ہے تو ، خریدنے کا اشارہ پیدا ہوتا ہے۔ جب خالی سر والے آرڈر بلاک کی شناخت کی جاتی ہے تو ، فروخت کا اشارہ پیدا ہوتا ہے۔
آرڈر بلاک سگنل کی غیر یقینی صورتحال اور ممکنہ دوبارہ جانچ کو مدنظر رکھتے ہوئے ، حکمت عملی آرڈر بلاک سگنل کے ظہور پر براہ راست مارکیٹ میں نہیں آتی ہے ، بلکہ ڈرائنگ لائن ، الارم وغیرہ کے ذریعہ تاجر کو آگاہ کرتی ہے۔ تاجر آرڈر بلاک قیمت کے علاقے کے آس پاس مناسب حد کی قیمت تعینات کرنے کا انتخاب کرسکتے ہیں اور قیمت کے ٹرگر ہونے کے بعد رجحان میں داخل ہونے کا انتظار کرسکتے ہیں۔
آرڈر بلاک ادارے کے فنڈز اور بڑے پیمانے پر لین دین کی تعداد میں شرکت کی نشاندہی کرتا ہے ، جو مارکیٹ کی طاقت کی تبدیلی کی نمائندگی کرتا ہے۔ لہذا ، آرڈر بلاک سگنل کی ایک خاص پیش گوئی اور درستگی ہوتی ہے ، جو ممکنہ توڑ کی سمت کو پہلے سے پکڑ سکتی ہے۔ یہ رجحانات پر سوار ہونے کے لئے ایک فائدہ مند مقام اور وقت فراہم کرتا ہے۔
حکمت عملی کے پیرامیٹرز بشمول تاریخی K لائنوں کی تعداد ، توڑنے کی رفتار کی شدت وغیرہ کو پیرامیٹرز کے ذریعہ ایڈجسٹ کیا جاسکتا ہے ، تاکہ مختلف مارکیٹ کے ماحول اور تاجر کے انداز کے مطابق اصلاح کی جاسکے ، اور حکمت عملی کی موافقت کو بہتر بنایا جاسکے۔
حکمت عملی آرڈر بلاک سگنل کے ظہور پر مارکیٹ میں اصل میں داخل نہیں ہوتی ہے ، بلکہ الارم ترتیب دیتی ہے اور آفسیٹ حد کی قیمتوں کے ذریعہ پوزیشن بناتی ہے۔ اس طرح سے تاجر کو داخلے کے مخصوص پوائنٹس اور خطرات پر قابو پانے کی اجازت ملتی ہے۔ یہاں تک کہ اگر آرڈر بلاک سگنل میں غلطی ہو تو بھی ، اس کا نتیجہ صرف یہ ہوتا ہے کہ حد کی قیمتیں متحرک نہیں ہوں گی ، خطرہ قابو میں ہے۔
چونکہ آرڈر بلاک ایک وقفہ کی نشاندہی کرتا ہے ، اس کے بعد کی قیمت اس وقفے کو دوبارہ کال کرنے کا امکان زیادہ ہے۔ لہذا آرڈر بلاک سگنل کو معیاری انٹری سگنل کے طور پر استعمال نہیں کیا جاسکتا ہے ، بلکہ پیشگی انتباہی معلومات کے طور پر ، تاجر کو اپنے آپ کو انٹری کے وقت کا مزید فیصلہ کرنے کی ضرورت ہے۔
اگر آرڈر بلاک کے پیرامیٹرز کی ترتیب (تاریخی K لائنوں کی تعداد ، طول و عرض کی کمی ، وغیرہ) غلط ہے تو ، یہ عام سائیڈ ویز کے درمیان غلط سگنل پیدا کرنے میں آسان ہے۔ اس سے تاجروں کو مارکیٹ کے بارے میں کچھ حساسیت اور فیصلہ کرنے کی ضرورت ہوتی ہے ، تاکہ پیرامیٹرز کو اندھے طور پر بہتر بنایا جاسکے۔
چونکہ آرڈر بلاک سگنل 100 فیصد قابل اعتماد نہیں ہے ، لہذا جب تاجر سگنل حاصل کرتا ہے تو اس کی موجودہ سگنل کی وشوسنییتا کا فیصلہ کرنے کے لئے مزید تجزیہ کرنے کی ضرورت ہوتی ہے ، جس سے کچھ انسانی کام بڑھ جاتا ہے۔ سگنل کے معیار کے بارے میں مختلف فیصلے بھی تجارتی کارکردگی میں فرق کا سبب بن سکتے ہیں۔
جب آرڈر بلاک سگنل ظاہر ہوتا ہے تو ، دوسرے اشارے کے ساتھ مل کر رجحان کی سمت اور طاقت کا فیصلہ کیا جاسکتا ہے ، مثال کے طور پر ، MACD ، RSI وغیرہ کے ساتھ مل کر ، پیرامیٹرز کی ترتیب سے پیدا ہونے والے غلط سگنل کو فلٹر کریں ، سگنل کی درستگی کو بہتر بنائیں۔
مختلف مارکیٹوں اور مختلف تجارتی اقسام میں پیرامیٹرز کو جانچ اور بہتر بنایا جاسکتا ہے ، جیسے کہ کی لائنز کی تعداد ، اتار چڑھاؤ کی قیمت ، وغیرہ ، تاکہ وہ موجودہ مارکیٹ کے ماحول کے مطابق ہو۔ پیرامیٹرز کی خود کار طریقے سے موافقت کی خصوصیت بھی ترتیب دی جاسکتی ہے ، جو مارکیٹ میں اتار چڑھاؤ اور خطرے کی ترجیحات کے مطابق خود بخود ایڈجسٹ ہوجاتی ہے۔
اس وقت حکمت عملی صرف سگنل اشارے کے آلے کے طور پر کام کرتی ہے ، تاجر کو خود ہی فیصلہ کرنے کی ضرورت ہوتی ہے کہ وہ کب داخل ہوتا ہے۔ ہم آرڈر بلاک قیمت کی حد کے لئے خود کار طریقے سے آرڈر کا طریقہ کار تیار کرسکتے ہیں ، جب کچھ شرائط پوری ہوجائیں تو خود بخود داخل ہوجائیں۔ اور روک تھام جیسے طریقوں کے ساتھ مل کر باہر نکلنے کا منطق مرتب کریں ، انسانی فیصلے کی ضرورت کو کم کریں ، حکمت عملی کی خودکار سطح کو بڑھا دیں۔
یہ حکمت عملی آرڈر کے بہاؤ کے حراستی میں قیمتوں کی حد کو مؤثر طریقے سے پہچاننے ، مارکیٹ میں پوشیدہ حرکیات کی معلومات کو کھودنے ، اور رجحانات میں قیمتوں میں اضافے کے لئے فائدہ مند پوزیشننگ اور گرفت کا وقت فراہم کرتی ہے۔ آرڈر بلاک حکمت عملی میں رجحانات کی پیروی کرنے کے آسان طریقوں کے مقابلے میں سر کی شناخت کی صلاحیت اور سرگرمی ہے۔ جب پیرامیٹرز کی اصلاح ، ہوا کے کنٹرول کے طریقوں کے ساتھ مل کر استعمال کیا جاتا ہے تو ، یہ ایک موثر رجحان کی حکمت عملی بن سکتی ہے۔ لیکن تاجروں کو غلط سگنل کی پیداوار کے لئے چوکس رہنے کی ضرورت ہے ، اور سگنل کی معیار کے بارے میں ہر فیصلہ کریں۔ مستقبل میں ، اس حکمت عملی کو بہتر بنانے کے لئے ضروری ہے کہ اس کی خود کار طریقے سے آٹومیشن کی سطح کو کم کیا جائے تاکہ اس میں تعصب کو کم کیا جاسکے۔
/*backtest
start: 2024-01-01 00:00:00
end: 2024-01-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TradingSecrets and wugamlo
// This experimental Indicator helps identifying instituational Order Blocks.
// Often these blocks signal the beginning of a strong move, but there is a significant probability that these price levels will be revisited at a later point in time again.
// Therefore these are interesting levels to place limit orders (Buy Orders for Bullish OB / Sell Orders for Bearish OB).
//
// A Bullish Order block is defined as the last down candle before a sequence of up candles. (Relevant price range "Open" to "Low" is marked) / Optionally full range "High" to "Low"
// A Bearish Order Block is defined as the last up candle before a sequence of down candles. (Relevant price range "Open" to "High" is marked) / Optionally full range "High" to "Low"
//
// In the settings the number of required sequential candles can be adjusted.
// Furthermore a %-threshold can be entered. It defines which %-change the sequential move needs to achieve in order to identify a relevant Order Block.
// Channels for the last Bullish/Bearish Block can be shown/hidden.
//
// In addition to the upper/lower limits of each Order Block, also the equlibrium (average value) is marked as this is an interesting area for price interaction.
//
// Alerts added: Alerts fire when an Order Block is detected. The delay is based on the "Relevant Periods" input. Means with the default setting "5" the alert will trigger after the
// number of consecutive candles is reached.
//@version=4
strategy("[Backtest] Order Block Finder", overlay = true)
colors = input(title = "Color Scheme", defval="DARK", options=["DARK", "BRIGHT"])
periods = input(5, "Relevant Periods to identify OB") // Required number of subsequent candles in the same direction to identify Order Block
threshold = input(0.0, "Min. Percent move to identify OB", step = 0.1) // Required minimum % move (from potential OB close to last subsequent candle to identify Order Block)
usewicks = input(false, "Use whole range [High/Low] for OB marking?" ) // Display High/Low range for each OB instead of Open/Low for Bullish / Open/High for Bearish
showbull = input(false, "Show latest Bullish Channel?") // Show Channel for latest Bullish OB?
showbear = input(false, "Show latest Bearish Channel?") // Show Channel for latest Bearish OB?
showdocu = input(false, "Show Label for documentation tooltip?") // Show Label which shows documentation as tooltip?
info_pan = input(false, "Show Latest OB Panel?") // Show Info Panel with latest OB Stats
//strategy inputs
plot_offset = input( type=input.bool,defval = false, title = 'Plot Offset?')
stoploss_percent = input(type=input.float, defval = 1, title = 'Stop Loss [%]')
takeprofit_percent = input(type=input.float, defval = 2, title = 'Take Profit [%]')
pyramiding = input( type=input.bool,defval = true, title = 'Pyramiding')
ob_period = periods + 1 // Identify location of relevant Order Block candle
absmove = ((abs(close[ob_period] - close[1]))/close[ob_period]) * 100 // Calculate absolute percent move from potential OB to last candle of subsequent candles
relmove = absmove >= threshold // Identify "Relevant move" by comparing the absolute move to the threshold
// Color Scheme
bullcolor = colors == "DARK"? color.white : color.green
bearcolor = colors == "DARK"? color.blue : color.red
// Bullish Order Block Identification
bullishOB = close[ob_period] < open[ob_period] // Determine potential Bullish OB candle (red candle)
int upcandles = 0
for i = 1 to periods
upcandles := upcandles + (close[i] > open[i]? 1 : 0) // Determine color of subsequent candles (must all be green to identify a valid Bearish OB)
OB_bull = bullishOB and (upcandles == (periods)) and relmove // Identification logic (red OB candle & subsequent green candles)
OB_bull_high = OB_bull? usewicks? high[ob_period] : open[ob_period] : na // Determine OB upper limit (Open or High depending on input)
OB_bull_low = OB_bull? low[ob_period] : na // Determine OB lower limit (Low)
OB_bull_avg = (OB_bull_high + OB_bull_low)/2 // Determine OB middle line
// Bearish Order Block Identification
bearishOB = close[ob_period] > open[ob_period] // Determine potential Bearish OB candle (green candle)
int downcandles = 0
for i = 1 to periods
downcandles := downcandles + (close[i] < open[i]? 1 : 0) // Determine color of subsequent candles (must all be red to identify a valid Bearish OB)
OB_bear = bearishOB and (downcandles == (periods)) and relmove // Identification logic (green OB candle & subsequent green candles)
OB_bear_high = OB_bear? high[ob_period] : na // Determine OB upper limit (High)
OB_bear_low = OB_bear? usewicks? low[ob_period] : open[ob_period] : na // Determine OB lower limit (Open or Low depending on input)
OB_bear_avg = (OB_bear_low + OB_bear_high)/2 // Determine OB middle line
//@TradingSecrets: Option to disable the offset in order to allign signals with Backtest
if not plot_offset
ob_period := 0
// Plotting
plotshape(OB_bull, title="Bullish OB", style = shape.triangleup, color = bullcolor, textcolor = bullcolor, size = size.tiny, location = location.belowbar, offset = -ob_period, text = "Bullish OB") // Bullish OB Indicator
bull1 = plot(OB_bull_high, title="Bullish OB High", style = plot.style_linebr, color = bullcolor, offset = -ob_period, linewidth = 3) // Bullish OB Upper Limit
bull2 = plot(OB_bull_low, title="Bullish OB Low", style = plot.style_linebr, color = bullcolor, offset = -ob_period, linewidth = 3) // Bullish OB Lower Limit
fill(bull1, bull2, color=bullcolor, transp = 0, title = "Bullish OB fill") // Fill Bullish OB
plotshape(OB_bull_avg, title="Bullish OB Average", style = shape.cross, color = bullcolor, size = size.normal, location = location.absolute, offset = -ob_period) // Bullish OB Average
plotshape(OB_bear, title="Bearish OB", style = shape.triangledown, color = bearcolor, textcolor = bearcolor, size = size.tiny, location = location.abovebar, offset = -ob_period, text = "Bearish OB") // Bearish OB Indicator
bear1 = plot(OB_bear_low, title="Bearish OB Low", style = plot.style_linebr, color = bearcolor, offset = -ob_period, linewidth = 3) // Bearish OB Lower Limit
bear2 = plot(OB_bear_high, title="Bearish OB High", style = plot.style_linebr, color = bearcolor, offset = -ob_period, linewidth = 3) // Bearish OB Upper Limit
fill(bear1, bear2, color=bearcolor, transp = 0, title = "Bearish OB fill") // Fill Bearish OB
plotshape(OB_bear_avg, title="Bearish OB Average", style = shape.cross, color = bearcolor, size = size.normal, location = location.absolute, offset = -ob_period) // Bullish OB Average
var line linebull1 = na // Bullish OB average
var line linebull2 = na // Bullish OB open
var line linebull3 = na // Bullish OB low
var line linebear1 = na // Bearish OB average
var line linebear2 = na // Bearish OB high
var line linebear3 = na // Bearish OB open
if OB_bull and showbull
line.delete(linebull1)
linebull1 := line.new(x1 = bar_index, y1 = OB_bull_avg, x2 = bar_index - 1, y2 = OB_bull_avg, extend = extend.left, color = bullcolor, style = line.style_solid, width = 1)
line.delete(linebull2)
linebull2 := line.new(x1 = bar_index, y1 = OB_bull_high, x2 = bar_index - 1, y2 = OB_bull_high, extend = extend.left, color = bullcolor, style = line.style_dashed, width = 1)
line.delete(linebull3)
linebull3 := line.new(x1 = bar_index, y1 = OB_bull_low, x2 = bar_index - 1, y2 = OB_bull_low, extend = extend.left, color = bullcolor, style = line.style_dashed, width = 1)
if OB_bear and showbear
line.delete(linebear1)
linebear1 := line.new(x1 = bar_index, y1 = OB_bear_avg, x2 = bar_index - 1, y2 = OB_bear_avg, extend = extend.left, color = bearcolor, style = line.style_solid, width = 1)
line.delete(linebear2)
linebear2 := line.new(x1 = bar_index, y1 = OB_bear_high, x2 = bar_index - 1, y2 = OB_bear_high, extend = extend.left, color = bearcolor, style = line.style_dashed, width = 1)
line.delete(linebear3)
linebear3 := line.new(x1 = bar_index, y1 = OB_bear_low, x2 = bar_index - 1, y2 = OB_bear_low, extend = extend.left, color = bearcolor, style = line.style_dashed, width = 1)
// Alerts for Order Blocks Detection
alertcondition(OB_bull, title='New Bullish OB detected', message='New Bullish OB detected - This is NOT a BUY signal!')
alertcondition(OB_bear, title='New Bearish OB detected', message='New Bearish OB detected - This is NOT a SELL signal!')
// Print latest Order Blocks in Data Window
var latest_bull_high = 0.0 // Variable to keep latest Bull OB high
var latest_bull_avg = 0.0 // Variable to keep latest Bull OB average
var latest_bull_low = 0.0 // Variable to keep latest Bull OB low
var latest_bear_high = 0.0 // Variable to keep latest Bear OB high
var latest_bear_avg = 0.0 // Variable to keep latest Bear OB average
var latest_bear_low = 0.0 // Variable to keep latest Bear OB low
// Assign latest values to variables
if OB_bull_high > 0
latest_bull_high := OB_bull_high
if OB_bull_avg > 0
latest_bull_avg := OB_bull_avg
if OB_bull_low > 0
latest_bull_low := OB_bull_low
if OB_bear_high > 0
latest_bear_high := OB_bear_high
if OB_bear_avg > 0
latest_bear_avg := OB_bear_avg
if OB_bear_low > 0
latest_bear_low := OB_bear_low
// Plot invisible characters to be able to show the values in the Data Window
plotchar(latest_bull_high, char = ' ', location = location.abovebar, color = #777777, transp = 100, size = size.tiny, title = "Latest Bull High")
plotchar(latest_bull_avg, char = ' ', location = location.abovebar, color = #777777, transp = 100, size = size.tiny, title = "Latest Bull Avg")
plotchar(latest_bull_low, char = ' ', location = location.abovebar, color = #777777, transp = 100, size = size.tiny, title = "Latest Bull Low")
plotchar(latest_bear_high, char = ' ', location = location.abovebar, color = #777777, transp = 100, size = size.tiny, title = "Latest Bear High")
plotchar(latest_bear_avg, char = ' ', location = location.abovebar, color = #777777, transp = 100, size = size.tiny, title = "Latest Bear Avg")
plotchar(latest_bear_low, char = ' ', location = location.abovebar, color = #777777, transp = 100, size = size.tiny, title = "Latest Bear Low")
//InfoPanel for latest Order Blocks
draw_InfoPanel(_text, _x, _y, font_size)=>
var label la_panel = na
label.delete(la_panel)
la_panel := label.new(
x=_x, y=_y,
text=_text, xloc=xloc.bar_time, yloc=yloc.price,
color=color.new(#383838, 5), style=label.style_label_left, textcolor=color.white, size=font_size)
info_panel_x = time_close + round(change(time) * 100)
info_panel_y = close
title = "LATEST ORDER BLOCKS"
row0 = "-----------------------------------------------------"
row1 = ' Bullish - High: ' + tostring(latest_bull_high, '#.##')
row2 = ' Bullish - Avg: ' + tostring(latest_bull_avg, '#.##')
row3 = ' Bullish - Low: ' + tostring(latest_bull_low, '#.##')
row4 = "-----------------------------------------------------"
row5 = ' Bearish - High: ' + tostring(latest_bear_high, '#.##')
row6 = ' Bearish - Avg: ' + tostring(latest_bear_avg, '#.##')
row7 = ' Bearish - Low: ' + tostring(latest_bear_low, '#.##')
panel_text = '\n' + title + '\n' + row0 + '\n' + row1 + '\n' + row2 + '\n' + row3 + '\n' + row4 + '\n\n' + row5 + '\n' + row6 + '\n' + row7 + '\n'
if info_pan
draw_InfoPanel(panel_text, info_panel_x, info_panel_y, size.normal)
// === Label for Documentation/Tooltip ===
chper = time - time[1]
chper := change(chper) > 0 ? chper[1] : chper
// === Tooltip text ===
var vartooltip = "Indicator to help identifying instituational Order Blocks. Often these blocks signal the beginning of a strong move, but there is a high probability, that these prices will be revisited at a later point in time again and therefore are interesting levels to place limit orders. \nBullish Order block is the last down candle before a sequence of up candles. \nBearish Order Block is the last up candle before a sequence of down candles. \nIn the settings the number of required sequential candles can be adjusted. \nFurthermore a %-threshold can be entered which the sequential move needs to achieve in order to validate a relevant Order Block. \nChannels for the last Bullish/Bearish Block can be shown/hidden."
// === Print Label ===
var label l_docu = na
label.delete(l_docu)
if showdocu
l_docu := label.new(x = time + chper * 35, y = close, text = "DOCU OB", color=color.gray, textcolor=color.white, style=label.style_label_center, xloc = xloc.bar_time, yloc=yloc.price, size=size.tiny, textalign = text.align_left, tooltip = vartooltip)
// @TradingSecrets: Generate entry and exit orders based on the signals
entryLongSignal = OB_bull
entryShortSignal = OB_bear
if not pyramiding
entryLongSignal := entryLongSignal and not strategy.position_size
entryShortSignal := entryShortSignal and not strategy.position_size
if entryLongSignal
strategy.entry("Long Entry", strategy.long)
//strategy.exit("Long Exit Loss", "Long Entry", stop = close * (1 - stoploss_percent*0.01))
if entryShortSignal
strategy.entry("Short Entry", strategy.short)
//strategy.exit("Short Exit Loss", "Short Entry", stop = close * (1 + stoploss_percent*0.01))
strategy.initial_capital = 50000
//Close Position by market order
if strategy.position_size > 0 and strategy.openprofit/nz(strategy.initial_capital + strategy.netprofit) >= takeprofit_percent*0.01
//If I m in a long position and my take profit got hit close it by market order
strategy.close("Long Entry", comment = "Long Exit Profit")
if strategy.position_size < 0 and strategy.openprofit/nz(strategy.initial_capital + strategy.netprofit) >= takeprofit_percent*0.01
strategy.close("Short Entry", comment = "Short Exit Profit")
if strategy.position_size > 0 and strategy.openprofit/nz(strategy.initial_capital + strategy.netprofit) <= -stoploss_percent*0.01
//If I m in a long position and my take profit got hit close it by market order
strategy.close("Long Entry", comment = "Long Exit Loss")
if strategy.position_size < 0 and strategy.openprofit/nz(strategy.initial_capital + strategy.netprofit) <= -stoploss_percent*0.01
strategy.close("Short Entry", comment = "Short Exit Loss")