Price in script

Optuma Forums Optuma Scripting Price in script

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #62042
    AvatarRams
    • 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

    #62049
    DarrenDarren
    • 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.

    #62055
    AvatarRams
    • 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

    #62057
    DarrenDarren
    • 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):

    1 user thanked author for this post.
    #62059
    AvatarRams
    • 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

    #62061
    MathewMathew
    • Topics: 32
    • Replies: 1,707
    • Posts: 1,739
    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

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close