opening a pos on a specific price

Forums ProRealTime English forum ProOrder support opening a pos on a specific price

  • This topic has 5 replies, 3 voices, and was last updated 1 year ago by avatarJS.
Viewing 6 posts - 1 through 6 (of 6 total)
  • #209099

    Hello!

    I want to backtest a few lines I have identified as good r/s levels but am an utter noob when it comes to coding.

    Say I want to test 11500 on NQ, when the price comes from above I want to long. doing this with the help of MA14.

    But I’m not sure what to use to specify the level, as I understand “close” it needs to actually close on that level, is there anything I can use for a touch?

    Don’t know if this makes any sense.

    😀

     

    In essence, I want to find out the best SL and TP for trading my levels.

    #209102

    Touch is when either LOW or HIGH reach or break that level, such as:

    1 user thanked author for this post.
    #209103

    Thanks Roberto!

    This really helped, when it reaches tp for example, it opens a new order the bar after as long as price is above my level, which I understand from the code is correct.

    How do I set it to not keep adding while above?

    So one buy per touch, if it touches again, buy.

    #209104
    JS

    If you do not want to open cumulative orders, you must place the following line at the beginning of your code:

    DefParam CumulateOrders=False

    An alternative is to use:

    If High CrossesOver Average[14](Close) then

    Buy 1 contract at Market

    EndIf

    If Low CrossesUnder Average[14](Close) then

    SellShort 1 contract at Market

    EndIf

    With the latter option, you only buy / sell when the price crosses with the average…

    1 user thanked author for this post.
    #209117

    Yea sure that could work but I want to be really specific, which I understand is difficult.

    high >= “value”

    tp = 20

    sl = 5

    when either of those is hit and price is high >= the algo will keep opening positions. I really just want it to open a position when the line is touched.

    attached is a really bad example on s&p, there will be bad trades and these would be 2 of them, I still would like it to work but I can’t figure out how to open exactly on the line, and only then.

    Maybe smaller TF and maybe lesser MA.

    Any other ideas?

    #209119
    JS

    You could use Limit orders:

    If Close < Resistance then

    SellShort 1 contract at Resistance Limit

    EndIf

    If Close > Support then

    Buy 1 contract at Support Limit

    EndIf

Viewing 6 posts - 1 through 6 (of 6 total)

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