Take what the market gives

Forums ProRealTime English forum ProOrder support Take what the market gives

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

    When I write this code in my bot, the code checks for every close whether the current position is 10 points plus and then closes the trade. Quasi an exit without a TP. If the position is 100 points plus, it closes as well as if the position is 11 points plus. The same with the second code, only then time-dependent. Is that correct or do I have a mistake in my thinking?

    If longonmarket and Close>Positionperf+10*pipsize then

    sell at market

    endif

     

    If longonmarket and Time=120000 and Close>Positionperf+10*pipsize then

    sell at market

    endif

    #180825
    JS

    Calculation PositionPerf example:

    Open position at 100

    Close position at 110

    Then PositionPerf = (110 – 100) / 100 = 0,1

     

    #180826
    JS

    Or:

    Open position at 100

    Current price 108

    (Current)PositionPerf = (108 -100) / 100 = 0,08

    #180830

    To calculate the number of pips gained (or lost, if negative) so far, for a single position:

    for all positions (the output is the same as above if you only have one position open):

    So the correct code to check if profit is 10+ pips:

     

    1 user thanked author for this post.
    #180838

    Thanks, this function could be quite useful with different TP distances. Or as an exit from the market in profit in the evening or Friday evening.

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