0

I have modified this to a strategy https://www.tradingview.com/script/ZpONAzhm-ORB-with-Price-Targets/

And im trying to make strategy orders at specific time of day, with a triggerprice of the high and lows of the orbs, but they dont fill at the correctly

...
    if is_first
        orbHighPrice := high
        orbLowPrice := low
        inBreakout := false
    else
        orbHighPrice := orbHighPrice[1]
        orbLowPrice := orbLowPrice[1]
    if high > orbHighPrice and in_session
        orbHighPrice := high
    if low < orbLowPrice and in_session
        orbLowPrice := low
...



var bool TradedToday = false
if timeframe.change("D")
    TradedToday := false

int ordertime = time(timeframe.period, "0330-0431:1234567")

//Short orders
if not TradedToday and ordertime and inTradeWindow
    strategy.order("Enter Long", strategy.long, limit=orbHighPrice)
    TradedToday := true
//STOPLOSS
if ta.cross(close, orbHighPrice + (orbRange * -0.5))
    strategy.close("Enter Long")
//TAKE PROFIT
if ta.cross(close, orbHighPrice + (orbRange * +1.0))
    strategy.close("Enter Long")

//Long orders
if not TradedToday and ordertime and inTradeWindow
    strategy.order("Enter Short", strategy.short, limit=orbLowPrice)
    TradedToday := true
//STOPLOSS
if ta.cross(close, orbLowPrice + (orbRange * +0.5))
    strategy.close("Enter Short")
//TAKE PROFIT
if ta.cross(close, orbLowPrice + (orbRange * -1.0))
    strategy.close("Enter Short")

What am i doing wrong here?

Yoshidk
  • 459
  • 1
  • 5
  • 16

1 Answers1

0

Ah, I just realized I have to use stop=orbLowPrice instead of limit

Yoshidk
  • 459
  • 1
  • 5
  • 16