MT4 MT5 + गतिशील चर के लिए ट्रेडिंगव्यू अलर्ट

लेखक:चाओझांग, दिनांकः 2022-05-24 16:59:00
टैगःएसएमएMT4MT5

संयोग से, मैं खुला स्रोत लाभदायक विदेशी मुद्रा रणनीति साझा कर रहा हूँ. संयोग से, क्योंकि इसका उद्देश्य विशुद्ध रूप से शैक्षिक सामग्री होना था. कुछ दिन पहले ट्रेडिंगव्यू ने पाइनस्क्रिप्ट से गतिशील मूल्यों की एक बहुत शक्तिशाली सुविधा जारी की अब अलर्ट में पारित होने की अनुमति दी जा रही है. और ट्रेडिंगकनेक्टर के लिए धन्यवाद, उन्हें दुनिया में किसी भी ब्रोकर के एमटी 4 या एमटी 5 प्लेटफॉर्म में तुरंत निष्पादित किया जा सकता है. तो हाँ - ट्रेडिंगकनेक्टर सूचकांक और कमोडिटी के साथ भी काम करता है.

इस EURUSD 6h रणनीति का तर्क बहुत सरल है - यह सबसे हाल के पिवोट बिंदु के तहत सेट स्टॉप-लॉस के साथ स्टोकैस्टिक क्रॉसओवर पर आधारित है। अलर्ट में गतिशील मूल्यों की अनुमति के कारण सर्जिकल सटीकता के साथ स्टॉप-लॉस सेट करना संभव है। इन गतिशील मूल्यों का लाभ उठाने के लिए ट्रेडिंगकनेक्टर को भी अपग्रेड किया गया है और यह अब पूर्व-गणित स्टॉप-लॉस, ले-प्रॉफिट, साथ ही स्टॉप और सीमा आदेशों के साथ ट्रेडों को निष्पादित करने में सक्षम बनाता है।

ट्रेडिंगकनेक्टर की एक और नई विशेषता, केवल आंशिक रूप से पदों को बंद कर रही है - बशर्ते कि ब्रोकर इसे अनुमति देता है, निश्चित रूप से। एक स्थिति को प्रवेश पर trade_id निर्दिष्ट करने की आवश्यकता होती है, जो आंशिक समापन के साथ आगे के अलर्ट में संदर्भित होती है। अलर्ट सिंटैक्स और कार्यक्षमताओं का विस्तृत विनिर्देश ट्रेडिंगकनेक्टर वेबसाइट पर पाया जा सकता है। अलर्ट संदेशों में गतिशील चर को कैसे शामिल किया जाए, अलर्टकंडीशन ((() कॉल में स्क्रिप्ट के अंत में देखा जा सकता है।

इस रणनीति में कमीशन को भी ध्यान में रखा गया है।

फिसलन को जानबूझकर 0 पर छोड़ दिया जाता है। ट्रेडिंगकनेक्टर के 1 सेकंड से कम वितरण समय के कारण, फिसलन व्यावहारिक रूप से गैर-मौजूद है। यह विशेष रूप से प्राप्त किया जा सकता है यदि आप VPS सर्वर का उपयोग कर रहे हैं, जो आपके दलालों के समान डेटासेंटर में होस्ट किए गए हैं। मैं इस तरह के सेटअप का उपयोग कर रहा हूं, यह संभव है। छोटे फिसलन और प्रसार पहले से ही कमीशन मूल्य में शामिल हैं।

यह रणनीति NON-REPAINTING है और NO TRAILING-STOP या किसी अन्य विशेषता का उपयोग करती है जो ट्रेडिंग व्यू बैकटेस्टर में दोषपूर्ण है। क्या यह इस रणनीति को बुलेटप्रूफ और 100% सफलता-गारंटी देता है? नरक नहीं! बैकटेस्टिंग के नंबर 1 नियम को याद रखें - कोई फर्क नहीं पड़ता कि स्क्रिप्ट कितना लाभदायक और अच्छा दिखता है, यह केवल अतीत के बारे में बताता है। शून्य गारंटी है कि एक ही रणनीति भविष्य में समान परिणाम प्राप्त करेगी।

इस स्क्रिप्ट को अध्ययन में बदलने के लिए ताकि अलर्ट उत्पन्न किए जा सकें, दो चीजें करें:

  1. शुरुआत में टिप्पणी रणनीति पंक्ति और टिप्पणी नहीं अध्ययन पंक्ति
  2. टिप्पणियों की पंक्तियाँ 54-59 और बिना टिप्पणियों की पंक्तियाँ 62-65. फिर चार्ट में स्क्रिप्ट जोड़ें और अलर्ट कॉन्फ़िगर करें.

यह स्क्रिप्ट केवल शैक्षिक उद्देश्यों के लिए बनाई गई है।

यह निश्चित रूप से वित्तीय सलाह नहीं है। जो कोई भी इस स्क्रिप्ट या इसके किसी भी हिस्से का किसी भी तरह से उपयोग करता है, उसे व्यापार से जुड़े उच्च जोखिमों के बारे में पता होना चाहिए।

धन्यवाद @LucF और @a.tesla2018 कोड फिक्स के साथ मेरी मदद करने के लिए :)

बैकटेस्ट

img


/*backtest
start: 2022-04-23 00:00:00
end: 2022-05-22 23:59:00
period: 15m
basePeriod: 5m
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/
// © Peter_O

//@version=5
strategy(title='TradingView Alerts to MT4 MT5 Strategy example', commission_type=strategy.commission.cash_per_order, commission_value=0.00003, overlay=false, default_qty_value=100000, initial_capital=1000)
//study(title="TradingView Alerts to MT4 MT5 Strategy example")  //uncomment this line and comment previous one to make it a study producing alerts
//
// This script was created for educational purposes only.
// It is showing how to use dynamic variables in TradingView alerts.
// And how to execute them in Forex, indices and commodities markets

TakeProfitDistance = input(400)
TakePartialProfitDistance = input(150)

// **** Entries logic **** {
periodK = input.int(13, title='K', minval=1)
periodD = input.int(3, title='D', minval=1)
smoothK = input.int(4, title='Smooth', minval=1)
k = ta.sma(ta.stoch(close, high, low, periodK), smoothK)
d = ta.sma(k, periodD)
plot(k, title='%K', color=color.new(color.blue, 0))
plot(d, title='%D', color=color.new(color.orange, 0))
h0 = hline(80)
h1 = hline(20)
fill(h0, h1, color=color.new(color.purple, 75))

GoLong = ta.crossover(k, d) and k < 80
GoShort = ta.crossunder(k, d) and k > 20
// } End of entries logic

// **** Pivot-points and stop-loss logic **** {
piv_high = ta.pivothigh(high, 1, 1)
piv_low = ta.pivotlow(low, 1, 1)
var float stoploss_long = low
var float stoploss_short = high

pl = ta.valuewhen(piv_low, piv_low, 0)
ph = ta.valuewhen(piv_high, piv_high, 0)

if GoLong
    stoploss_long := low < pl ? low : pl
    stoploss_long
if GoShort
    stoploss_short := high > ph ? high : ph
    stoploss_short
// } End of Pivot-points and stop-loss logic

strategy.entry('Long', strategy.long, when=GoLong)
strategy.exit('XPartLong', from_entry='Long', qty_percent=50, profit=TakePartialProfitDistance)
strategy.exit('XLong', from_entry='Long', stop=stoploss_long, profit=TakeProfitDistance)
strategy.entry('Short', strategy.short, when=GoShort)
strategy.exit('XPartShort', from_entry='Short', qty_percent=50, profit=TakePartialProfitDistance)
strategy.exit('XShort', from_entry='Short', stop=stoploss_short, profit=TakeProfitDistance)

if GoLong
    alertsyntax_golong = 'long slprice=' + str.tostring(stoploss_long) + ' tp1=' + str.tostring(TakePartialProfitDistance) + ' part1=0.5 tp=' + str.tostring(TakeProfitDistance)
    alert(message=alertsyntax_golong, freq=alert.freq_once_per_bar_close)
if GoShort
    alertsyntax_goshort = 'short slprice=' + str.tostring(stoploss_short) + ' tp1=' + str.tostring(TakePartialProfitDistance) + ' part1=0.5 tp=' + str.tostring(TakeProfitDistance)
    alert(message=alertsyntax_goshort, freq=alert.freq_once_per_bar_close)


if GoLong
    strategy.entry("Enter Long", strategy.long)
else if GoShort
    strategy.entry("Enter Short", strategy.short)

संबंधित

अधिक