straddle strategy program help (beginner)

Forums ProRealTime English forum ProOrder support straddle strategy program help (beginner)

Viewing 5 posts - 1 through 5 (of 5 total)
  • #243474

    Hi there,

    I’m new to pro real time. I was wondering if anyone here could help point me in the right direction. I’ll keep it quick and concise out of respect for everyone’s time.

    I’m experimenting with a program that sets one straddle trade per session exactly at 9pm. It will set one buy order, 1 percent above market price and one sell order 1% below market price. When either one of these orders are triggered i want it to cancel the other order and set a trailing stop on the one that was triggered.

    1. I tried to create a work around by pushing one trigger far away when the other one was triggered. For example, if the buy order was triggered it would push the sell order far away. Is there a better way to this? Is there a way to cancel an order when the other order is reached?
    2. i Get this error code when i try to automate the program: Trading systems with orders that partially close a position cannot be sent to ProOrder. make sure no quantity is specified in instructions to close positions (in this case the instruction closes all the entire position.)”. I have no idea how to fix it 🙂

    Any info would be appreciated.

    My code:

     

     

    #243475

    There’s NO need to camcel an order, as all pending untriggered orders are camcelled at the end of each bar.

    So, in 1-minute TF, at 09:00 you will place two pending orders. at 09:01 ALL untriggered pending orders will be closed, be it both or just one of them. In the very unlikely case both orders are triggered on the same, the latter one will first close the one that was previously opened, no matter if it was gaining or losing (it’s a Stop & Reverse).

    Try this code ( I also added a flag, TradeON, to allow only 1 trade per day):

     

    2 users thanked author for this post.
    #243477

    @robertogozzi

    Thank you for the explanation! Also for adding that flag! Greatly appreciated. Do you have any info or tips regarding the error message that is stopping me from automating my program?

    the error:

    “Trading systems with a Working Order that partially close a position cannot be sent to ProOrder. Make sure that no quantity is specified in instructions to close positions with Working Order (in this case, the instruction closes the entire position)”.

    #243481

    My fault, I didn’t realize you incorrectly used SELL to enter a short trade. Use:

    • BUY    to enter a Long trade
    • SELL  to exit  a Long trade
    • SELLSHORT  to enter a Short trade
    • EXITSHORT  to exit  a Short trade

    so you will have to replace line 32 with:

     

    1 user thanked author for this post.
    #243484

    @robertogozzi

    Whoops, silly me. Thank you for your help. I owe you one!

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

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