No Consecutive orders in the same direction

Forums ProRealTime English forum ProOrder support No Consecutive orders in the same direction

  • This topic has 2 replies, 2 voices, and was last updated 7 years ago by avatargm74.
Viewing 3 posts - 1 through 3 (of 3 total)
  • #32411

    Hi Everyone

    I am having a problem with a problem. I just want some fresh eyes to perhaps give me a different perspective.

    Its simple:

    If my previous trade was long. Then the next trade cannot be long.

    How would I code this simple bit of logic?

    Thanks!

    George

     

    #32415

    Hi George

    I take it you don’t want to put your code on here? It be so much easier for a skilled coder to look at what your code is doing and propose a solution to your problem in seconds?

    Take a look here … sounds a similar issue?

    https://www.prorealcode.com/topic/never-two-or-more-time-trading-in-same-direction/

    Cheers
    GraHal

     

    #32442

    Thank you, yes this does help. I was on the right track but never got it exactly. My solution is as follows. Purely in terms of the condition as mentioned. I use the variable “POS”. This seems to have done the trick.

     

    IF c1 and pos<1 THEN
    BUY positionsize CONTRACT AT MARKET
    ENDIF

    if longonmarket then
    pos=2
    endif

     

    And for short trades the following:

    IF c3 and pos>-1 THEN
    SELLSHORT positionsize CONTRACT AT MARKET
    ENDIF

    if shortonmarket then
    pos=-2
    endif

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

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