Esta estratégia é um sistema de decisão multi-espaço baseado no cruzamento de médias móveis. A estratégia permite a seleção de diferentes tipos de médias móveis e pode configurar parâmetros de médias móveis de curto e longo prazos para gerar sinais de compra e venda. Além disso, a estratégia também oferece uma opção de filtragem de tendências, que exige que os sinais de negociação coincidam com a direção da tendência.
A lógica central da estratégia é baseada no cruzamento de duas médias móveis para gerar sinais de negociação.
Além disso, a estratégia oferece a opção de quatro tipos de médias móveis, incluindo medias móveis simples (SMA), medias móveis indiciais (EMA), medias móveis ponderadas (WMA) e medias móveis quantitativas (VWMA).
Além disso, a estratégia também oferece três modos de operação: fazer apenas mais, fazer apenas mais e fazer tudo mais. Isso permite que os usuários escolham diferentes direções de negociação de acordo com o ambiente do mercado.
Finalmente, a estratégia adicionou o recurso de filtragem de tendências. Este recurso exige que o sinal de negociação deve estar de acordo com a direção da tendência, ou ignorar o sinal. Especificamente, quando a opção é definida como a barra de acima, o sinal de cabeça vazia é produzido somente quando o preço está acima da linha de tendência; quando a opção é definida como a barra de abaixo, o sinal de cabeça vazia é produzido somente quando o preço está abaixo da linha de tendência.
A maior vantagem desta estratégia é parametric e flexível. A média móvel é o indicador técnico mais básico e é amplamente usada em negociações quantitativas. A estratégia oferece um sistema de cruzamento de média móvel altamente configurável, permitindo que os usuários ajustem os parâmetros com flexibilidade para diferentes ambientes de mercado.
Em particular, as vantagens da estratégia incluem:
No geral, a estratégia é um sistema de cruzamento de médias móveis muito flexível e personalizável, que os usuários podem ajustar de acordo com seu julgamento do mercado, sem ter que se limitar a qualquer padrão fixo.
Os principais riscos desta estratégia são:
A estratégia oferece soluções para esses riscos:
A estratégia pode ser optimizada principalmente a partir das seguintes dimensões:
Otimizando os pontos acima, o sistema pode ter melhores mecanismos de gerenciamento de riscos, maior estabilidade e maior capacidade de adaptação às mudanças do mercado.
Esta estratégia de cruzamento de médias móveis é uma estratégia muito típica de seguir tendências. É simples, flexível e fácil de entender, e oferece um sistema de negociação altamente configurável. Os usuários podem escolher a combinação de médias móveis apropriada, ajustar os parâmetros, configurar a direção de negociação multi-espaço, etc., de acordo com o julgamento do mercado.
/*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)))