
یہ حکمت عملی ایک اعلی درجے کی تجارتی نظام ہے جس میں متحرک طور پر اسٹاپ نقصان ، رسک پے ریٹ اور آر ایس آئی کی حد سے باہر نکلنے کا پتہ چلتا ہے۔ حکمت عملی مارکیٹ میں مخصوص شکلوں کی نشاندہی کرکے تجارت کرتی ہے ((متوازی K لائن شکلیں اور ایکسل K لائن شکلیں) ، جبکہ اے ٹی آر اور حالیہ کم سے متحرک طور پر اسٹاپ نقصان کی حد طے کرنے کے لئے استعمال کیا جاتا ہے ، اور پہلے سے طے شدہ رسک ریٹ کی بنیاد پر منافع کے اہداف کا تعین کیا جاتا ہے۔ نظام میں آر ایس آئی اشارے پر مبنی مارکیٹ میں زیادہ گرمی / ٹھنڈک کا فیصلہ کرنے کا طریقہ کار بھی شامل ہے۔
حکمت عملی کی بنیادی منطق میں درج ذیل اہم حصے شامل ہیں:
یہ ایک اچھی طرح سے ڈیزائن شدہ تجارتی حکمت عملی ہے ، جس میں متعدد پختہ تکنیکی تجزیہ کے تصورات کو ملا کر ایک مکمل تجارتی نظام تشکیل دیا گیا ہے۔ حکمت عملی کا فائدہ اس کے جامع رسک مینجمنٹ سسٹم اور لچکدار تجارتی قواعد پر ہے ، لیکن اس کے ساتھ ساتھ پیرامیٹرز کی اصلاح اور مارکیٹ کی موافقت کے مسائل پر بھی توجہ دینے کی ضرورت ہے۔ تجویز کردہ اصلاحی سمت کے ذریعہ ، حکمت عملی میں مزید بہتری کی گنجائش ہے۔
/*backtest
start: 2024-11-10 00:00:00
end: 2024-12-09 08:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ZenAndTheArtOfTrading | www.TheArtOfTrading.com
// @version=5
strategy("Trailing stop 1", overlay=true)
// Get user input
int BAR_LOOKBACK = input.int(10, "Bar Lookback")
int ATR_LENGTH = input.int(14, "ATR Length")
float ATR_MULTIPLIER = input.float(1.0, "ATR Multiplier")
rr = input.float(title="Risk:Reward", defval=3)
// Basic definition
var float shares=na
risk = 1000
var float R=na
E = strategy.position_avg_price
// Input option to choose long, short, or both
side = input.string("Long", title="Side", options=["Long", "Short", "Both"])
// RSI exit option
RSIexit = input.string("Yes", title="Exit at RSI extreme?", options=["Yes", "No"])
RSIup = input(75)
RSIdown = input(25)
// Get indicator values
float atrValue = ta.atr(ATR_LENGTH)
// Calculate stop loss values
var float trailingStopLoss = na
float longStop = ta.lowest(low, BAR_LOOKBACK) - (atrValue * ATR_MULTIPLIER)
float shortStop = ta.highest(high, BAR_LOOKBACK) + (atrValue * ATR_MULTIPLIER)
// Check if we can take trades
bool canTakeTrades = not na(atrValue)
bgcolor(canTakeTrades ? na : color.red)
//Long pattern
//Two pin bar
onepinbar = (math.min(close,open)-low)/(high-low)>0.6 and math.min(close,open)-low>ta.sma(high-low,14)
twopinbar = onepinbar and onepinbar[1]
notatbottom = low>ta.lowest(low[1],10)
// Parallel
bigred = (open-close)/(high-low)>0.8 and high-low>ta.sma(high-low,14)
biggreen = (close-open)/(high-low)>0.8 and high-low>ta.sma(high-low,14)
parallel = bigred[1] and biggreen
atbottom = low==ta.lowest(low,10)
// Enter long trades (replace this entry condition)
longCondition = parallel
if (longCondition and canTakeTrades and strategy.position_size == 0 and (side == "Long" or side == "Both"))
R:= close-longStop
shares:= risk/R
strategy.entry("Long", strategy.long,qty=shares)
// Enter short trades (replace this entry condition)
shortCondition = parallel
if (shortCondition and canTakeTrades and strategy.position_size == 0 and (side == "Short" or side == "Both"))
R:= shortStop - close
shares:= risk/R
strategy.entry("Short", strategy.short,qty=shares)
// Update trailing stop
if (strategy.position_size > 0)
if (na(trailingStopLoss) or longStop > trailingStopLoss)
trailingStopLoss := longStop
else if (strategy.position_size < 0)
if (na(trailingStopLoss) or shortStop < trailingStopLoss)
trailingStopLoss := shortStop
else
trailingStopLoss := na
// Exit trades with trailing stop
strategy.exit("Long Exit", "Long", stop=trailingStopLoss, limit = E + rr*R )
strategy.exit("Short Exit", "Short", stop=trailingStopLoss, limit = E - rr*R)
//Close trades at RSI extreme
if ta.rsi(high,14)>RSIup and RSIexit == "Yes"
strategy.close("Long")
if ta.rsi(low,14)<RSIdown and RSIexit == "Yes"
strategy.close("Short")
// Draw stop loss
plot(trailingStopLoss, "Stop Loss", color.red, 1, plot.style_linebr)