यह रणनीति एक बहुआयामी निर्णय प्रणाली है जो चलती औसत के क्रॉसिंग पर आधारित है। यह रणनीति विभिन्न प्रकार के चलती औसत को चुनने की अनुमति देती है और लंबी अवधि के चलती औसत मापदंडों को कॉन्फ़िगर कर सकती है, जिससे खरीद और बेचने के संकेत उत्पन्न होते हैं। इसके अलावा, यह रणनीति ट्रेंड फ़िल्टर विकल्प प्रदान करती है, जिससे ट्रेडिंग सिग्नल को ट्रेंड की दिशा के अनुरूप होना चाहिए।
इस रणनीति का मूल तर्क दो चलती औसत के क्रॉसिंग पर आधारित है जो व्यापारिक संकेत उत्पन्न करता है।
इसके अलावा, रणनीति चार प्रकार के चलती औसत प्रकारों की एक विकल्प प्रदान करती है, जिसमें सरल चलती औसत (एसएमए), सूचकांक चलती औसत (ईएमए), भारित चलती औसत (डब्ल्यूएमए) और मात्रात्मक चलती औसत (वीडब्ल्यूएमए) शामिल हैं। उपयोगकर्ता को अल्पकालिक और दीर्घकालिक औसत के प्रकारों को कॉन्फ़िगर करने की स्वतंत्रता है।
इसके अलावा, रणनीति तीन प्रकार के संचालन मोड प्रदान करती हैः केवल अधिक, केवल शून्य और पूर्ण शून्य। यह उपयोगकर्ताओं को बाजार की स्थिति के आधार पर अलग-अलग ट्रेडिंग दिशाओं का चयन करने की अनुमति देता है।
अंत में, रणनीति में एक प्रवृत्ति फ़िल्टरिंग सुविधा शामिल की गई है। इस सुविधा के लिए ट्रेडिंग सिग्नल को प्रवृत्ति की दिशा के अनुरूप होना चाहिए, अन्यथा सिग्नल को अनदेखा किया जाता है। विशेष रूप से, जब विकल्प को ऊपर की ओर सेट किया जाता है, तो मल्टीहेड सिग्नल केवल तभी उत्पन्न होता है जब कीमत प्रवृत्ति की औसत रेखा से ऊपर होती है; और जब विकल्प को नीचे की ओर सेट किया जाता है, तो केवल तभी खाली सिर सिग्नल उत्पन्न होता है जब कीमत प्रवृत्ति की औसत रेखा से नीचे होती है।
इस रणनीति का सबसे बड़ा लाभ यह है कि यह पैरामीटर और लचीला है। एक सबसे बुनियादी तकनीकी संकेतक के रूप में, चलती औसत का व्यापक रूप से मात्रात्मक व्यापार में उपयोग किया जाता है। यह रणनीति एक अत्यधिक विन्यास योग्य चलती औसत क्रॉसिंग प्रणाली प्रदान करती है, जिससे उपयोगकर्ता को विभिन्न बाजार स्थितियों के लिए पैरामीटर को समायोजित करने की क्षमता मिलती है।
विशेष रूप से, इस रणनीति के लाभों में शामिल हैंः
कुल मिलाकर, यह रणनीति एक बहुत ही लचीली और अनुकूलन योग्य चलती औसत क्रॉसिंग प्रणाली है जिसे उपयोगकर्ता किसी भी निश्चित पैटर्न तक सीमित होने के बजाय बाजार के अपने निर्णय के अनुसार समायोजित कर सकते हैं।
इस रणनीति के मुख्य जोखिमों में शामिल हैंः
उपरोक्त जोखिमों के लिए, इस नीति में निम्नलिखित समाधान दिए गए हैंः
इस रणनीति को निम्नलिखित आयामों से अनुकूलित किया जा सकता हैः
उपरोक्त बिंदुओं के अनुकूलन के माध्यम से, सिस्टम को बेहतर जोखिम प्रबंधन तंत्र, अधिक स्थिरता और बाजार में बदलाव के लिए अधिक अनुकूलन क्षमता के साथ बनाया जा सकता है।
यह एक बहुत ही विशिष्ट ट्रेंड फॉलोइंग रणनीति है। यह सरल, लचीला और समझने में आसान है, और एक अत्यधिक विन्यास योग्य ट्रेडिंग सिस्टम प्रदान करता है। उपयोगकर्ता बाजार की स्थिति के आधार पर उपयुक्त चलती औसत संयोजन, पैरामीटर को समायोजित करने, बहु-क्षेत्र ट्रेडिंग दिशाओं को कॉन्फ़िगर करने आदि का चयन कर सकते हैं। बेशक, उपयोगकर्ता अपने ट्रेंड फॉलोइंग लाभ को बनाए रखते हुए, अन्य तकनीकी संकेतकों को जोड़कर सिस्टम को समृद्ध कर सकते हैं, जिससे यह एक अधिक व्यापक और विश्वसनीय मात्रात्मक ट्रेडिंग रणनीति बन जाए।
/*backtest
start: 2023-09-08 00:00:00
end: 2023-10-08 00:00:00
period: 3h
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/
// © GlobalMarketSignals
//@version=4
strategy("GMS: Moving Average Crossover Strategy", overlay=true)
LongShort = input(title="Long Only or Short Only or Both?", type=input.string, defval="Both", options=["Both", "Long Only", "Short Only"])
MAs1 = input(title="Which Moving Average? (1)", type=input.string, defval="SMA", options=["SMA", "EMA", "WMA", "VWMA"])
MAs2 = input(title="Which Moving Average? (2)", type=input.string, defval="SMA", options=["SMA", "EMA", "WMA", "VWMA"])
MA1 = input(title="Moving Average Length 1", type = input.integer ,defval=10)
MAL2 = input(title="Moving Average Length 2", type = input.integer ,defval=20)
AboveBelow = input(title="Trend SMA Filter?", type=input.string, defval="Above", options=["Above", "Below", "Don't Include"])
TLen = input(title="Trend SMA Length", type = input.integer ,defval=200)
////////////////////////
///////LONG ONLY////////
////////////////////////
//ABOVE
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(sma(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(sma(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(sma(close,MA1),vwma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(sma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(ema(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(ema(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(ema(close,MA1),vwma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(ema(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(vwma(close,MA1),vwma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(vwma(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(vwma(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(vwma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(wma(close,MA1),wma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(wma(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(wma(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.close("LONG", when = crossunder(wma(close,MA1),vwma(close,MAL2)))
// BELOW
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(sma(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(sma(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(sma(close,MA1),vwma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(sma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(ema(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(ema(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(ema(close,MA1),vwma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(ema(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(vwma(close,MA1),vwma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(vwma(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(vwma(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(vwma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(wma(close,MA1),wma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(wma(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(wma(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.close("LONG", when = crossunder(wma(close,MA1),vwma(close,MAL2)))
// DONT INCLUDE
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),sma(close,MAL2)) )
strategy.close("LONG", when = crossunder(sma(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),ema(close,MAL2)) )
strategy.close("LONG", when = crossunder(sma(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),vwma(close,MAL2)) )
strategy.close("LONG", when = crossunder(sma(close,MA1),vwma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),wma(close,MAL2)) )
strategy.close("LONG", when = crossunder(sma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),sma(close,MAL2)) )
strategy.close("LONG", when = crossunder(ema(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),ema(close,MAL2)) )
strategy.close("LONG", when = crossunder(ema(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),vwma(close,MAL2)) )
strategy.close("LONG", when = crossunder(ema(close,MA1),vwma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),wma(close,MAL2)) )
strategy.close("LONG", when = crossunder(ema(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),vwma(close,MAL2)) )
strategy.close("LONG", when = crossunder(vwma(close,MA1),vwma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),sma(close,MAL2)) )
strategy.close("LONG", when = crossunder(vwma(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),ema(close,MAL2)) )
strategy.close("LONG", when = crossunder(vwma(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),wma(close,MAL2)) )
strategy.close("LONG", when = crossunder(vwma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),wma(close,MAL2)) )
strategy.close("LONG", when = crossunder(wma(close,MA1),wma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),sma(close,MAL2)) )
strategy.close("LONG", when = crossunder(wma(close,MA1),sma(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),ema(close,MAL2)) )
strategy.close("LONG", when = crossunder(wma(close,MA1),ema(close,MAL2)))
if LongShort =="Long Only" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),vwma(close,MAL2)) )
strategy.close("LONG", when = crossunder(wma(close,MA1),vwma(close,MAL2)))
////////////////////////
///////SHORT ONLY///////
////////////////////////
//ABOVE
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(sma(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(sma(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(sma(close,MA1),vwma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(sma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(ema(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(ema(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(ema(close,MA1),vwma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(ema(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(vwma(close,MA1),vwma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(vwma(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(vwma(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(vwma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(wma(close,MA1),wma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(wma(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(wma(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.close("SHORT", when = crossover(wma(close,MA1),vwma(close,MAL2)))
// BELOW
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(sma(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(sma(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(sma(close,MA1),vwma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(sma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(ema(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(ema(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(ema(close,MA1),vwma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(ema(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(vwma(close,MA1),vwma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(vwma(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(vwma(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(vwma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(wma(close,MA1),wma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(wma(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(wma(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.close("SHORT", when = crossover(wma(close,MA1),vwma(close,MAL2)))
// DONT INCLUDE
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),sma(close,MAL2)) )
strategy.close("SHORT", when = crossover(sma(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),ema(close,MAL2)) )
strategy.close("SHORT", when = crossover(sma(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),vwma(close,MAL2)) )
strategy.close("SHORT", when = crossover(sma(close,MA1),vwma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),wma(close,MAL2)) )
strategy.close("SHORT", when = crossover(sma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),sma(close,MAL2)) )
strategy.close("SHORT", when = crossover(ema(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),ema(close,MAL2)) )
strategy.close("SHORT", when = crossover(ema(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),vwma(close,MAL2)) )
strategy.close("SHORT", when = crossover(ema(close,MA1),vwma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),wma(close,MAL2)) )
strategy.close("SHORT", when = crossover(ema(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),vwma(close,MAL2)) )
strategy.close("SHORT", when = crossover(vwma(close,MA1),vwma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),sma(close,MAL2)) )
strategy.close("SHORT", when = crossover(vwma(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),ema(close,MAL2)) )
strategy.close("SHORT", when = crossover(vwma(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),wma(close,MAL2)) )
strategy.close("SHORT", when = crossover(vwma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "WMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),wma(close,MAL2)) )
strategy.close("SHORT", when = crossover(wma(close,MA1),wma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "SMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),sma(close,MAL2)) )
strategy.close("SHORT", when = crossover(wma(close,MA1),sma(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "EMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),ema(close,MAL2)) )
strategy.close("SHORT", when = crossover(wma(close,MA1),ema(close,MAL2)))
if LongShort =="Short Only" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "VWMA"
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),vwma(close,MAL2)) )
strategy.close("SHORT", when = crossover(wma(close,MA1),vwma(close,MAL2)))
////////////////////////
/////// BOTH ///////////
////////////////////////
//ABOVE
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),vwma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "SMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),vwma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "EMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),vwma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "VWMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),wma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),wma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),sma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),ema(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Above" and MAs1 == "WMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),vwma(close,MAL2)) and close>sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),vwma(close,MAL2)))
// BELOW
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),vwma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "SMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),vwma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "EMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),vwma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "VWMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),wma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),wma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),sma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),ema(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Below" and MAs1 == "WMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),vwma(close,MAL2)) and close<sma(close,TLen))
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),vwma(close,MAL2)))
// DONT INCLUDE
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),sma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),ema(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),vwma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),vwma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "SMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(sma(close,MA1),wma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(sma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),sma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),ema(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),vwma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),vwma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "EMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(ema(close,MA1),wma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(ema(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),vwma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),vwma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),sma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),ema(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "VWMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(vwma(close,MA1),wma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(vwma(close,MA1),wma(close,MAL2)))
///--///
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "WMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),wma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),wma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "SMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),sma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),sma(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "EMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),ema(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),ema(close,MAL2)))
if LongShort =="Both" and AboveBelow == "Don't Include" and MAs1 == "WMA" and MAs2 == "VWMA"
strategy.entry("LONG", true, when = crossover(wma(close,MA1),vwma(close,MAL2)) )
strategy.entry("SHORT", false, when = crossunder(wma(close,MA1),vwma(close,MAL2)))