setting stop and target at bar high and low

Forums ProRealTime English forum ProOrder support setting stop and target at bar high and low

Viewing 7 posts - 1 through 7 (of 7 total)
  • #100010

    Hello everybody,

    I am fairly new at programming my own trading codes. I recently finished the advanced programming course and i am starting to program my first (simple) codes.

    I have run into a problem with setting my stop and target at de previous bar and low.

    What I want to achieve is that when a insidebar appears in a strong trend a order is put in.

    The entrypoint is the previous bar high(high[1] (this i already accomplished!)

    The stoploss is at the previous bar low (low[1]). (this also now works in the following code thanks to this forum)

    The target I want to set at two times the difference between the bar high and bar low so I get a R:R of 1:2.

    Hope someone can help me.

     

    Kind Regards,

     

    Jaldidee

     

    #100227

    Change the last line from STOP to LIMIT

    I’ve added a IF NOT ONMARKET condition as otherwise the stop and limit values could change after you have opened a position. This does however mean that you can not have cumulating positions.

    #100246

    Above code added to here

    Snippet Link Library

    #100251

    Hello Vonasi,

    Thanks for your reply. I tested your changes and it works perfectly now.

    Thanks alot.

     

    #100255

    Hmmm.

     

    When i tested the code it look like this?

    #100266

    Yeah I noted that … it needs below as Line 9?

    Vonasi must not have had his coffees! 🙂

    Oh no it was 6:52 PM … he must have started on the beers early … well it is Sunday and he had been travelling for days! 🙂

     

     

    #100267

    Hello Guys,

    Grahal is right. The inconsistency was in difference between mystop and mystopbull (has to be the same offcourse!).

    Underneath I complemented the code now with also the conditions for short positions.

     

    2 users thanked author for this post.
Viewing 7 posts - 1 through 7 (of 7 total)

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