これは,取引信号を生成するための移動平均クロスオーバーシステムである.この戦略は,異なるタイプの移動平均を選択し,短期および長期間の移動平均パラメータを設定して,購入および販売信号を生成することができます.また,トレンドシグナルとトレンド方向を調整するためのトレンドフィルタリングオプションを提供します.
この戦略の基本的な論理は,取引信号を生成するために2つの移動平均値のクロスオーバーに基づいています.特に:
購入信号は,短期移動平均が長期移動平均を超えると生成されます.
短期移動平均が長期移動平均を下回ると売り信号が生成される.
さらに,この戦略は,単純な移動平均 (SMA),指数的な移動平均 (EMA),重量移動平均 (WMA),ボリューム重量移動平均 (VWMA) を含む4種類の移動平均から選択するオプションを提供します.ユーザーは短期および長期移動平均を自由に組み合わせ,設定することができます.
さらに,この戦略は3つの操作モードを提供しています.ただ単にロング,ただ単にショート,そしてロング/ショート.これは,ユーザーが異なる市場状況に応じて適切な取引方向を選択することを可能にします.
最後に,トレンドフィルタリングオプションが含まれています.これは,トレンド方向に配列される取引信号を必要とします.そうでなければ,シグナルは無視されます.特に,オプションが
この戦略の最大の利点は,パラメータ的で柔軟性があることである.動平均値は,最も基本的な技術指標の1つとして,定量取引で広く使用されている.この戦略は,高度に構成可能な動平均クロスオーバーシステムを提供し,ユーザーが異なる市場状況に合わせてパラメータを柔軟に調整することができる.
具体的には,以下のような利点があります.
移動平均のパラメータを調整することによってシステムを最適化することを可能にする複数の移動平均の種類を提供
異なる市場サイクルに適応するために設定可能な短期および長期移動平均期
不利な一方的な市場を避けるため,オプションの長/短取引方向
傾向に反する取引を避けるためにオプションの傾向フィルタリング
シンプルで明快な戦略ロジックで,理解し最適化するのが簡単です
簡単に言うと,これは非常に柔軟でカスタマイズ可能な移動平均クロスオーバーシステムです.ユーザーは固定パターンに縛られずにパラメータを調整することで,独自の市場観に合わせて調整することができます.
この戦略の主なリスクは以下のものです.
遅れている指標としての移動平均は,初期価格変動を見逃す可能性があります.
不適切なパラメータの組み合わせは,過剰な取引と低収益性につながる可能性があります.
市場体制 が 変化 する と,固定 的 な パターン に 固執 する こと は 失敗 する こと が あり ます
これらのリスクに対処するために,次の解決策を採用できます.
価格変動を早期に検出するために,ボリュームや変動などの主要な指標を組み込む
収益性の向上と取引頻度の制御のためのパラメータを最適化
戦略パラメータを動的に調整し,市場動向と変動に適応する
この戦略の主要な最適化方向は以下の通りである.
効率を向上させるため,ボリッジ・バンドやボリッジ・バンドなどの他の技術指標を追加します.
単一の取引損失を制御するためにストップ損失を組み込む
パラメータを動的に最適化するために機械学習アルゴリズムを使用する
単純な移動平均値ではなく市場構造に基づく傾向を特定する
動的ポジションサイズ化のための変動指標を組み込む
これらの最適化により システムがより良いリスク管理,強度,そして 進化する市場への適応性を有します
結論として,この移動平均クロスオーバー戦略は,非常に典型的なトレンドフォローシステムです. シンプルで柔軟で,理解が容易で,高度に構成可能なフレームワークを提供します. ユーザーは適切な移動平均値を選択し,パラメータを調整し,ロング/ショート取引を構成することによって,市場の状況に対する自分の見解に合わせてそれを調整できます. もちろん,他の技術指標を組み込むことで,その核心トレンドフォローメリットを維持することによってシステムも豊かにすることができます.適切な強化により,より包括的で信頼性の高い定量的な取引戦略になることができます.
/*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)))