এই কৌশলটি একটি বহুমুখী সিদ্ধান্ত গ্রহণের সিস্টেম যা চলমান গড়ের উপর ভিত্তি করে তৈরি করা হয়। কৌশলটি বিভিন্ন ধরণের চলমান গড় নির্বাচন করার অনুমতি দেয় এবং দীর্ঘ এবং স্বল্পমেয়াদী চলমান গড়ের প্যারামিটারগুলি কনফিগার করতে পারে, যার ফলে ক্রয় এবং বিক্রয় সংকেত তৈরি হয়। এছাড়াও, কৌশলটি ট্রেন্ড ফিল্টারিং বিকল্প সরবরাহ করে, যার জন্য ট্রেডিং সংকেতগুলি প্রবণতার দিকনির্দেশের সাথে সামঞ্জস্যপূর্ণ হতে পারে।
এই কৌশলটির মূল যুক্তি হল দুটি চলমান গড়ের ক্রস দ্বারা ট্রেডিং সিগন্যাল তৈরি করা।
এছাড়াও, কৌশলটি চারটি চলমান গড়ের ধরণের একটি পছন্দ সরবরাহ করে, যার মধ্যে রয়েছে সরল চলমান গড় ((এসএমএ), সূচকীয় চলমান গড় ((ইএমএ), ভারী চলমান গড় ((ডাব্লুএমএ) এবং পরিমাণগত চলমান গড় ((ভিডাব্লুএমএ) । ব্যবহারকারী স্বল্প ও দীর্ঘমেয়াদী গড়ের ধরণের বিন্যাস করতে পারেন।
এছাড়াও, কৌশলটি তিনটি অপারেশন মোড সরবরাহ করেঃ শুধুমাত্র ওভার, শুধুমাত্র ফাঁকা এবং সম্পূর্ণ ফাঁকা। এটি ব্যবহারকারীদের বাজার পরিস্থিতির উপর নির্ভর করে বিভিন্ন ট্রেডিং দিকগুলি বেছে নিতে দেয়।
অবশেষে, কৌশলটি একটি ট্রেন্ড ফিল্টার বৈশিষ্ট্য যুক্ত করেছে। এই বৈশিষ্ট্যটি ট্রেডিং সিগন্যালকে ট্রেন্ডের দিকের সাথে সামঞ্জস্যপূর্ণ হতে বলে, অন্যথায় সিগন্যালটিকে উপেক্ষা করে। বিশেষত, যখন বিকল্পটি Above সেট করা থাকে, তখন কেবলমাত্র যখন দামটি ট্রেন্ডের গড়ের উপরে থাকে তখনই মাল্টিহেড সিগন্যাল তৈরি হয়। যখন বিকল্পটি Below সেট করা থাকে, তখন কেবলমাত্র যখন দামটি ট্রেন্ডের গড়ের নীচে থাকে তখনই খালি মাথা সিগন্যাল তৈরি হয়।
এই কৌশলটির সবচেয়ে বড় সুবিধা হল এটি প্যারামেট্রিক এবং নমনীয়। মুভিং এভারেজকে সবচেয়ে মৌলিক প্রযুক্তিগত সূচক হিসাবে গণ্য করা হয় এবং এটি পরিমাণগত লেনদেনের ক্ষেত্রে ব্যাপকভাবে ব্যবহৃত হয়। এই কৌশলটি একটি অত্যন্ত কনফিগারযোগ্য মুভিং এভারেজ ক্রস সিস্টেম সরবরাহ করে যা ব্যবহারকারীদের বিভিন্ন বাজারের পরিবেশের জন্য প্যারামিটারগুলিকে নমনীয়ভাবে সামঞ্জস্য করতে দেয়।
বিশেষ করে, কৌশলটির সুবিধাগুলি হলঃ
সামগ্রিকভাবে, এই কৌশলটি একটি অত্যন্ত নমনীয় এবং কাস্টমাইজযোগ্য মুভিং এভারেজ ক্রস-সিস্টেম যা ব্যবহারকারীরা তাদের নিজস্ব বাজার বিচার অনুসারে সামঞ্জস্য করতে পারে, কোনও নির্দিষ্ট মডেলের মধ্যে সীমাবদ্ধ নয়।
এই কৌশলটির প্রধান ঝুঁকিগুলো হলঃ
উপরের ঝুঁকির জন্য, এই কৌশলটি নিম্নলিখিত সমাধানগুলি প্রদান করেঃ
এই কৌশলটি নিম্নলিখিত দিকগুলি থেকে অপ্টিমাইজ করা যেতে পারেঃ
উপরের কয়েকটি পয়েন্টের অপ্টিমাইজেশনের মাধ্যমে, সিস্টেমগুলিকে আরও ভাল ঝুঁকি ব্যবস্থাপনা ব্যবস্থা, উচ্চতর স্থিতিশীলতা এবং বাজারের পরিবর্তনের সাথে আরও ভালভাবে খাপ খাইয়ে নিতে পারে।
এই মুভিং এভারেজ ক্রস কৌশলটি একটি খুব সাধারণ প্রবণতা অনুসরণকারী কৌশল। এটি সহজ, নমনীয় এবং সহজে বোঝা যায়, একটি অত্যন্ত কনফিগারযোগ্য ট্রেডিং সিস্টেম সরবরাহ করে। ব্যবহারকারীরা বাজারের পরিস্থিতির উপর ভিত্তি করে উপযুক্ত মুভিং এভারেজ সমন্বয়, প্যারামিটারগুলি সামঞ্জস্য করতে, মাল্টি-হোল্ডিং ট্রেডিংয়ের দিকনির্দেশনাগুলি কনফিগার করতে এবং আরও অনেক কিছু বেছে নিতে পারেন। অবশ্যই, ব্যবহারকারীরা তাদের প্রবণতা অনুসরণ করার সুবিধা বজায় রেখে অন্যান্য প্রযুক্তিগত সূচক যুক্ত করে সিস্টেমটিকে সমৃদ্ধ করতে পারে, এটিকে আরও বিস্তৃত এবং নির্ভরযোগ্য পরিমাণযুক্ত ট্রেডিং কৌশল হিসাবে তৈরি করে।
/*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)))