0
votes

Before writing this i tried certain idea given here still not working so asking again.

This is the V4 code V2 =True SarUp interger vlue emaslow integer value //code from here

get_pltval(V2,sarUp,emaSlow) =>
    pltval = 0.0
    plval := V2 ? sarUp <= ohlc4 and sarUp[2] > high and sarUp[3] > high and sarUp[4] > high ? 1 : 0 : ohlc4 > emaSlow ? 1 : 0

var _src = 0.0 
_src := get_pltval(V2,sarUp,emaSlow)

test = security(syminfo.tickerid, tf, _src, barmerge.gaps_off, barmerge.lookahead_off)

Error Cannot use mutable variable as an argument in security function

Any solution this problem .Please share

1

1 Answers

0
votes

barmerge and lookahead are "off" by default, so no need to explicitly define them. You can call a function from security():

//@version=4
study("")
get_pltval(V2,sarUp,emaSlow) =>
    pltval = 0.0
    plval := V2 ? sarUp <= ohlc4 and sarUp[2] > high and sarUp[3] > high and sarUp[4] > high ? 1 : 0 : ohlc4 > emaSlow ? 1 : 0

test = security(syminfo.tickerid, tf, get_pltval(V2,sarUp,emaSlow))