How to change Target Profit or Stop Loss after a certain time in a trade

Forums ProRealTime English forum ProOrder support How to change Target Profit or Stop Loss after a certain time in a trade

Viewing 2 posts - 1 through 2 (of 2 total)
  • #75750

    Hi all, first time poster so please be gentle.

    I’ve used the ProRealTime charts for quite a while, and have programmed quite a few indicators to operate as I’d like. I’ve only recently been dabbling with automating my trading, and I can’t seem to find the code to automatically change the stop loss or target profit if I’m in a trade too long.

    When I trade manually, if I’m in a trade for an hour, then I look to get out. If I’m in profit at that point, I move the stop loss to break even so I’m in a no loss trade. If I’m behind in a trade, I move the target profit to break even so I’ve got more chance of avoiding a loss.

    I’ve tried a few if/else bits of code, but I can’t seem to achieve what I want for some reason. I found a way to automatically close a trade after an hour, but not to change the target/loss as I’ve  described above. Any pointers, even if it’s to say it can’t be done, would be much appreciated.

    Many thanks in advance.

    #75751

    You can count the number of bars since the trade was opened with the simple calculation of BARINDEX minus TRADEINDEX. The price you traded at is TRADEPRICE or POSITIONPRICE for cumulated positions. So use a STOP order to sell at that price.

    I’ve moved your topic to the ProOrder forum as it is not an indicator question.

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

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