ٹریل خریدنے کی حکمت عملی ایک رجحان کی پیروی کرنے کی حکمت عملی ہے۔ جب ایک تیز رفتار حرکت پذیر اوسط پر ایک سست رفتار حرکت پذیر اوسط سے گزرتا ہے تو ، پوزیشن کھولنے کا اشارہ ہوتا ہے۔ براہ راست پوزیشن کھولنے کے برعکس ، یہ حکمت عملی پوزیشن کھولنے کے اشارے کے بعد فوری طور پر داخل نہیں ہوتی ہے ، بلکہ قیمت پر کچھ شرائط پوری ہونے کے بعد ہی خریداری پر عملدرآمد کرتی ہے۔
یہ حکمت عملی دو حرکت پذیر اوسط اوسط کراسنگ سسٹم پر مبنی ہے۔ تیز رفتار اور آہستہ چلنے والی اوسط کا حساب لگانا ، اور جب تیز رفتار حرکت پذیر اوسط پر آہستہ چلنے والی اوسط کو عبور کیا جاتا ہے تو متعدد سگنل دیئے جاتے ہیں۔
ٹریکنگ کے اختیارات کو چالو کرنے کے بعد، حکمت عملی پر عملدرآمد کی منطق مختلف ہوتی ہے:
جب ملٹی سگنل ٹرگر ہوتا ہے تو ، فوری طور پر خریدنے کی بجائے ، اس وقت کی کم سے کم قیمت درج کی جاتی ہے۔
اس کے بعد ٹریکنگ خریدنے کی ترتیب کا فی صد کی بنیاد پر خریدنے کی قیمت کی کمی، کم از کم قیمت کا حساب لگایا جاتا ہے*(1+ فیصد)
اس کے بعد کی لائن میں ، موجودہ کی لائن کی کم از کم قیمت اور خریداری کی قیمت کی قدر میں کمی کا مستقل موازنہ کریں۔
جب کم سے کم قیمت پر خرید خرید قیمت کی کمی ہو تو خرید کو انجام دینا۔
اس طرح ، رجحانات کی تصدیق کے بعد ، ایک بہتر قیمت پر داخلے کا انتخاب کیا جاسکتا ہے۔
یہ حکمت عملی مندرجہ ذیل فوائد رکھتی ہے:
ٹریکنگ خریدنے سے ، رجحانات واضح ہونے کے بعد داخلہ لیا جاسکتا ہے ، اور اس طرح جعلی توڑنے سے پیدا ہونے والے خطرات سے بچا جاسکتا ہے۔
ٹریک خریدنے سے ، آپ کو بہتر قیمتوں پر داخلے کی اجازت مل سکتی ہے ، جس سے آپ کو کچھ حد تک منافع ملتا ہے۔
اس حکمت عملی کو سمجھنے اور اس پر عمل کرنے میں بہت آسان ہے۔
اپنی مرضی کے مطابق ٹریکنگ خریدنے کی شرح، حکمت عملی کو زیادہ لچکدار بنانے کے لئے.
اپنی مرضی کے مطابق چلتی اوسط کی مدت مختلف مارکیٹ کے حالات کے لئے موزوں ہے۔
اس حکمت عملی میں کچھ خطرات بھی ہیں:
ٹریک خرید کو اپنانے سے کچھ تاخیر ہوسکتی ہے ، اور آپ کو داخلے کا موقع ضائع ہوسکتا ہے۔
آپ کی خریداریوں کو ٹریک کرنے کے لئے غلط فی صد سیٹ اپ کی وجہ سے، آپ کو خریدنے کے لئے ہمیشہ کی ناکامی کا سامنا کرنا پڑتا ہے.
غلط طریقے سے سیٹ کردہ اوسطا اوسط کی مدت زیادہ جعلی سگنل پیدا کرسکتی ہے۔
اس حکمت عملی کو زلزلے کی صورت میں نقصان اٹھانا پڑ سکتا ہے۔
یہ حکمت عملی نسبتاً آسان ہے اور اس میں سپر پیرامیٹرز کی اصلاح کی گنجائش ہے۔
خطرے سے نمٹنے کے لئے، مندرجہ ذیل اقدامات کئے جا سکتے ہیں:
مناسب طریقے سے ٹریکنگ خریداریوں کے فیصد کو کم کریں اور تاخیر کو کم کریں۔
مختلف فیصد کی ترتیبات کو آزمائیں اور بہترین پیرامیٹرز تلاش کریں۔
مارکیٹ کے حالات کے مطابق منتقل اوسط سائیکل کو بہتر بنائیں۔
فلٹرنگ کے اضافی حالات شامل کریں تاکہ زلزلے سے بچ سکیں۔
نقصان کو کم کرنے کے لئے اسٹاپ نقصان کو شامل کرنے پر غور کیا جاسکتا ہے۔
اس حکمت عملی کو مندرجہ ذیل طریقوں سے بہتر بنایا جاسکتا ہے:
گرمی کی سطح کے مساوی قیمت کے اشارے میں اضافہ کریں ، تاکہ قیمتوں میں عدم مطابقت پیدا نہ ہو۔
اگر آپ کے کاروبار میں اضافہ ہوتا ہے تو ، آپ صرف اس وقت خریدتے ہیں جب آپ کے کاروبار میں اضافہ ہوتا ہے۔
مختلف نسلوں کے لئے موزوں حرکت پذیر اوسط کی مدت پیرامیٹرز کو بہتر بنائیں۔
ہلچل کے اشارے میں اضافہ کریں تاکہ ہلچل کے وقفے سے بچا جاسکے۔
اے ٹی آر میں شامل ہوں
اس کے علاوہ، آپ کو ایک رجحان کے طور پر تیزی سے آگے بڑھنے کے لئے ایک رجحان کے طور پر تیزی سے آگے بڑھنے کے لئے ایک رجحان کے طور پر تیزی سے آگے بڑھنے کے لئے ایک رجحان کے طور پر تیزی سے آگے بڑھنے کے لئے ایک رجحان کے طور پر تیزی سے آگے بڑھنے کے لئے ایک رجحان کے طور پر آگے بڑھنے کے لئے ایک رجحان کے طور پر آگے بڑھنے کے لئے ایک رجحان کے طور پر آگے بڑھنے کے لئے ایک رجحان کے طور پر آگے بڑھنے کے لئے ایک رجحان کے طور پر آگے بڑھنے کے لئے ایک رجحان کے طور پر آگے بڑھنے کے لئے ایک رجحان کے طور پر آگے بڑھنے کے لئے ایک رجحان کے طور پر آگے بڑھنے کے لئے ایک رجحان کے طور پر آگے بڑھنے کے لئے ایک رجحان کے طور پر آگے بڑھنے کے لئے ایک رجحان کے طور پر.
خلاصہ یہ ہے کہ ، خریداری کی حکمت عملی کو ٹریک کرنے کی حکمت عملی کو بہتر اندراج کے نقطہ تک پہنچنے والی قیمتوں کو ٹریک کرنے کی حکمت عملی میں بہتری لائی گئی ہے۔ اس حکمت عملی کو آسان رکھنے کی بنیاد پر حکمت عملی کی آمدنی میں اضافہ کیا گیا ہے۔ تاہم ، اس حکمت عملی میں کچھ خطرات بھی ہیں ، جس میں مزید مارکیٹ کے حالات کے مطابق ڈھالنے کے لئے مزید اصلاحات کی ضرورت ہے۔ مجموعی طور پر ، یہ حکمت عملی مقدار کی تجارت کے لئے ایک قابل قدر سوچ پیش کرتی ہے۔
/*backtest
start: 2023-10-01 00:00:00
end: 2023-10-08 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// -----------------------------------------------------------------------------
// Copyright 2022 Iason Nikolas | jason5480
// Trailing Buy script may be freely distributed under the MIT license.
//
// Permission is hereby granted, free of charge,
// to any person obtaining a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// -----------------------------------------------------------------------------
//
// Authors: @jason5480
// Revision: v1.0.0
// Date: 15-Feb-2022
//
// Description
// =============================================================================
// This strategy will go long if fast MA crosses over slow MA.
// If the trailing buy is checked then the strategy instead of entering into the position
// directly it will follow the price downwards (percentagewise) with small steps
// If the price raise by this percentage then the entry order will be executed
//
// The strategy has the following parameters:
//
// Fast SMA Length - How many candles back to calculte the fast SMA.
// Slow SMA Length - How many candles back to calculte the slow SMA.
// Enable Trailing - Enable or disable the trailing
// Training Buy Deviation % - The step to follow the price when the open position condition is met.
// Source Buy - The price to compare the current buyPrice in order to trigger the buy order when trailing
//
// -----------------------------------------------------------------------------
// Disclaimer:
// 1. I am not licensed financial advisors or broker dealer. I do not tell you
// when or what to buy or sell. I developed this software which enables you
// execute manual or automated using TradingView. The
// software allows you to set the criteria you want for entering and exiting
// trades.
// 2. Do not trade with money you cannot afford to lose.
// 3. I do not guarantee consistent profits or that anyone can make money with no
// effort. And I am not selling the holy grail.
// 4. Every system can have winning and losing streaks.
// 5. Money management plays a large role in the results of your trading. For
// example: lot size, account size, broker leverage, and broker margin call
// rules all have an effect on results. Also, your Take Profit and Stop Loss
// settings for individual pair trades and for overall account equity have a
// major impact on results. If you are new to trading and do not understand
// these items, then I recommend you seek education materials to further your
// knowledge.
//
// YOU NEED TO FIND AND USE THE TRADING SYSTEM THAT WORKS BEST FOR YOU AND YOUR
// TRADING TOLERANCE.
//
// I HAVE PROVIDED NOTHING MORE THAN A TOOL WITH OPTIONS FOR YOU TO TRADE WITH THIS PROGRAM ON TRADINGVIEW.
//
// I accept suggestions to improve the script.
// If you encounter any problems I will be happy to share with me.
// -----------------------------------------------------------------------------
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// SETUP ============================================================================================================
strategy(title = 'Trailing Buy',
shorttitle = 'TB',
overlay = true,
pyramiding = 0,
default_qty_type = strategy.percent_of_equity,
default_qty_value = 100,
initial_capital = 100000)
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// FILTERS ==========================================================================================================
// INPUT ============================================================================================================
usefromDate = input.bool(defval = true, title = 'From', inline = "From Date", group = "Filters")
fromDate = input(defval = timestamp('01 Jan 2021 00:00 UTC'), title = '', inline = "From Date", group = 'Filters')
usetoDate = input.bool(defval = false, title = 'To ', inline = "To Date", group = "Filters")
toDate = input(defval = timestamp('31 Dec 2121 23:59 UTC'), title = '', inline = "To Date", group = 'Filters')
// LOGIC ============================================================================================================
isWithinPeriod() => true
// PLOT =============================================================================================================
bgcolor(color = isWithinPeriod() ? color.new(color.gray, 90) : na, title = 'Period')
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// STRATEGY =========================================================================================================
// INPUT ============================================================================================================
fastMALen = input.int(defval = 21, title = 'Fast/Slow SMA Length', inline = 'MA Length', group = 'Strategy')
slowMALen = input.int(defval = 49, title = '', tooltip = 'How many candles back to calculte the fast/slow SMA.', inline = 'MA Length', group = 'Strategy')
// LOGIC ============================================================================================================
fastMA = ta.sma(close, fastMALen)
slowMA = ta.sma(close, slowMALen)
bool openLongPosition = isWithinPeriod() and ta.crossover(fastMA, slowMA)
bool closeLongPosition = ta.crossunder(fastMA, slowMA)
bool longIsActive = openLongPosition or strategy.position_size > 0
// PLOT =============================================================================================================
var fastColor = color.new(#0056BD, 0)
plot(series = fastMA, title = 'Fast SMA', color = fastColor, linewidth = 1, style = plot.style_line)
var slowColor = color.new(#FF6A00, 0)
plot(series = slowMA, title = 'Slow SMA', color = slowColor, linewidth = 1, style = plot.style_line)
plotshape(series = openLongPosition and strategy.position_size <= 0 ? fastMA : na, title = 'Buy', text = 'Buy', style = shape.labelup, location = location.absolute, color = color.new(color.green, 0), textcolor = color.new(color.white, 0), size = size.tiny)
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// BUY ==============================================================================================================
// INPUT ============================================================================================================
enableTrailing = input.bool(defval = true, title = 'Enable Trailing', tooltip = 'Enable or disable the trailing for buy.', group = 'Buy')
trailingBuyDeviationPerc = input.float(defval = 4.0, title = 'Trailing Buy Deviation %', minval = 0.01, maxval = 100, step = 0.05, tooltip = 'The step to follow the price when the open position condition is met.', group = 'Buy') / 100
srcBuy = input.source(defval = high, title = 'Source Buy', tooltip = 'The price to check to trigger the buy order', group = 'Buy')
// LOGIC ============================================================================================================
int barsSinceOpenLong = nz(ta.barssince(openLongPosition), 999999)
int barsSinceCloseLong = nz(ta.barssince(closeLongPosition), 999999)
bool tryOpenLongPosition = isWithinPeriod() and barsSinceCloseLong >= barsSinceOpenLong and not (strategy.position_size > 0)
float longBuyPrice = na
longBuyPrice := if openLongPosition and not (strategy.position_size > 0)
low * (1 + trailingBuyDeviationPerc)
else if tryOpenLongPosition
math.min(low * (1 + trailingBuyDeviationPerc), nz(longBuyPrice[1], 999999))
else
na
bool executeLongPosition = enableTrailing ? isWithinPeriod() and srcBuy > longBuyPrice : openLongPosition
// PLOT =============================================================================================================
var buyColor = color.new(#419388, 0)
plot(series = enableTrailing ? longBuyPrice : na, title = 'Long Buy Price', color = buyColor, linewidth = 1, style = plot.style_linebr, offset = 1)
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// POSITION ORDERS ==================================================================================================
// LOGIC ============================================================================================================
// getting into LONG position
strategy.entry(id = 'Long Entry', direction = strategy.long, when = executeLongPosition, alert_message = 'Long(' + syminfo.ticker + '): Started')
// submit close order on trend reversal
strategy.close(id = 'Long Entry', when = closeLongPosition, comment = 'Close Long', alert_message = 'Long(' + syminfo.ticker + '): Closed at market price')
// PLOT =============================================================================================================
var posColor = color.new(color.white, 0)
plot(series = strategy.position_avg_price, title = 'Position', color = posColor, linewidth = 1, style = plot.style_linebr)
// ==================================================================================================================