یہ حکمت عملی لچکدار اسٹاپ نقصان کے اشارے پر مبنی ہے ، خریدنے اور بیچنے کے سگنل مرتب کرتی ہے ، طویل پوزیشن اور مختصر پوزیشن پر کام کرتی ہے۔ جب اشارے خریدنے کا اشارہ دیتے ہیں تو ، زیادہ کام کرتے ہیں ، جب فروخت کا اشارہ دیتے ہیں تو ، خالی ہوجاتے ہیں۔ حکمت عملی میں ٹریکنگ اسٹاپ نقصان کا طریقہ کار بھی شامل ہے ، جو خطرے کو مؤثر طریقے سے کنٹرول کرسکتا ہے۔
یہ حکمت عملی بنیادی طور پر رجحانات کی شناخت کے لچکدار اسٹاپ نقصان کے اشارے کا استعمال کرتی ہے ، اور اس کے برعکس کام کرتی ہے۔ انتہائی قیمت کی شناخت کے لئے اشارے کے اندر اندر حقیقی حد کے اشارے کا استعمال کیا جاتا ہے ، جب قیمت انتہائی حد سے تجاوز کرتی ہے تو اسے غیر معمولی توڑ سمجھا جاتا ہے ، اور رجحان کو تبدیل کرنے کا امکان ہے۔ خاص طور پر ، اشارے کے اندر اندر دو متغیرات برقرار رکھے جاتے ہیں: انتہائی قیمت (EP) اور ٹرگر قیمت (TP) ۔ EP موجودہ رجحان کے تحت اعلی ترین قیمت یا کم سے کم قیمت کی نمائندگی کرتا ہے۔
جب قیمت ای پی سے زیادہ ہوتی ہے تو اس کو ایک غیر معمولی توڑ سمجھا جاتا ہے ، اس وقت ای پی کو اعلی ترین قیمت اور ٹی پی کو کم ترین قیمت کے طور پر اپ ڈیٹ کیا جاتا ہے۔ جب قیمت ٹی پی سے کم ہوتی ہے تو ، اس رجحان کو الٹ دیا جاتا ہے ، جس سے فروخت کا اشارہ ملتا ہے۔
اس حکمت عملی میں ٹریکنگ اسٹاپ کا طریقہ کار شامل ہے ، جب پوزیشن کھولی جاتی ہے تو ، یہ حقیقی وقت میں بہترین اسٹاپ کی قیمت کا سراغ لگاتا ہے ، منافع کی ضمانت دیتے ہوئے خطرے پر قابو پالتا ہے۔ خاص طور پر ، زیادہ کرنے کے بعد ، اسٹاپ لائن اختتامی کم سے کم کی پیروی کرتی ہے۔ جب بند ہوجاتا ہے تو ، اسٹاپ لائن اختتامی اونچائی کی پیروی کرتی ہے۔
یہ حکمت عملی مندرجہ ذیل فوائد رکھتی ہے:
ٹرینڈ ریورس پوائنٹس کی نشاندہی کرنے والے اشارے کا استعمال کرتے ہوئے ، آپ کو آسانی سے قید نہیں کیا جاسکتا ہے۔
نقصانات کو روکنے کے لئے ٹریکنگ میکانزم، منافع کو روکنے اور نقصانات کو بڑھانے سے بچنے کے لئے.
انڈیکس پیرامیٹرز سادہ اور آسان ہیں.
خرید و فروخت کے اشارے کی تشکیل ، کام کرنے میں آسان۔
لچکدار تعیناتی کی مدت کے ساتھ ، حکمت عملی کے اثرات کا جامع اندازہ لگایا جاسکتا ہے۔
اس حکمت عملی کے کچھ خطرات بھی ہیں:
انڈیکیٹر کے پیچھے رہ جانے کی وجہ سے ، رجحان کی تبدیلی کا بہترین نقطہ نظر نظر سے باہر ہوسکتا ہے۔
اسٹاپ نقصانات بہت زیادہ جارحانہ ہیں اور قیمتوں میں قلیل مدتی اتار چڑھاؤ سے متاثر ہوسکتے ہیں۔
اس کے نتیجے میں، آپ کو آپ کی حکمت عملی کے اثرات کا اندازہ کرنے کے لئے غیر مناسب پیمائش کی مدت کا انتخاب کرنا پڑے گا.
منافع پر ٹرانزیکشن لاگت کے اثرات پر توجہ دینا ضروری ہے۔
خطرے کا مقابلہ کرنے کے لئے ، آپ کو مندرجہ ذیل طریقوں سے بہتر بنایا جاسکتا ہے:
پیمائش کے پیرامیٹرز کو ایڈجسٹ کریں اور تاخیر کو کم کریں۔
اس کے علاوہ ، اس نے اپنے ٹریفک کو بہتر بنانے کے لئے نقصانات کو روکنے کے لئے الگورتھم کو بہتر بنایا ہے۔
مناسب جانچ پڑتال کے دورانیے کو منتخب کریں ، تاکہ آپ کی ساکھ کو یقینی بنایا جاسکے۔
پوزیشن مینجمنٹ کو بہتر بنانا اور ٹرانزیکشن لاگت کو کم کرنا۔
اس حکمت عملی کو مزید بہتر بنایا جاسکتا ہے:
رجحان کے اشارے کے ساتھ مل کر ، الٹا تجارت سے بچنے سے بچیں۔ بڑے رجحان کا تعین کرنے کے لئے ایم اے جیسے اشارے شامل کیے جاسکتے ہیں۔
پوزیشن مینجمنٹ الگورتھم کو بہتر بنائیں ، جیسے فکسڈ تناسب پوزیشن ، متحرک پوزیشن وغیرہ۔
ٹرانزیکشن حجم فلٹر شامل کریں تاکہ غلط ٹرانزیکشن سے بچایا جاسکے۔
پیرامیٹرز کو بہتر بنانے کے لئے ، بہترین پیرامیٹرز کا مجموعہ تلاش کریں۔
ٹرینڈ کو روکنے کی حکمت عملی میں شامل ہوں۔
اسٹاپ نقصان کی حکمت عملی کو بہتر بنائیں تاکہ اسٹاپ نقصان کو ہموار بنایا جاسکے۔
تجارتی اقسام اور ٹائم فریموں کو بہتر بنانا اور حکمت عملی کو بہتر بنانا۔
مشین لرننگ الگورتھم کو شامل کریں تاکہ حکمت عملی زیادہ انکولی ہو۔
یہ حکمت عملی مجموعی طور پر آسان اور قابل اعتماد ہے ، لچکدار اسٹاپ نقصان کے اشارے کا استعمال کرتے ہوئے ٹرن آؤٹ پوائنٹس کی شناخت کرتا ہے ، اور اسٹاپ نقصان کے طریقہ کار کو کنٹرول کرنے کے خطرے کو ٹریک کرنے کے لئے تیار ہے ، اور اسے شارٹ لائن ریورسنگ حکمت عملی کے طور پر استعمال کیا جاسکتا ہے۔ تاہم ، اشارے کے پیچھے پڑنے ، اسٹاپ نقصان کے زیادہ شدت پسندی جیسے مسائل پر بھی توجہ دینے کی ضرورت ہے۔ مزید اصلاح کے ذریعہ ، بہتر حکمت عملی کے نتائج کی توقع کی جاسکتی ہے۔
This strategy is based on the Parabolic SAR indicator to generate buy and sell signals for long and short positions. It also incorporates a trailing stop loss mechanism to effectively control risks.
The core of this strategy is to identify trend reversal points using the Parabolic SAR indicator for counter-trend trading. The indicator uses the true range to detect extreme prices. When the price exceeds the extreme, it is considered a breakout and a sign of potential trend reversal. Specifically, the indicator maintains two variables: the Extreme Price (EP) and the Trigger Price (TP). The EP represents the highest/lowest price of the current trend, while the TP is derived from the EP.
In an uptrend, when the price is higher than the EP, it is considered a breakout. The EP is then updated to the highest price and the TP to the lowest price. When the price falls below the TP, a trend reversal is identified and a sell signal is generated. The same principle applies for a downtrend.
The strategy also incorporates a trailing stop loss mechanism. After opening a position, it will track the optimal stop loss price in real-time, locking in profits while controlling risks. Specifically, after long entry, the stop loss tracks the closing low; after short entry, it tracks the closing high.
The main advantages of this strategy are:
Identify trend reversal points with the indicator, avoiding being trapped in trends.
Trailing stop loss locks in profits and prevents wider losses.
Simple indicator parameters, easy to implement.
Configurable buy/sell signal alerts for convenience.
Flexible backtest period configuration for thorough evaluation.
There are also some risks to consider:
Indicator lag may miss optimal reversal points.
Aggressive stops may be stopped out by short-term fluctuations.
Improper backtest period selection cannot fully evaluate the strategy.
Transaction costs may impair profits.
Some ways to address the risks are:
Optimize parameters to reduce lag.
Improve stop loss algorithm to avoid being stopped out unnecessarily.
Select appropriate backtest periods for reliability.
Optimize position sizing to lower transaction costs.
Some ways to further optimize the strategy:
Incorporate trend indicators like MA to avoid being trapped in countertrends.
Optimize position sizing algorithms, e.g. fixed fractional, dynamic.
Add volume filter to avoid false signals from gaps.
Parameter optimization to find optimal combinations.
Implement profit taking strategies to lock in profits in trends.
Refine stop loss algorithms for smoother stops. Experiment with Chandelier Exit etc.
Optimize across products, time frames etc. to improve adaptability.
Incorporate machine learning for greater adaptability.
In summary, this is a simple and robust strategy using the Parabolic SAR to identify reversals and trailing stop loss to control risk. It can work as a short-term mean-reversion strategy. But indicator lag and oversensitive stops need to be addressed. Further optimizations can lead to improved performance.
/*backtest
start: 2023-09-10 00:00:00
end: 2023-10-10 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("PB SAR BackTest - Colorbar", overlay=false)
// Full credit to Sawcruhteez, Lucid Investment Strategies LLC, Casey Bowman and Peter Brandt.
// This is a strategy version of the Peterbolic SAR indicator created by the above-mentioned parties.
// Original version of the indicator: https://www.tradingview.com/script/6nYrH3Vm-Peterbolic-SAR/
// SAR #1
// Lucid Sar
// Branded under the name "Lucid SAR"
// as agreed to with Lucid Investment Strategies LLC on July 9, 2019
// https://lucidinvestmentstrategies.com/
// see branch "lucid"
// SAR #2
// Peterbolic Sar
// Using the name "Peterbolic SAR"
// as agreed to by Peter Brandt on October 2, 2019
// - https://twitter.com/PeterLBrandt/status/1179365590668075008
// in response to request from Sawcruhteez
// - https://twitter.com/Sawcruhteez/status/1179213105705836544
// Sawcruhteez gives credit to @CrazyGabey for coming up with the name
// - https://twitter.com/Sawcruhteez/status/1179213196583940097
// see branch "peterbolic"
// SAR #3
// Sawcruhteez Sar
// Branded under the name "Sawcruhteez SAR"
// as agreed to with Sawcruhteez on September 11, 2019
// see branch "sawcruhteez"
// Open Source on github
// https://github.com/casey-bowman/sar/blob/peterbolic/peterbolic.pine
// Created by Casey Bowman on July 4, 2019
// MIT License
// Copyright (c) 2019 Casey Bowman
// 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.
TSR() =>
// start with uptrend
var uptrend = true
var EP = high // extreme price - high or low depending on trend
var SP = low // setup price
var TP = float(na) // trigger price
var setup = low
var trigger = float(na)
if barstate.isnew
setup := low
trigger = float(na)
extreme_candle = false
first_extreme_candle = false
setup_candle = false
trigger_candle = false
waiting_for_setup = false
waiting_for_trigger = false
var since_extreme = 0
var since_setup = 0
waiting_for_setup := not extreme_candle and not na(SP)
waiting_for_trigger := not na(TP)
if not barstate.isfirst
if barstate.isnew and extreme_candle[1]
trigger := float(na)
if barstate.isnew and setup_candle[1]
setup := float(na)
if barstate.isnew and waiting_for_trigger
since_setup := since_setup + 1
trigger := TP
if barstate.isnew and waiting_for_setup
since_extreme := since_extreme + 1
setup := SP
if uptrend
if extreme_candle
EP := high
SP := low
else
if high > EP
extreme_candle := true
EP := high
SP := low
since_extreme := 0
since_setup := 0
else
if waiting_for_setup
if barstate.isconfirmed
if close < SP
setup_candle := true
SP := float(na)
TP := low
if waiting_for_trigger
if low < TP
trigger_candle := true
extreme_candle := true
EP := low
SP := high
TP := float(na)
uptrend := false
since_extreme := 0
since_setup := 0
else
if barstate.isconfirmed and extreme_candle
TP := float(na)
trigger := float(na)
else
if extreme_candle
EP := low
SP := high
else
if low < EP
extreme_candle := true
EP := low
SP := high
since_extreme := 0
since_setup := 0
else
if waiting_for_setup
if barstate.isconfirmed
if close > SP
setup_candle := true
SP := float(na)
TP := high
if waiting_for_trigger
if high > TP
trigger_candle := true
extreme_candle := true
EP := high
SP := low
TP := float(na)
uptrend := true
since_extreme := 0
since_setup := 0
else
if barstate.isconfirmed and extreme_candle
TP := float(na)
trigger := float(na)
[trigger_candle, trigger, since_setup, setup_candle, setup, since_extreme, extreme_candle, uptrend]
[TC, T, SS, SC, S, SE, EC, up] = TSR()
// Make input options that configure backtest date range
StartMonth = input(title="Start Month", type=input.integer,
defval=1, minval=1, maxval=12)
StartDate = input(title="Start Date", type=input.integer,
defval=1, minval=1, maxval=31)
StartYear = input(title="Start Year", type=input.integer,
defval=(2019), minval=1800, maxval=2100)
EndMonth = input(title="End Month", type=input.integer,
defval=1, minval=1, maxval=12)
EndDate = input(title="End Date", type=input.integer,
defval=1, minval=1, maxval=31)
EndYear = input(title="End Year", type=input.integer,
defval=(2020), minval=1800, maxval=2100)
// Look if the close time of the current bar falls inside the date range
inDateRange = true
buytrigger = (TC and up)
selltrigger = (TC and not up)
buysetup = (SC and not up)
sellsetup = (SC and up)
IntBuy = buytrigger ? 1 : 0
IntSB = buysetup ? 0.5 : 0
IntSell= selltrigger ? -1 : 0
IntSS = sellsetup ? -0.5 : 0
bgcolor = buytrigger ? color.green : selltrigger ? color.red : buysetup ? color.yellow : sellsetup ? color.orange : color.black
trans = buytrigger ? 20 : selltrigger ? 20 : 100
bgcolor(bgcolor, 30)
NUM = IntBuy + IntSB + IntSell + IntSS
linecolor = color.orange
plot(NUM, color=linecolor, linewidth=2)
alertcondition(NUM > 0.5, title="Buy Signal", message="Buy Alert")
alertcondition(NUM < -0.5, title="Sell Signal", message="Sell Alert")
alertcondition(NUM == 0.5, title="Buy Setup", message="Buy Setup")
alertcondition(NUM == -0.5, title="Sell Setup", message="Sell Setup")
//Switch on for strategy moves
if(inDateRange and buytrigger)
strategy.exit("SHORT", "SHORT_SL", comment="Short_Exit")
strategy.entry("LONG", strategy.long, comment="")
if(inDateRange and selltrigger)
strategy.exit("LONG", "LONG_SL", comment="Long_Exit")
strategy.entry("SHORT", strategy.short, comment="")
if (not inDateRange)
strategy.close_all()
// plotshape(SC and not up, color = color.yellow, style = shape.triangleup, location = location.belowbar, size = size.auto, transp = 0, title = "Setup to Buy")
// plotshape(TC and up, color = color.green, style = shape.triangleup, location = location.belowbar, size = size.auto, title = "Trigger to Buy")
// plotshape(SC and up, color = color.yellow, style = shape.triangledown, location = location.abovebar, size = size.auto, transp = 0, title = "Setup to Sell")
// plotshape(TC and not up, color = color.red, style = shape.triangledown, location = location.abovebar, size = size.auto, title = "Trigger to Sell")