Chiến lược chéo trung bình di chuyển

Tác giả:ChaoZhang, Ngày: 2023-10-09 17:03:23
Tags:

Tổng quan

Đây là một hệ thống chéo trung bình động để tạo ra tín hiệu giao dịch. Chiến lược cho phép lựa chọn các loại trung bình động khác nhau và cấu hình các thông số trung bình động ngắn và dài hạn để tạo ra tín hiệu mua và bán. Nó cũng cung cấp các tùy chọn lọc xu hướng để điều chỉnh các tín hiệu giao dịch theo hướng xu hướng.

Chiến lược logic

Logic cốt lõi của chiến lược này dựa trên sự chéo chéo của hai đường trung bình động để tạo ra các tín hiệu giao dịch.

  • Một tín hiệu mua được tạo ra khi đường trung bình động ngắn hạn vượt qua đường trung bình động dài hạn.

  • Một tín hiệu bán được tạo ra khi trung bình di chuyển ngắn hạn vượt qua dưới trung bình di chuyển dài hạn.

Ngoài ra, chiến lược cung cấp tùy chọn để lựa chọn từ bốn loại trung bình động, bao gồm Trung bình di chuyển đơn giản (SMA), Trung bình di chuyển theo cấp số (EMA), Trung bình di chuyển cân nhắc (WMA) và Trung bình di chuyển cân nhắc khối lượng (VWMA).

Hơn nữa, chiến lược cung cấp ba chế độ hoạt động: chỉ dài, chỉ ngắn và dài / ngắn. Điều này cho phép người dùng chọn hướng giao dịch phù hợp theo các điều kiện thị trường khác nhau.

Cuối cùng, một tùy chọn lọc xu hướng được bao gồm. Điều này đòi hỏi các tín hiệu giao dịch phải phù hợp với hướng xu hướng, nếu không tín hiệu sẽ bị bỏ qua. Cụ thể, khi tùy chọn được đặt ở mức Above, chỉ có tín hiệu dài được tạo ra khi giá trên mức trung bình chuyển động xu hướng. Khi tùy chọn được đặt ở mức Below, chỉ có tín hiệu ngắn được tạo ra khi giá dưới mức trung bình chuyển động xu hướng.

Phân tích lợi thế

Lợi thế lớn nhất của chiến lược này là nó là tham số và linh hoạt. Đường trung bình động, là một trong những chỉ số kỹ thuật cơ bản nhất, được sử dụng rộng rãi trong giao dịch định lượng. Chiến lược này cung cấp một hệ thống chéo trung bình động có thể cấu hình được cao, do đó người dùng có thể linh hoạt điều chỉnh các tham số để phù hợp với các điều kiện thị trường khác nhau.

Cụ thể, những lợi thế bao gồm:

  • Cung cấp nhiều loại trung bình động để lựa chọn, cho phép tối ưu hóa hệ thống bằng cách điều chỉnh các thông số trung bình động

  • Có thể cấu hình các khoảng thời gian trung bình động ngắn và dài hạn để thích nghi với các chu kỳ thị trường khác nhau

  • Các hướng giao dịch dài/kết hợp tùy chọn để tránh thị trường một chiều bất lợi

  • Việc lọc xu hướng tùy chọn để tránh giao dịch chống lại xu hướng

  • Logic chiến lược đơn giản và rõ ràng dễ hiểu và tối ưu hóa

Tóm lại, đây là một hệ thống chéo trung bình động rất linh hoạt và có thể tùy chỉnh. Người dùng có thể điều chỉnh nó theo quan điểm thị trường của riêng họ bằng cách điều chỉnh các tham số, mà không bị ràng buộc bởi bất kỳ mô hình cố định nào.

Phân tích rủi ro

Những rủi ro chính của chiến lược này xuất phát từ:

  1. Mức trung bình động như các chỉ số chậm có thể bỏ lỡ những thay đổi giá sớm

  2. Sự kết hợp các thông số không đúng có thể dẫn đến giao dịch quá mức và lợi nhuận thấp hơn

  3. Việc tuân thủ các mô hình cố định có thể thất bại khi chế độ thị trường thay đổi

Để giải quyết những rủi ro này, các giải pháp sau đây có thể được áp dụng:

  1. Kết hợp các chỉ số hàng đầu như khối lượng và biến động để phát hiện những thay đổi giá sớm

  2. Tối ưu hóa các tham số cho lợi nhuận cao hơn và kiểm soát tần suất giao dịch

  3. Điều chỉnh năng động các tham số chiến lược để thích nghi với xu hướng và thị trường khác nhau

Hướng dẫn tối ưu hóa

Các hướng tối ưu hóa chính cho chiến lược này là:

  1. Thêm các chỉ số kỹ thuật khác như khối lượng và Bollinger Bands để cải thiện hiệu quả

  2. Bao gồm dừng lỗ để kiểm soát lỗ giao dịch duy nhất

  3. Sử dụng các thuật toán học máy để tối ưu hóa các tham số một cách năng động

  4. Xác định xu hướng dựa trên cấu trúc thị trường thay vì chỉ đơn giản là trung bình động

  5. Tích hợp các chỉ số biến động để định kích thước vị trí động

Với các tối ưu hóa này, hệ thống có thể có quản lý rủi ro tốt hơn, độ bền và khả năng thích nghi với thị trường đang phát triển.

Kết luận

Tóm lại, chiến lược chéo trung bình động này là một hệ thống theo xu hướng rất điển hình. Nó đơn giản, linh hoạt, dễ hiểu và cung cấp một khuôn khổ có thể cấu hình cao. Người dùng có thể điều chỉnh nó theo quan điểm của họ về điều kiện thị trường bằng cách chọn các đường trung bình động phù hợp, điều chỉnh các tham số và cấu hình giao dịch dài / ngắn. Tất nhiên, họ cũng có thể làm phong phú hệ thống bằng cách kết hợp các chỉ số kỹ thuật khác trong khi giữ được xu hướng chính theo giá trị. Với các cải tiến thích hợp, nó có thể trở thành một chiến lược giao dịch định lượng toàn diện và đáng tin cậy hơn.


/*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))) 

Thêm nữa