Optuma Forums › Optuma Scripting › Price in script
- This topic has 5 replies, 3 voices, and was last updated 1 month, 2 weeks ago by
Mathew.
-
AuthorPosts
-
January 18, 2021 at 1:31 am #62042
Rams
- Topics: 3
- Replies: 3
- Posts: 6
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
January 18, 2021 at 8:01 pm #62049Darren
- Topics: 63
- Replies: 557
- Posts: 620
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.
January 18, 2021 at 9:33 pm #62055Rams
- Topics: 3
- Replies: 3
- Posts: 6
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
January 18, 2021 at 11:01 pm #62057Darren
- Topics: 63
- Replies: 557
- Posts: 620
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):
1234H1=HIGH();IF(H1>H1[1],H1[1],0);1 user thanked author for this post.
January 19, 2021 at 2:55 am #62059Rams
- Topics: 3
- Replies: 3
- Posts: 6
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
January 19, 2021 at 8:54 am #62061Mathew
- Topics: 32
- Replies: 1,707
- Posts: 1,739
Would the same objective not acheieved by High() > High()[1] as aboveYes, 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.
struggle is represent the moving market price.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
12345H1=HIGH();C1 = IF(H1>H1[1],H1[1],0);Close() CrossesAbove C1All the best
Mathew
1 user thanked author for this post.
-
AuthorPosts
- You must be logged in to reply to this topic.