Distinguishing between long and short trades, and long and short exits

Forums ProRealTime English forum ProOrder support Distinguishing between long and short trades, and long and short exits

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

    Is it possible to distinguish between the following 4 types of changes in position?

    Long entry

    Long exit (on stop)

    Short entry

    Short exit (on stp)

    In an algo that checks for both long entry’s and short entry’s, I want only to enter a new long at a HIGHER price than the previous long entry, and a new short at a LOWER price than the previous short entry.

    This may or may not be higher/lower than the previous TRADE as the last trade could be an exit on stop which in effect I want to ignore

    Thanks

    #10400

    You can retrieve the open price of each previous trade with TRADEPRICE instruction. This way you can decide to take position higher or lower than this price.

     

    #10403

    Yes – but the question is, how do I distinguish between the different types of trades, as described above. I guess from your answer this is not possible?

    What happens if the sequence of trades is 1) sell, 2) sell, 3) buy and 4) sell stopped out. I then want to sell more. How do I isolate the last sell price – tradeprice(3)? – and distinguish it from tradeprice(2) – the buy – and tradeprice(1) – the sell stopped out?

    #10405

    Not really sure what you mean but you don´t write “sell” when you want to short. You write it like this:

    //buy long

    If blabla then

    buy 1 contract at market

    //sell long

    If blabla then

    sell at market

     

    /enter short

    If blabla then

    sellshort 1 contract at market

     

    //exit short

    If blabla then

    exitshort at market

    #10409

    Try to give a variable a value when you launch a buy or a sell order, like this:

    Then if you want to know what were the direction of the previous 3rd trade, you can access to the variable “a” with a little barindex play:

    So if “longORshort” return -1, then you know that your previous 3rd trade from now was a sell order.

    I have not tested it, but it should work .. I think 🙂

     

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