Any reasons why this code is not working

Forums ProRealTime English forum ProOrder support Any reasons why this code is not working

Viewing 10 posts - 1 through 10 (of 10 total)
  • #87817

    I want to close all open positions short or long

    if loss is >=30

    or profit >=40

    #87819

    Just a thought … below won’t work if, for example, you are trying to exit within the bid-ask spread range (spread = 4 or more?).

    I guess you’ve tried higher values for pr?

     

    #87824

    COUNTOFPOSITION can be positive or negative which will completely mess up your calculations.

    Also as GraHal says CLOSE +/- 2 will very likely be too close for a minimum order distance on most markets.

    #87835

    Isn’t COUNTOFPOSITION either 0 or greater?

    When can it be negative?

    #87836

    Isn’t COUNTOFPOSITION either 0 or greater?

    When can it be negative?

    When you are short.

    Screenshot_1

    1 user thanked author for this post.
    #87839

    @rama try below (AND increase pr > spread) … let us know if it works.

     

    #87859

    I am testing the new code, I have tried with PR =1 and MP=any value(without mp1 condition) it works well

    I am trying to add loss in the same code that is where it has problem

    #87860

    try below and let us know

     

    #87959

    I am running the program now with ,I will let you know the results

    1
    if (floatingprofit>= mp) or (floatingprofit <= mp1) then

     

    #87961

    COUNTOFPOSITION can be positive or negative

    I think the definition in the manual should be tweaked to make that a bit more obvious. All it says at the moment is “Counts the number of open shares or lots.”

    Can a clarification be added (eg “a buy position would should as +1 and a sell position would show as -1”)?

    *when I say manual I mean here: https://www.prorealcode.com/documentation/countofposition/

     

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

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