buy /sell when the price crosses over/under a value and equals a different value

Forums ProRealTime English forum ProOrder support buy /sell when the price crosses over/under a value and equals a different value

  • This topic has 3 replies, 2 voices, and was last updated 4 weeks ago by avatarJS.
Viewing 4 posts - 1 through 4 (of 4 total)
  • #240452

    Hi and thank you guys!

    I want to code this but dont know how:

    for example

    BUY 1 contract when the price crosses over 100 then reaches 120 ( so basically the price has to cross over 1oo and reaches 120 to buy a contract at 120 )

    CLOSE THE TRADE when the price crosses down 140 then reaches 120 ( price has to cross under 140 and reaches 120 to sell at 120)

     

    Appreciate your help

    Thank you

    #240453
    JS

    Hi,

    Try this one:

    3 users thanked author for this post.
    #240511

    Thank you JS,

    It worked but I need the trade to be closed when the price crosses under 140 to 120 and not to sell ( now its buying 1 contract when the price crosses over 100 reaching 120, closing the buying contract and selling 1 contract when the price crosses under 140 reaching 120). what I need to change in this code please?

     

    Thank you so much

    1 user thanked author for this post.
    avatar JS
    #240512
    JS

    Hi,

    Change line 20 to “Sell at Market”

     

    1 user thanked author for this post.
Viewing 4 posts - 1 through 4 (of 4 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login