• #3183
      romdisc
      Basic

      The CC_market_price_enter/exit take the poid as the first parameter and return it, if, and only if, this function/command has side effects, hence places an order with a new poid.

      This practice guaranties that you will have only one position running with this specific poid.

      Therefore, the enter statement might set the poid and the exit statement might reset the poid.

    • #3074
      romdisc
      Basic

      Wouldn’t it be more appropriate to change the type of the DevineOutputIndex to NumberType(s)?

    • #3030
      romdisc
      Basic

      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)
      `

Viewing 2 reply threads

Unlock your crypto trading potential

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

Join for Free