Price in script

Hi,

would like to code the following
PRICE crossover price-level (e.g. previous breakout level).
THe challenge is i dont want to use close - but the market price. Because close of the bar is too late. would like to capture when the price moves a certain level. if I use the High - the new day is not yet printed, so that wont reflect.
I could use some short EMA - may be
or could go lower in timeframe.
Is ther any straight forward way!

Thanks

Hi Rams,

For realtime charts think of CLOSE() as the latest market price, not the close of the day. So CLOSE() CrossesAbove MA(Bars=5) will signal whenever the current price crosses above the MA.

Hi Darren,

thank you. But i am using EoD price.
So next day morning - when market price crosses say High of EoD ( from yesterday). I would like to enter.
that market price is what i would like to pick.
If i say close crosses above - it has to wait the whole day, but i want to broker executes when the high of yesterday is crossed ( last availavle EOD price)

Thanks

OK thanks. Will this work? If today’s high is greater than yesterday’s, use yesterday’s high price, else 0 (or any other value):

H1=HIGH();
IF(H1>H1[1],H1[1],0);

Hi Darren,

Not sure of this. Would the same objective not acheieved by High() > High()[1] as above

Primary objective is to pick the crossover of “Market price” above a breakout price.

struggle is represent the moving market price.

Thanks

Yes, but what Darren has done is more efficient. In the case of a “High” function, it is not a big deal, but with other functions (eg Like Optex()) it makes a huge difference. By using variables the calculation is only done once.

Always create scripts in steps and check on a chart that it is doing what you expect. Add Darren’s script to a Show Plot tool and see if it is the level you want. Then you can always update it to

H1=HIGH();
C1 = IF(H1>H1[1],H1[1],0);
Close() CrossesAbove C1

All the best

Mathew