Price in script

Optuma Forums Optuma Scripting Price in script

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #62042
    Rams
    • Topics: 4
    • Replies: 4
    • Posts: 8

    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

    #62049
    Darren
    • Topics: 66
    • Replies: 633
    • Posts: 699

    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.

    #62055
    Rams
    • Topics: 4
    • Replies: 4
    • Posts: 8

    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

    #62057
    Darren
    • Topics: 66
    • Replies: 633
    • Posts: 699

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

    1 user thanked author for this post.
    #62059
    Rams
    • Topics: 4
    • Replies: 4
    • Posts: 8

    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

    #62061
    Mathew
    • Topics: 40
    • Replies: 1,965
    • Posts: 2,005
    Would the same objective not acheieved by High() > High()[1] as above

    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.

    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

    All the best

    Mathew

    1 user thanked author for this post.
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Pin It on Pinterest