Triple VWAP Trend Rider

0 735 Views 3 Comments 2 years ago
HTS CLOUDBETA
    • #3030
      romdisc
      Basic
      Up
      0
      Down
      ::

      This is much more cleaner:

      `lua
      — [r4stl1n] Triple VWAP Trend Rider

      — This strategy utilizes the VWAP_Window function to
      — execute shorts when conditions are meet

      ——————————–
      — You are on your own with this script
      ——————————–
      — ~Bored and programming~

      HideOrderSettings()

      — Wrap our entire strategy in the OptimizedForInteral
      — To ensure our strat only runs on new complete candles
      rsiLength = Input (“RSI Length”, 60,””)
      rsiShortLevel = Input(“RSI Short”,30,”RSI Short Level”,””)

      ppoShort = Input(“POI Short”,9,”POI Short Level”,””)
      ppoLong = Input(“POI Long”,26,”POI Long Level”,””)
      ppoSignal = Input(“POI Signal”,-1,”POI Signal”,””)

      vwapWindowOne = Input(“VWAP Window One”,20,”VWAP Window Size”,”VWAP Settings”)
      vwapWindowTwo = Input(“VWAP Window Two”,60,”VWAP Window Size”,”VWAP Settings”)
      vwapWindowThree = Input(“VWAP Window Three”,250,”VWAP Window Size”,”VWAP Settings”)

      — First we grab a day candles
      OptimizedForInterval(0, function()

      local vwap20 = CC_VWAPWindow(vwapWindowOne)
      local vwap60 = CC_VWAPWindow(vwapWindowTwo)
      local vwap250 = CC_VWAPWindow(vwapWindowThree)

      local rsi = RSI(ClosePrices(),rsiLength)
      local ppo = PPO(ClosePrices(),ppoShort,ppoLong,EmaType)

      if vwap250[3] != nil
      and CurrentPrice().close < vwap250[1] and GetPositionDirection() != PositionShort
      and vwap20[1] < vwap60[1]
      and vwap60[1] < vwap250[1]
      and ppo[1] <= ppoSignal
      and rsi > rsiShortLevel
      and vwap250[1] < vwap250[12]
      then
      PlaceGoShortOrder(0,TradeAmount(), {type=MarketOrderType, note=’S’})
      end

      if GetPositionDirection() == PositionShort
      and vwap60[1] >= vwap250[1]
      PlaceExitShortOrder(0,TradeAmount(), {type=MarketOrderType, note=’E’})
      end

      Plot(0, “vwap20”, vwap20, {c=Cyan})
      Plot(0, “vwap60”, vwap60, {c=Red})
      Plot(0, “vwap250”, vwap250, {c=Green})

      Plot(1, “RSI Level”,rsi)
      Plot(2, “PPO Level”,ppo)

      end)
      `

    • #3078
      Kobalt
      Basic
      Up
      0
      Down
      ::

      Cool Looking at above trades [if the first position was kept vs exits, re-entry]
      Are you [like me] also still are tackling the same hurdle:
      How to NOT close your Short [only reduce to a minimum 1x leverage cross] until bullish confirmation (increase BTC and hedge its USD] or have a re entry mechanism SL for the minimum portion of your accounts equity?
      Have closed it too often and was ‘naked’ ‘long unnecessary . very deja vu isn’t it? ;p

      • #3079
        Kobalt
        Basic
        Up
        0
        Down
        ::

        Arguably both are just as clean
        I think this for me gives a clear view of what you would achieve with IfElseIf chains in VE and especially the levels you need to end :


        ”’ if CurrentPrice().close < vwap250[1] and GetPositionDirection() != PositionShort
        then
        if vwap20[1] < vwap60[1]
        then
        if vwap20[1] < vwap250[1]
        then
        if vwap60[1] < vwap250[1]
        then
        if ppo[1] <= ppoSignal
        then
        if rsi > rsiShortLevel
        then
        if vwap250[1] < vwap250[12]
        then
        PlaceGoShortOrder(0,TradeAmount(), {type=MarketOrderType, note=’S’})
        end
        end
        end
        end
        end
        end
        end
        end”’

        • This reply was modified 1 year, 10 months ago by Kobalt.
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free