Este es un sistema de cruce de promedios móviles para generar señales comerciales. La estrategia permite seleccionar diferentes tipos de promedios móviles y configurar parámetros de promedios móviles a corto y largo plazo para producir señales de compra y venta. También proporciona opciones de filtrado de tendencias para alinear las señales comerciales con la dirección de la tendencia.
La lógica central de esta estrategia se basa en el cruce de dos promedios móviles para generar señales comerciales.
Una señal de compra se genera cuando la media móvil a corto plazo cruza por encima de la media móvil a largo plazo.
Una señal de venta se genera cuando la media móvil a corto plazo se cruza por debajo de la media móvil a largo plazo.
Además, la estrategia proporciona la opción de seleccionar entre cuatro tipos de promedios móviles, incluidos el promedio móvil simple (SMA), el promedio móvil exponencial (EMA), el promedio móvil ponderado (WMA) y el promedio móvil ponderado por volumen (VWMA).
Por otra parte, la estrategia ofrece tres modos de operación: sólo largo, sólo corto y largo/corto, lo que permite a los usuarios elegir la dirección de negociación adecuada según las diferentes condiciones del mercado.
Por último, se incluye una opción de filtrado de tendencia. Esto requiere que las señales de negociación se alineen con la dirección de la tendencia, de lo contrario la señal será ignorada. Específicamente, cuando la opción está configurada en
La mayor ventaja de esta estrategia es que es paramétrica y flexible. Las medias móviles, como uno de los indicadores técnicos más básicos, se utilizan ampliamente en el comercio cuantitativo. Esta estrategia proporciona un sistema de cruce de medias móviles altamente configurable, para que los usuarios puedan ajustar flexiblemente los parámetros para adaptarse a diferentes condiciones del mercado.
En concreto, las ventajas incluyen:
Proporcionar múltiples tipos de medias móviles para elegir, lo que permite optimizar el sistema ajustando los parámetros de las medias móviles
Periodos de media móvil a corto y largo plazo configurables para adaptarse a los diferentes ciclos de mercado
Direcciones opcionales de negociación larga/corta para evitar mercados unilaterales desfavorables
Filtración opcional de tendencias para evitar operaciones contra la tendencia
Lógica de estrategia simple y clara que es fácil de entender y optimizar
En resumen, se trata de un sistema de cruce de promedios móviles altamente flexible y personalizable, que los usuarios pueden adaptar a sus propias opiniones sobre el mercado ajustando los parámetros, sin estar limitados a ningún patrón fijo.
Los principales riesgos de esta estrategia provienen de:
Las medias móviles como indicadores con retraso pueden perder cambios tempranos de precios
Las combinaciones incorrectas de parámetros pueden dar lugar a un exceso de negociación y a una menor rentabilidad
La adhesión a patrones fijos puede fracasar cuando cambia el régimen del mercado
Para hacer frente a estos riesgos, se pueden adoptar las siguientes soluciones:
Incorporar indicadores principales como el volumen y la volatilidad para detectar cambios tempranos en los precios
Optimizar los parámetros para una mayor rentabilidad y controlar la frecuencia del comercio
Ajustar dinámicamente los parámetros de la estrategia para adaptarse a las tendencias y a los mercados cambiantes
Las principales direcciones de optimización para esta estrategia son:
Añadir otros indicadores técnicos como volumen y bandas de Bollinger para mejorar la eficiencia
Incorporar el stop loss para controlar las pérdidas de una sola operación
Utilice algoritmos de aprendizaje automático para optimizar dinámicamente los parámetros
Identificar tendencias basadas en estructuras de mercado en lugar de simples medias móviles
Incorporar indicadores de volatilidad para el dimensionamiento dinámico de las posiciones
Con estas optimizaciones, el sistema puede tener una mejor gestión de riesgos, robustez y adaptabilidad a los mercados en evolución.
En conclusión, esta estrategia de cruce de promedios móviles es un sistema muy típico de seguimiento de tendencias. Es simple, flexible, fácil de entender y proporciona un marco altamente configurable. Los usuarios pueden adaptarlo a sus puntos de vista sobre las condiciones del mercado seleccionando los promedios móviles apropiados, ajustando los parámetros y configurando el comercio largo / corto. Por supuesto, también pueden enriquecer el sistema incorporando otros indicadores técnicos mientras mantienen sus méritos básicos de seguimiento de tendencias. Con mejoras adecuadas, puede convertirse en una estrategia de trading cuantitativa más completa y confiable.
/*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)))